@@ -68,7 +68,7 @@ Override both the content body and the TextForEvent handler for specific msgtype
6868This is useful when the content body contains fallback text that would explain that the client can't handle a particular
6969type of tile.
7070*/
71- const msgTypeHandlers : Record < string , ( event : MatrixEvent ) => string > = {
71+ const msgTypeHandlers : Record < string , ( event : MatrixEvent ) => string | null > = {
7272 [ MsgType . KeyVerificationRequest ] : ( event : MatrixEvent ) => {
7373 const name = ( event . sender || { } ) . name ;
7474 return _t ( "%(name)s is requesting verification" , { name } ) ;
@@ -156,7 +156,7 @@ class NotifierClass {
156156 msg = "" ;
157157 }
158158
159- let avatarUrl = null ;
159+ let avatarUrl : string | null = null ;
160160 if ( ev . sender && ! SettingsStore . getValue ( "lowBandwidth" ) ) {
161161 avatarUrl = Avatar . avatarUrlForMember ( ev . sender , 40 , 40 , "crop" ) ;
162162 }
@@ -166,8 +166,8 @@ class NotifierClass {
166166 // if displayNotification returns non-null, the platform supports
167167 // clearing notifications later, so keep track of this.
168168 if ( notif ) {
169- if ( this . notifsByRoom [ ev . getRoomId ( ) ] === undefined ) this . notifsByRoom [ ev . getRoomId ( ) ] = [ ] ;
170- this . notifsByRoom [ ev . getRoomId ( ) ] . push ( notif ) ;
169+ if ( this . notifsByRoom [ ev . getRoomId ( ) ! ] === undefined ) this . notifsByRoom [ ev . getRoomId ( ) ! ] = [ ] ;
170+ this . notifsByRoom [ ev . getRoomId ( ) ! ] . push ( notif ) ;
171171 }
172172 }
173173
@@ -219,7 +219,7 @@ class NotifierClass {
219219 sound ? `audio[src='${ sound . url } ']` : "#messageAudio" ,
220220 ) ;
221221 let audioElement = selector ;
222- if ( ! selector ) {
222+ if ( ! audioElement ) {
223223 if ( ! sound ) {
224224 logger . error ( "No audio element or sound to play for notification" ) ;
225225 return ;
@@ -378,11 +378,11 @@ class NotifierClass {
378378 return global . localStorage . getItem ( "notifications_hidden" ) === "true" ;
379379 }
380380
381- return this . toolbarHidden ;
381+ return ! ! this . toolbarHidden ;
382382 }
383383
384384 // XXX: Exported for tests
385- public onSyncStateChange = ( state : SyncState , prevState ? : SyncState , data ?: ISyncStateData ) : void => {
385+ public onSyncStateChange = ( state : SyncState , prevState : SyncState | null , data ?: ISyncStateData ) : void => {
386386 if ( state === SyncState . Syncing ) {
387387 this . isSyncing = true ;
388388 } else if ( state === SyncState . Stopped || state === SyncState . Error ) {
@@ -411,7 +411,7 @@ class NotifierClass {
411411 // If it's an encrypted event and the type is still 'm.room.encrypted',
412412 // it hasn't yet been decrypted, so wait until it is.
413413 if ( ev . isBeingDecrypted ( ) || ev . isDecryptionFailure ( ) ) {
414- this . pendingEncryptedEventIds . push ( ev . getId ( ) ) ;
414+ this . pendingEncryptedEventIds . push ( ev . getId ( ) ! ) ;
415415 // don't let the list fill up indefinitely
416416 while ( this . pendingEncryptedEventIds . length > MAX_PENDING_ENCRYPTED ) {
417417 this . pendingEncryptedEventIds . shift ( ) ;
@@ -427,7 +427,7 @@ class NotifierClass {
427427 // in which case it might decrypt soon if the keys arrive
428428 if ( ev . isDecryptionFailure ( ) ) return ;
429429
430- const idx = this . pendingEncryptedEventIds . indexOf ( ev . getId ( ) ) ;
430+ const idx = this . pendingEncryptedEventIds . indexOf ( ev . getId ( ) ! ) ;
431431 if ( idx === - 1 ) return ;
432432
433433 this . pendingEncryptedEventIds . splice ( idx , 1 ) ;
@@ -456,7 +456,7 @@ class NotifierClass {
456456 public evaluateEvent ( ev : MatrixEvent ) : void {
457457 // Mute notifications for broadcast info events
458458 if ( ev . getType ( ) === VoiceBroadcastInfoEventType ) return ;
459- let roomId = ev . getRoomId ( ) ;
459+ let roomId = ev . getRoomId ( ) ! ;
460460 if ( LegacyCallHandler . instance . getSupportsVirtualRooms ( ) ) {
461461 // Attempt to translate a virtual room to a native one
462462 const nativeRoomId = VoipUserMapper . sharedInstance ( ) . nativeRoomForVirtualRoom ( roomId ) ;
@@ -492,7 +492,7 @@ class NotifierClass {
492492 this . displayPopupNotification ( ev , room ) ;
493493 }
494494 if ( actions . tweaks . sound && this . isAudioEnabled ( ) ) {
495- PlatformPeg . get ( ) . loudNotification ( ev , room ) ;
495+ PlatformPeg . get ( ) ? .loudNotification ( ev , room ) ;
496496 this . playAudioNotification ( ev , room ) ;
497497 }
498498 }
@@ -504,7 +504,7 @@ class NotifierClass {
504504 private performCustomEventHandling ( ev : MatrixEvent ) : void {
505505 if ( ElementCall . CALL_EVENT_TYPE . names . includes ( ev . getType ( ) ) && SettingsStore . getValue ( "feature_group_calls" ) ) {
506506 ToastStore . sharedInstance ( ) . addOrReplaceToast ( {
507- key : getIncomingCallToastKey ( ev . getStateKey ( ) ) ,
507+ key : getIncomingCallToastKey ( ev . getStateKey ( ) ! ) ,
508508 priority : 100 ,
509509 component : IncomingCallToast ,
510510 bodyClassName : "mx_IncomingCallToast" ,
0 commit comments