@@ -46,6 +46,17 @@ export enum UpdateCheckStatus {
4646 Ready = "READY" ,
4747}
4848
49+ export interface UpdateStatus {
50+ /**
51+ * The current phase of the manual update check.
52+ */
53+ status : UpdateCheckStatus ;
54+ /**
55+ * Detail string relating to the current status, typically for error details.
56+ */
57+ detail ?: string ;
58+ }
59+
4960const UPDATE_DEFER_KEY = "mx_defer_update" ;
5061
5162/**
@@ -63,11 +74,11 @@ export default abstract class BasePlatform {
6374 this . startUpdateCheck = this . startUpdateCheck . bind ( this ) ;
6475 }
6576
66- abstract getConfig ( ) : Promise < IConfigOptions > ;
77+ public abstract getConfig ( ) : Promise < IConfigOptions > ;
6778
68- abstract getDefaultDeviceDisplayName ( ) : string ;
79+ public abstract getDefaultDeviceDisplayName ( ) : string ;
6980
70- protected onAction = ( payload : ActionPayload ) => {
81+ protected onAction = ( payload : ActionPayload ) : void => {
7182 switch ( payload . action ) {
7283 case 'on_client_not_viable' :
7384 case Action . OnLoggedOut :
@@ -77,24 +88,24 @@ export default abstract class BasePlatform {
7788 } ;
7889
7990 // Used primarily for Analytics
80- abstract getHumanReadableName ( ) : string ;
91+ public abstract getHumanReadableName ( ) : string ;
8192
82- setNotificationCount ( count : number ) {
93+ public setNotificationCount ( count : number ) : void {
8394 this . notificationCount = count ;
8495 }
8596
86- setErrorStatus ( errorDidOccur : boolean ) {
97+ public setErrorStatus ( errorDidOccur : boolean ) : void {
8798 this . errorDidOccur = errorDidOccur ;
8899 }
89100
90101 /**
91102 * Whether we can call checkForUpdate on this platform build
92103 */
93- async canSelfUpdate ( ) : Promise < boolean > {
104+ public async canSelfUpdate ( ) : Promise < boolean > {
94105 return false ;
95106 }
96107
97- startUpdateCheck ( ) {
108+ public startUpdateCheck ( ) : void {
98109 hideUpdateToast ( ) ;
99110 localStorage . removeItem ( UPDATE_DEFER_KEY ) ;
100111 dis . dispatch < CheckUpdatesPayload > ( {
@@ -107,8 +118,7 @@ export default abstract class BasePlatform {
107118 * Update the currently running app to the latest available version
108119 * and replace this instance of the app with the new version.
109120 */
110- installUpdate ( ) {
111- }
121+ public installUpdate ( ) : void { }
112122
113123 /**
114124 * Check if the version update has been deferred and that deferment is still in effect
@@ -130,7 +140,7 @@ export default abstract class BasePlatform {
130140 * Ignore the pending update and don't prompt about this version
131141 * until the next morning (8am).
132142 */
133- deferUpdate ( newVersion : string ) {
143+ public deferUpdate ( newVersion : string ) : void {
134144 const date = new Date ( Date . now ( ) + 24 * 60 * 60 * 1000 ) ;
135145 date . setHours ( 8 , 0 , 0 , 0 ) ; // set to next 8am
136146 localStorage . setItem ( UPDATE_DEFER_KEY , JSON . stringify ( [ newVersion , date . getTime ( ) ] ) ) ;
@@ -141,7 +151,7 @@ export default abstract class BasePlatform {
141151 * Return true if platform supports multi-language
142152 * spell-checking, otherwise false.
143153 */
144- supportsMultiLanguageSpellCheck ( ) : boolean {
154+ public supportsMultiLanguageSpellCheck ( ) : boolean {
145155 return false ;
146156 }
147157
@@ -157,7 +167,7 @@ export default abstract class BasePlatform {
157167 * notifications, otherwise false.
158168 * @returns {boolean } whether the platform supports displaying notifications
159169 */
160- supportsNotifications ( ) : boolean {
170+ public supportsNotifications ( ) : boolean {
161171 return false ;
162172 }
163173
@@ -166,7 +176,7 @@ export default abstract class BasePlatform {
166176 * to display notifications. Otherwise false.
167177 * @returns {boolean } whether the application has permission to display notifications
168178 */
169- maySendNotifications ( ) : boolean {
179+ public maySendNotifications ( ) : boolean {
170180 return false ;
171181 }
172182
@@ -177,7 +187,7 @@ export default abstract class BasePlatform {
177187 * that is 'granted' if the user allowed the request or
178188 * 'denied' otherwise.
179189 */
180- abstract requestNotificationPermission ( ) : Promise < string > ;
190+ public abstract requestNotificationPermission ( ) : Promise < string > ;
181191
182192 public displayNotification (
183193 title : string ,
@@ -211,10 +221,9 @@ export default abstract class BasePlatform {
211221 return notification ;
212222 }
213223
214- loudNotification ( ev : MatrixEvent , room : Room ) {
215- }
224+ public loudNotification ( ev : MatrixEvent , room : Room ) : void { }
216225
217- clearNotification ( notif : Notification ) {
226+ public clearNotification ( notif : Notification ) : void {
218227 // Some browsers don't support this, e.g Safari on iOS
219228 // https://developer.mozilla.org/en-US/docs/Web/API/Notification/close
220229 if ( notif . close ) {
@@ -225,81 +234,23 @@ export default abstract class BasePlatform {
225234 /**
226235 * Returns a promise that resolves to a string representing the current version of the application.
227236 */
228- abstract getAppVersion ( ) : Promise < string > ;
229-
230- /*
231- * If it's not expected that capturing the screen will work
232- * with getUserMedia, return a string explaining why not.
233- * Otherwise, return null.
234- */
235- screenCaptureErrorString ( ) : string {
236- return "Not implemented" ;
237- }
237+ public abstract getAppVersion ( ) : Promise < string > ;
238238
239239 /**
240240 * Restarts the application, without necessarily reloading
241241 * any application code
242242 */
243- abstract reload ( ) ;
243+ public abstract reload ( ) : void ;
244244
245- supportsAutoLaunch ( ) : boolean {
245+ public supportsSetting ( settingName ?: string ) : boolean {
246246 return false ;
247247 }
248248
249- // XXX: Surely this should be a setting like any other?
250- async getAutoLaunchEnabled ( ) : Promise < boolean > {
251- return false ;
249+ public getSettingValue ( settingName : string ) : Promise < any > {
250+ return undefined ;
252251 }
253252
254- async setAutoLaunchEnabled ( enabled : boolean ) : Promise < void > {
255- throw new Error ( "Unimplemented" ) ;
256- }
257-
258- supportsWarnBeforeExit ( ) : boolean {
259- return false ;
260- }
261-
262- async shouldWarnBeforeExit ( ) : Promise < boolean > {
263- return false ;
264- }
265-
266- async setWarnBeforeExit ( enabled : boolean ) : Promise < void > {
267- throw new Error ( "Unimplemented" ) ;
268- }
269-
270- supportsAutoHideMenuBar ( ) : boolean {
271- return false ;
272- }
273-
274- async getAutoHideMenuBarEnabled ( ) : Promise < boolean > {
275- return false ;
276- }
277-
278- async setAutoHideMenuBarEnabled ( enabled : boolean ) : Promise < void > {
279- throw new Error ( "Unimplemented" ) ;
280- }
281-
282- supportsMinimizeToTray ( ) : boolean {
283- return false ;
284- }
285-
286- async getMinimizeToTrayEnabled ( ) : Promise < boolean > {
287- return false ;
288- }
289-
290- async setMinimizeToTrayEnabled ( enabled : boolean ) : Promise < void > {
291- throw new Error ( "Unimplemented" ) ;
292- }
293-
294- public supportsTogglingHardwareAcceleration ( ) : boolean {
295- return false ;
296- }
297-
298- public async getHardwareAccelerationEnabled ( ) : Promise < boolean > {
299- return true ;
300- }
301-
302- public async setHardwareAccelerationEnabled ( enabled : boolean ) : Promise < void > {
253+ public setSettingValue ( settingName : string , value : any ) : Promise < void > {
303254 throw new Error ( "Unimplemented" ) ;
304255 }
305256
@@ -309,23 +260,23 @@ export default abstract class BasePlatform {
309260 * @return {BaseEventIndexManager } The EventIndex manager for our platform,
310261 * can be null if the platform doesn't support event indexing.
311262 */
312- getEventIndexingManager ( ) : BaseEventIndexManager | null {
263+ public getEventIndexingManager ( ) : BaseEventIndexManager | null {
313264 return null ;
314265 }
315266
316- async setLanguage ( preferredLangs : string [ ] ) { }
267+ public setLanguage ( preferredLangs : string [ ] ) { }
317268
318- setSpellCheckLanguages ( preferredLangs : string [ ] ) { }
269+ public setSpellCheckLanguages ( preferredLangs : string [ ] ) { }
319270
320- getSpellCheckLanguages ( ) : Promise < string [ ] > | null {
271+ public getSpellCheckLanguages ( ) : Promise < string [ ] > | null {
321272 return null ;
322273 }
323274
324- async getDesktopCapturerSources ( options : GetSourcesOptions ) : Promise < Array < DesktopCapturerSource > > {
275+ public async getDesktopCapturerSources ( options : GetSourcesOptions ) : Promise < Array < DesktopCapturerSource > > {
325276 return [ ] ;
326277 }
327278
328- supportsDesktopCapturer ( ) : boolean {
279+ public supportsDesktopCapturer ( ) : boolean {
329280 return false ;
330281 }
331282
@@ -335,7 +286,7 @@ export default abstract class BasePlatform {
335286
336287 public navigateForwardBack ( back : boolean ) : void { }
337288
338- getAvailableSpellCheckLanguages ( ) : Promise < string [ ] > | null {
289+ public getAvailableSpellCheckLanguages ( ) : Promise < string [ ] > | null {
339290 return null ;
340291 }
341292
@@ -352,7 +303,12 @@ export default abstract class BasePlatform {
352303 * @param {string } fragmentAfterLogin the hash to pass to the app during sso callback.
353304 * @param {string } idpId The ID of the Identity Provider being targeted, optional.
354305 */
355- startSingleSignOn ( mxClient : MatrixClient , loginType : "sso" | "cas" , fragmentAfterLogin : string , idpId ?: string ) {
306+ public startSingleSignOn (
307+ mxClient : MatrixClient ,
308+ loginType : "sso" | "cas" ,
309+ fragmentAfterLogin : string ,
310+ idpId ?: string ,
311+ ) : void {
356312 // persist hs url and is url for when the user is returned to the app with the login token
357313 localStorage . setItem ( SSO_HOMESERVER_URL_KEY , mxClient . getHomeserverUrl ( ) ) ;
358314 if ( mxClient . getIdentityServerUrl ( ) ) {
@@ -365,10 +321,6 @@ export default abstract class BasePlatform {
365321 window . location . href = mxClient . getSsoLoginUrl ( callbackUrl . toString ( ) , loginType , idpId ) ; // redirect to SSO
366322 }
367323
368- onKeyDown ( ev : KeyboardEvent ) : boolean {
369- return false ; // no shortcuts implemented
370- }
371-
372324 /**
373325 * Get a previously stored pickle key. The pickle key is used for
374326 * encrypting libolm objects.
@@ -377,7 +329,7 @@ export default abstract class BasePlatform {
377329 * @returns {string|null } the previously stored pickle key, or null if no
378330 * pickle key has been stored.
379331 */
380- async getPickleKey ( userId : string , deviceId : string ) : Promise < string | null > {
332+ public async getPickleKey ( userId : string , deviceId : string ) : Promise < string | null > {
381333 if ( ! window . crypto || ! window . crypto . subtle ) {
382334 return null ;
383335 }
@@ -423,7 +375,7 @@ export default abstract class BasePlatform {
423375 * @returns {string|null } the pickle key, or null if the platform does not
424376 * support storing pickle keys.
425377 */
426- async createPickleKey ( userId : string , deviceId : string ) : Promise < string | null > {
378+ public async createPickleKey ( userId : string , deviceId : string ) : Promise < string | null > {
427379 if ( ! window . crypto || ! window . crypto . subtle ) {
428380 return null ;
429381 }
@@ -462,7 +414,7 @@ export default abstract class BasePlatform {
462414 * @param {string } userId the user ID for the user that the pickle key is for.
463415 * @param {string } userId the device ID that the pickle key is for.
464416 */
465- async destroyPickleKey ( userId : string , deviceId : string ) : Promise < void > {
417+ public async destroyPickleKey ( userId : string , deviceId : string ) : Promise < void > {
466418 try {
467419 await idbDelete ( "pickleKey" , [ userId , deviceId ] ) ;
468420 } catch ( e ) {
0 commit comments