Ensure we register messageReceiver only after setup is complete
This commit is contained in:
parent
8e59a660ce
commit
1a98d50948
1 changed files with 6 additions and 6 deletions
|
@ -1554,14 +1554,11 @@ export async function startApp(): Promise<void> {
|
||||||
|
|
||||||
window.Whisper.events.on('online', () => {
|
window.Whisper.events.on('online', () => {
|
||||||
log.info('background: online');
|
log.info('background: online');
|
||||||
|
|
||||||
strictAssert(server !== undefined, 'WebAPI not initialized');
|
|
||||||
strictAssert(
|
strictAssert(
|
||||||
messageReceiver !== undefined,
|
messageReceiver !== undefined,
|
||||||
'MessageReceiver not initialized'
|
'MessageReceiver not initialized'
|
||||||
);
|
);
|
||||||
messageReceiver.reset();
|
messageReceiver.reset();
|
||||||
server.registerRequestHandler(messageReceiver);
|
|
||||||
|
|
||||||
// The first call to connect should be done via start(), ensuring that the app is
|
// The first call to connect should be done via start(), ensuring that the app is
|
||||||
// ready first
|
// ready first
|
||||||
|
@ -1577,9 +1574,6 @@ export async function startApp(): Promise<void> {
|
||||||
drop(AttachmentDownloads.stop());
|
drop(AttachmentDownloads.stop());
|
||||||
drop(messageReceiver?.drain());
|
drop(messageReceiver?.drain());
|
||||||
|
|
||||||
if (messageReceiver) {
|
|
||||||
server?.unregisterRequestHandler(messageReceiver);
|
|
||||||
}
|
|
||||||
if (connectCount === 0) {
|
if (connectCount === 0) {
|
||||||
log.info('background: offline, never connected, showing inbox');
|
log.info('background: offline, never connected, showing inbox');
|
||||||
|
|
||||||
|
@ -1675,6 +1669,12 @@ export async function startApp(): Promise<void> {
|
||||||
|
|
||||||
void window.Signal.Services.initializeGroupCredentialFetcher();
|
void window.Signal.Services.initializeGroupCredentialFetcher();
|
||||||
|
|
||||||
|
strictAssert(
|
||||||
|
messageReceiver !== undefined,
|
||||||
|
'MessageReceiver not initialized'
|
||||||
|
);
|
||||||
|
server.registerRequestHandler(messageReceiver);
|
||||||
|
|
||||||
drop(
|
drop(
|
||||||
AttachmentDownloads.start({
|
AttachmentDownloads.start({
|
||||||
logger: log,
|
logger: log,
|
||||||
|
|
Loading…
Reference in a new issue