Trigger EnvelopeEvent for unsealed envelopes

Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
automated-signal 2022-01-18 17:47:40 -08:00 committed by GitHub
parent 8f85b32d9b
commit cc185159d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 28 deletions

View File

@ -306,10 +306,6 @@ export async function startApp(): Promise<void> {
})
);
messageReceiver.addEventListener('empty', queuedEventListener(onEmpty));
messageReceiver.addEventListener(
'reconnect',
queuedEventListener(onReconnect)
);
messageReceiver.addEventListener(
'configuration',
queuedEventListener(onConfiguration)
@ -2392,18 +2388,6 @@ export async function startApp(): Promise<void> {
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);

View File

@ -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}`);

View File

@ -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');