diff --git a/ts/background.ts b/ts/background.ts index 11fa54c6bf8b..7696e316ee4d 100644 --- a/ts/background.ts +++ b/ts/background.ts @@ -1410,8 +1410,6 @@ export async function startApp(): Promise { } } - window.dispatchEvent(new Event('storage_ready')); - void badgeImageFileDownloader.checkForFilesToDownload(); initializeExpiringMessageService(singleProtoJobQueue); @@ -1922,6 +1920,11 @@ export async function startApp(): Promise { return unlinkAndDisconnect(); } + if (!window.textsecure.storage.user.getPni()) { + log.error('PNI not captured during registration, unlinking softly'); + return unlinkAndDisconnect(); + } + if (connectCount === 1) { try { // Note: we always have to register our capabilities all at once, so we do this @@ -1939,11 +1942,6 @@ export async function startApp(): Promise { } } - if (!window.textsecure.storage.user.getPni()) { - log.error('PNI not captured during registration, unlinking softly'); - return unlinkAndDisconnect(); - } - if (firstRun === true && !areWePrimaryDevice) { if (!window.storage.get('accountEntropyPool')) { const lastSent = @@ -2028,23 +2026,18 @@ export async function startApp(): Promise { installed: true, })); - if (window.ConversationController.areWePrimaryDevice()) { - log.warn( - 'background/connect: We are primary device; not sending sticker pack sync' - ); - return; - } - - log.info('firstRun: requesting stickers', operations.length); - try { - await singleProtoJobQueue.add( - MessageSender.getStickerPackSync(operations) - ); - } catch (error) { - log.error( - 'connect: Failed to queue sticker sync message', - Errors.toLogFormat(error) - ); + if (!window.ConversationController.areWePrimaryDevice()) { + log.info('firstRun: requesting stickers', operations.length); + try { + await singleProtoJobQueue.add( + MessageSender.getStickerPackSync(operations) + ); + } catch (error) { + log.error( + 'connect: Failed to queue sticker sync message', + Errors.toLogFormat(error) + ); + } } }