Fix notifications not displaying when document is not focused (#1425)

Allows notifications from the active room while app is not focused (e.g. tabbed out)
This commit is contained in:
Alliegaytor 2023-09-24 14:31:02 +10:00 committed by GitHub
parent 47f6c44c17
commit fcd7723f73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -234,7 +234,7 @@ class Notifications extends EventEmitter {
const actions = this.matrixClient.getPushActionsForEvent(mEvent); const actions = this.matrixClient.getPushActionsForEvent(mEvent);
if (!actions?.notify) return; if (!actions?.notify) return;
if (navigation.selectedRoomId === room.roomId && document.visibilityState === 'visible') return; if (navigation.selectedRoomId === room.roomId && document.hasFocus()) return;
if (mEvent.isEncrypted()) { if (mEvent.isEncrypted()) {
await mEvent.attemptDecryption(this.matrixClient.crypto); await mEvent.attemptDecryption(this.matrixClient.crypto);