@@ -63,11 +63,11 @@ export default abstract class BasePlatform {
63
63
this . startUpdateCheck = this . startUpdateCheck . bind ( this ) ;
64
64
}
65
65
66
- abstract getConfig ( ) : Promise < IConfigOptions > ;
66
+ public abstract getConfig ( ) : Promise < IConfigOptions > ;
67
67
68
- abstract getDefaultDeviceDisplayName ( ) : string ;
68
+ public abstract getDefaultDeviceDisplayName ( ) : string ;
69
69
70
- protected onAction = ( payload : ActionPayload ) => {
70
+ protected onAction = ( payload : ActionPayload ) : void => {
71
71
switch ( payload . action ) {
72
72
case 'on_client_not_viable' :
73
73
case Action . OnLoggedOut :
@@ -77,24 +77,24 @@ export default abstract class BasePlatform {
77
77
} ;
78
78
79
79
// Used primarily for Analytics
80
- abstract getHumanReadableName ( ) : string ;
80
+ public abstract getHumanReadableName ( ) : string ;
81
81
82
- setNotificationCount ( count : number ) {
82
+ public setNotificationCount ( count : number ) : void {
83
83
this . notificationCount = count ;
84
84
}
85
85
86
- setErrorStatus ( errorDidOccur : boolean ) {
86
+ public setErrorStatus ( errorDidOccur : boolean ) : void {
87
87
this . errorDidOccur = errorDidOccur ;
88
88
}
89
89
90
90
/**
91
91
* Whether we can call checkForUpdate on this platform build
92
92
*/
93
- async canSelfUpdate ( ) : Promise < boolean > {
93
+ public async canSelfUpdate ( ) : Promise < boolean > {
94
94
return false ;
95
95
}
96
96
97
- startUpdateCheck ( ) {
97
+ public startUpdateCheck ( ) : void {
98
98
hideUpdateToast ( ) ;
99
99
localStorage . removeItem ( UPDATE_DEFER_KEY ) ;
100
100
dis . dispatch < CheckUpdatesPayload > ( {
@@ -107,8 +107,7 @@ export default abstract class BasePlatform {
107
107
* Update the currently running app to the latest available version
108
108
* and replace this instance of the app with the new version.
109
109
*/
110
- installUpdate ( ) {
111
- }
110
+ public installUpdate ( ) : void { }
112
111
113
112
/**
114
113
* Check if the version update has been deferred and that deferment is still in effect
@@ -130,7 +129,7 @@ export default abstract class BasePlatform {
130
129
* Ignore the pending update and don't prompt about this version
131
130
* until the next morning (8am).
132
131
*/
133
- deferUpdate ( newVersion : string ) {
132
+ public deferUpdate ( newVersion : string ) : void {
134
133
const date = new Date ( Date . now ( ) + 24 * 60 * 60 * 1000 ) ;
135
134
date . setHours ( 8 , 0 , 0 , 0 ) ; // set to next 8am
136
135
localStorage . setItem ( UPDATE_DEFER_KEY , JSON . stringify ( [ newVersion , date . getTime ( ) ] ) ) ;
@@ -141,7 +140,7 @@ export default abstract class BasePlatform {
141
140
* Return true if platform supports multi-language
142
141
* spell-checking, otherwise false.
143
142
*/
144
- supportsMultiLanguageSpellCheck ( ) : boolean {
143
+ public supportsMultiLanguageSpellCheck ( ) : boolean {
145
144
return false ;
146
145
}
147
146
@@ -157,7 +156,7 @@ export default abstract class BasePlatform {
157
156
* notifications, otherwise false.
158
157
* @returns {boolean } whether the platform supports displaying notifications
159
158
*/
160
- supportsNotifications ( ) : boolean {
159
+ public supportsNotifications ( ) : boolean {
161
160
return false ;
162
161
}
163
162
@@ -166,7 +165,7 @@ export default abstract class BasePlatform {
166
165
* to display notifications. Otherwise false.
167
166
* @returns {boolean } whether the application has permission to display notifications
168
167
*/
169
- maySendNotifications ( ) : boolean {
168
+ public maySendNotifications ( ) : boolean {
170
169
return false ;
171
170
}
172
171
@@ -177,7 +176,7 @@ export default abstract class BasePlatform {
177
176
* that is 'granted' if the user allowed the request or
178
177
* 'denied' otherwise.
179
178
*/
180
- abstract requestNotificationPermission ( ) : Promise < string > ;
179
+ public abstract requestNotificationPermission ( ) : Promise < string > ;
181
180
182
181
public displayNotification (
183
182
title : string ,
@@ -211,10 +210,9 @@ export default abstract class BasePlatform {
211
210
return notification ;
212
211
}
213
212
214
- loudNotification ( ev : MatrixEvent , room : Room ) {
215
- }
213
+ public loudNotification ( ev : MatrixEvent , room : Room ) : void { }
216
214
217
- clearNotification ( notif : Notification ) {
215
+ public clearNotification ( notif : Notification ) : void {
218
216
// Some browsers don't support this, e.g Safari on iOS
219
217
// https://developer.mozilla.org/en-US/docs/Web/API/Notification/close
220
218
if ( notif . close ) {
@@ -225,69 +223,69 @@ export default abstract class BasePlatform {
225
223
/**
226
224
* Returns a promise that resolves to a string representing the current version of the application.
227
225
*/
228
- abstract getAppVersion ( ) : Promise < string > ;
226
+ public abstract getAppVersion ( ) : Promise < string > ;
229
227
230
228
/*
231
229
* If it's not expected that capturing the screen will work
232
230
* with getUserMedia, return a string explaining why not.
233
231
* Otherwise, return null.
234
232
*/
235
- screenCaptureErrorString ( ) : string {
233
+ public screenCaptureErrorString ( ) : string {
236
234
return "Not implemented" ;
237
235
}
238
236
239
237
/**
240
238
* Restarts the application, without necessarily reloading
241
239
* any application code
242
240
*/
243
- abstract reload ( ) ;
241
+ public abstract reload ( ) : void ;
244
242
245
- supportsAutoLaunch ( ) : boolean {
243
+ public supportsAutoLaunch ( ) : boolean {
246
244
return false ;
247
245
}
248
246
249
247
// XXX: Surely this should be a setting like any other?
250
- async getAutoLaunchEnabled ( ) : Promise < boolean > {
248
+ public async getAutoLaunchEnabled ( ) : Promise < boolean > {
251
249
return false ;
252
250
}
253
251
254
- async setAutoLaunchEnabled ( enabled : boolean ) : Promise < void > {
252
+ public async setAutoLaunchEnabled ( enabled : boolean ) : Promise < void > {
255
253
throw new Error ( "Unimplemented" ) ;
256
254
}
257
255
258
- supportsWarnBeforeExit ( ) : boolean {
256
+ public supportsWarnBeforeExit ( ) : boolean {
259
257
return false ;
260
258
}
261
259
262
- async shouldWarnBeforeExit ( ) : Promise < boolean > {
260
+ public async shouldWarnBeforeExit ( ) : Promise < boolean > {
263
261
return false ;
264
262
}
265
263
266
- async setWarnBeforeExit ( enabled : boolean ) : Promise < void > {
264
+ public async setWarnBeforeExit ( enabled : boolean ) : Promise < void > {
267
265
throw new Error ( "Unimplemented" ) ;
268
266
}
269
267
270
- supportsAutoHideMenuBar ( ) : boolean {
268
+ public supportsAutoHideMenuBar ( ) : boolean {
271
269
return false ;
272
270
}
273
271
274
- async getAutoHideMenuBarEnabled ( ) : Promise < boolean > {
272
+ public async getAutoHideMenuBarEnabled ( ) : Promise < boolean > {
275
273
return false ;
276
274
}
277
275
278
- async setAutoHideMenuBarEnabled ( enabled : boolean ) : Promise < void > {
276
+ public async setAutoHideMenuBarEnabled ( enabled : boolean ) : Promise < void > {
279
277
throw new Error ( "Unimplemented" ) ;
280
278
}
281
279
282
- supportsMinimizeToTray ( ) : boolean {
280
+ public supportsMinimizeToTray ( ) : boolean {
283
281
return false ;
284
282
}
285
283
286
- async getMinimizeToTrayEnabled ( ) : Promise < boolean > {
284
+ public async getMinimizeToTrayEnabled ( ) : Promise < boolean > {
287
285
return false ;
288
286
}
289
287
290
- async setMinimizeToTrayEnabled ( enabled : boolean ) : Promise < void > {
288
+ public async setMinimizeToTrayEnabled ( enabled : boolean ) : Promise < void > {
291
289
throw new Error ( "Unimplemented" ) ;
292
290
}
293
291
@@ -309,23 +307,23 @@ export default abstract class BasePlatform {
309
307
* @return {BaseEventIndexManager } The EventIndex manager for our platform,
310
308
* can be null if the platform doesn't support event indexing.
311
309
*/
312
- getEventIndexingManager ( ) : BaseEventIndexManager | null {
310
+ public getEventIndexingManager ( ) : BaseEventIndexManager | null {
313
311
return null ;
314
312
}
315
313
316
- async setLanguage ( preferredLangs : string [ ] ) { }
314
+ public setLanguage ( preferredLangs : string [ ] ) { }
317
315
318
- setSpellCheckLanguages ( preferredLangs : string [ ] ) { }
316
+ public setSpellCheckLanguages ( preferredLangs : string [ ] ) { }
319
317
320
- getSpellCheckLanguages ( ) : Promise < string [ ] > | null {
318
+ public getSpellCheckLanguages ( ) : Promise < string [ ] > | null {
321
319
return null ;
322
320
}
323
321
324
- async getDesktopCapturerSources ( options : GetSourcesOptions ) : Promise < Array < DesktopCapturerSource > > {
322
+ public async getDesktopCapturerSources ( options : GetSourcesOptions ) : Promise < Array < DesktopCapturerSource > > {
325
323
return [ ] ;
326
324
}
327
325
328
- supportsDesktopCapturer ( ) : boolean {
326
+ public supportsDesktopCapturer ( ) : boolean {
329
327
return false ;
330
328
}
331
329
@@ -335,7 +333,7 @@ export default abstract class BasePlatform {
335
333
336
334
public navigateForwardBack ( back : boolean ) : void { }
337
335
338
- getAvailableSpellCheckLanguages ( ) : Promise < string [ ] > | null {
336
+ public getAvailableSpellCheckLanguages ( ) : Promise < string [ ] > | null {
339
337
return null ;
340
338
}
341
339
@@ -352,7 +350,12 @@ export default abstract class BasePlatform {
352
350
* @param {string } fragmentAfterLogin the hash to pass to the app during sso callback.
353
351
* @param {string } idpId The ID of the Identity Provider being targeted, optional.
354
352
*/
355
- startSingleSignOn ( mxClient : MatrixClient , loginType : "sso" | "cas" , fragmentAfterLogin : string , idpId ?: string ) {
353
+ public startSingleSignOn (
354
+ mxClient : MatrixClient ,
355
+ loginType : "sso" | "cas" ,
356
+ fragmentAfterLogin : string ,
357
+ idpId ?: string ,
358
+ ) : void {
356
359
// persist hs url and is url for when the user is returned to the app with the login token
357
360
localStorage . setItem ( SSO_HOMESERVER_URL_KEY , mxClient . getHomeserverUrl ( ) ) ;
358
361
if ( mxClient . getIdentityServerUrl ( ) ) {
@@ -365,10 +368,6 @@ export default abstract class BasePlatform {
365
368
window . location . href = mxClient . getSsoLoginUrl ( callbackUrl . toString ( ) , loginType , idpId ) ; // redirect to SSO
366
369
}
367
370
368
- onKeyDown ( ev : KeyboardEvent ) : boolean {
369
- return false ; // no shortcuts implemented
370
- }
371
-
372
371
/**
373
372
* Get a previously stored pickle key. The pickle key is used for
374
373
* encrypting libolm objects.
@@ -377,7 +376,7 @@ export default abstract class BasePlatform {
377
376
* @returns {string|null } the previously stored pickle key, or null if no
378
377
* pickle key has been stored.
379
378
*/
380
- async getPickleKey ( userId : string , deviceId : string ) : Promise < string | null > {
379
+ public async getPickleKey ( userId : string , deviceId : string ) : Promise < string | null > {
381
380
if ( ! window . crypto || ! window . crypto . subtle ) {
382
381
return null ;
383
382
}
@@ -423,7 +422,7 @@ export default abstract class BasePlatform {
423
422
* @returns {string|null } the pickle key, or null if the platform does not
424
423
* support storing pickle keys.
425
424
*/
426
- async createPickleKey ( userId : string , deviceId : string ) : Promise < string | null > {
425
+ public async createPickleKey ( userId : string , deviceId : string ) : Promise < string | null > {
427
426
if ( ! window . crypto || ! window . crypto . subtle ) {
428
427
return null ;
429
428
}
@@ -462,7 +461,7 @@ export default abstract class BasePlatform {
462
461
* @param {string } userId the user ID for the user that the pickle key is for.
463
462
* @param {string } userId the device ID that the pickle key is for.
464
463
*/
465
- async destroyPickleKey ( userId : string , deviceId : string ) : Promise < void > {
464
+ public async destroyPickleKey ( userId : string , deviceId : string ) : Promise < void > {
466
465
try {
467
466
await idbDelete ( "pickleKey" , [ userId , deviceId ] ) ;
468
467
} catch ( e ) {
0 commit comments