diff --git a/ts/background.ts b/ts/background.ts index f987a8ac40..6daa36f61d 100644 --- a/ts/background.ts +++ b/ts/background.ts @@ -305,10 +305,6 @@ export async function startApp(): Promise { }) ); messageReceiver.addEventListener('empty', queuedEventListener(onEmpty)); - messageReceiver.addEventListener( - 'reconnect', - queuedEventListener(onReconnect) - ); messageReceiver.addEventListener( 'configuration', queuedEventListener(onConfiguration) @@ -2395,18 +2391,6 @@ export async function startApp(): Promise { await window.crashReports.getCount() ); } - function onReconnect() { - // We disable notifications on first connect, but the same applies to reconnect. In - // scenarios where we're coming back from sleep, we can get offline/online events - // very fast, and it looks like a network blip. But we need to suppress - // notifications in these scenarios too. So we listen for 'reconnect' events. - profileKeyResponseQueue.pause(); - lightSessionResetQueue.pause(); - onDecryptionErrorQueue.pause(); - onRetryRequestQueue.pause(); - window.Whisper.deliveryReceiptQueue.pause(); - notificationService.disable(); - } let initialStartupCount = 0; window.Whisper.events.on('incrementProgress', incrementProgress); diff --git a/ts/textsecure/MessageReceiver.ts b/ts/textsecure/MessageReceiver.ts index 0365fa0129..7aa8a0ddc6 100644 --- a/ts/textsecure/MessageReceiver.ts +++ b/ts/textsecure/MessageReceiver.ts @@ -76,9 +76,9 @@ import type { ProcessedEnvelope, IRequestHandler, } from './Types.d'; -import type { ReconnectEvent, EnvelopeEvent } from './messageReceiverEvents'; import { EmptyEvent, + EnvelopeEvent, ProgressEvent, TypingEvent, ErrorEvent, @@ -361,11 +361,6 @@ export default class MessageReceiver // EventTarget types // - public override addEventListener( - name: 'reconnect', - handler: (ev: ReconnectEvent) => void - ): void; - public override addEventListener( name: 'empty', handler: (ev: EmptyEvent) => void @@ -1002,6 +997,11 @@ export default class MessageReceiver logId = this.getEnvelopeId(unsealedEnvelope); + this.addToQueue( + async () => this.dispatchEvent(new EnvelopeEvent(unsealedEnvelope)), + TaskType.Decrypted + ); + return this.decryptEnvelope(stores, unsealedEnvelope, uuidKind); }, `MessageReceiver: unseal and decrypt ${logId}`); diff --git a/ts/textsecure/messageReceiverEvents.ts b/ts/textsecure/messageReceiverEvents.ts index 86b6731029..b2b80d9a3d 100644 --- a/ts/textsecure/messageReceiverEvents.ts +++ b/ts/textsecure/messageReceiverEvents.ts @@ -15,12 +15,6 @@ import type { ModifiedGroupDetails, } from './ContactsParser'; -export class ReconnectEvent extends Event { - constructor() { - super('reconnect'); - } -} - export class EmptyEvent extends Event { constructor() { super('empty');