Trigger EnvelopeEvent for unsealed envelopes
This commit is contained in:
parent
15fbbf0a67
commit
885b4d4d2e
3 changed files with 6 additions and 28 deletions
|
@ -305,10 +305,6 @@ export async function startApp(): Promise<void> {
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
messageReceiver.addEventListener('empty', queuedEventListener(onEmpty));
|
messageReceiver.addEventListener('empty', queuedEventListener(onEmpty));
|
||||||
messageReceiver.addEventListener(
|
|
||||||
'reconnect',
|
|
||||||
queuedEventListener(onReconnect)
|
|
||||||
);
|
|
||||||
messageReceiver.addEventListener(
|
messageReceiver.addEventListener(
|
||||||
'configuration',
|
'configuration',
|
||||||
queuedEventListener(onConfiguration)
|
queuedEventListener(onConfiguration)
|
||||||
|
@ -2395,18 +2391,6 @@ export async function startApp(): Promise<void> {
|
||||||
await window.crashReports.getCount()
|
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;
|
let initialStartupCount = 0;
|
||||||
window.Whisper.events.on('incrementProgress', incrementProgress);
|
window.Whisper.events.on('incrementProgress', incrementProgress);
|
||||||
|
|
|
@ -76,9 +76,9 @@ import type {
|
||||||
ProcessedEnvelope,
|
ProcessedEnvelope,
|
||||||
IRequestHandler,
|
IRequestHandler,
|
||||||
} from './Types.d';
|
} from './Types.d';
|
||||||
import type { ReconnectEvent, EnvelopeEvent } from './messageReceiverEvents';
|
|
||||||
import {
|
import {
|
||||||
EmptyEvent,
|
EmptyEvent,
|
||||||
|
EnvelopeEvent,
|
||||||
ProgressEvent,
|
ProgressEvent,
|
||||||
TypingEvent,
|
TypingEvent,
|
||||||
ErrorEvent,
|
ErrorEvent,
|
||||||
|
@ -361,11 +361,6 @@ export default class MessageReceiver
|
||||||
// EventTarget types
|
// EventTarget types
|
||||||
//
|
//
|
||||||
|
|
||||||
public override addEventListener(
|
|
||||||
name: 'reconnect',
|
|
||||||
handler: (ev: ReconnectEvent) => void
|
|
||||||
): void;
|
|
||||||
|
|
||||||
public override addEventListener(
|
public override addEventListener(
|
||||||
name: 'empty',
|
name: 'empty',
|
||||||
handler: (ev: EmptyEvent) => void
|
handler: (ev: EmptyEvent) => void
|
||||||
|
@ -1002,6 +997,11 @@ export default class MessageReceiver
|
||||||
|
|
||||||
logId = this.getEnvelopeId(unsealedEnvelope);
|
logId = this.getEnvelopeId(unsealedEnvelope);
|
||||||
|
|
||||||
|
this.addToQueue(
|
||||||
|
async () => this.dispatchEvent(new EnvelopeEvent(unsealedEnvelope)),
|
||||||
|
TaskType.Decrypted
|
||||||
|
);
|
||||||
|
|
||||||
return this.decryptEnvelope(stores, unsealedEnvelope, uuidKind);
|
return this.decryptEnvelope(stores, unsealedEnvelope, uuidKind);
|
||||||
}, `MessageReceiver: unseal and decrypt ${logId}`);
|
}, `MessageReceiver: unseal and decrypt ${logId}`);
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,6 @@ import type {
|
||||||
ModifiedGroupDetails,
|
ModifiedGroupDetails,
|
||||||
} from './ContactsParser';
|
} from './ContactsParser';
|
||||||
|
|
||||||
export class ReconnectEvent extends Event {
|
|
||||||
constructor() {
|
|
||||||
super('reconnect');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class EmptyEvent extends Event {
|
export class EmptyEvent extends Event {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('empty');
|
super('empty');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue