2016-11-02 15:10:21 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
/*
|
2016-11-03 11:47:57 +00:00
|
|
|
Copyright 2016 Aviral Dasgupta
|
|
|
|
Copyright 2016 OpenMarket Ltd
|
2016-11-02 15:10:21 +00:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Base class for classes that provide platform-specific functionality
|
|
|
|
* eg. Setting an application badge or displaying notifications
|
|
|
|
*
|
|
|
|
* Instances of this class are provided by the application.
|
|
|
|
*/
|
|
|
|
export default class BasePlatform {
|
|
|
|
constructor() {
|
|
|
|
this.notificationCount = 0;
|
|
|
|
this.errorDidOccur = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
setNotificationCount(count: number) {
|
|
|
|
this.notificationCount = count;
|
|
|
|
}
|
|
|
|
|
|
|
|
setErrorStatus(errorDidOccur: boolean) {
|
|
|
|
this.errorDidOccur = errorDidOccur;
|
|
|
|
}
|
|
|
|
|
2016-11-02 17:35:31 +00:00
|
|
|
/**
|
|
|
|
* Returns true if the platform supports displaying
|
|
|
|
* notifications, otherwise false.
|
|
|
|
*/
|
|
|
|
supportsNotifications() : boolean {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the application currently has permission
|
|
|
|
* to display notifications. Otherwise false.
|
|
|
|
*/
|
|
|
|
maySendNotifications() : boolean {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Requests permission to send notifications. Returns
|
|
|
|
* a promise that is resolved when the user has responded
|
|
|
|
* to the request. The promise has a single string argument
|
|
|
|
* that is 'granted' if the user allowed the request or
|
|
|
|
* 'denied' otherwise.
|
|
|
|
*/
|
2016-11-02 19:23:09 +00:00
|
|
|
requestNotificationPermission() : Promise<string> {
|
2016-11-02 17:35:31 +00:00
|
|
|
}
|
|
|
|
|
2016-12-06 13:27:36 +00:00
|
|
|
displayNotification(title: string, msg: string, avatarUrl: string, room: Object) {
|
2016-11-02 15:10:21 +00:00
|
|
|
}
|
2016-11-08 10:45:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a promise that resolves to a string representing
|
|
|
|
* the current version of the application.
|
|
|
|
*/
|
|
|
|
getAppVersion() {
|
2016-11-08 11:43:24 +00:00
|
|
|
throw new Error("getAppVersion not implemented!");
|
2016-11-08 10:45:19 +00:00
|
|
|
}
|
2017-01-10 18:37:57 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If it's not expected that capturing the screen will work
|
|
|
|
* with getUserMedia, return a string explaining why not.
|
|
|
|
* Otherwise, return null.
|
|
|
|
*/
|
|
|
|
screenCaptureErrorString() {
|
|
|
|
return "Not implemented";
|
|
|
|
}
|
2016-11-02 15:10:21 +00:00
|
|
|
}
|