diff --git a/ts/background.ts b/ts/background.ts index f1dcd7ed842..c815ae42ca0 100644 --- a/ts/background.ts +++ b/ts/background.ts @@ -400,6 +400,10 @@ export async function startApp(): Promise { } accountManager = new window.textsecure.AccountManager(server); + accountManager.addEventListener('startRegistration', () => { + backupReady.reject(new Error('startRegistration')); + backupReady = explodePromise(); + }); accountManager.addEventListener('registration', () => { window.Whisper.events.trigger('userChanged', false); diff --git a/ts/textsecure/AccountManager.ts b/ts/textsecure/AccountManager.ts index b6213957fe2..dd17c0027ad 100644 --- a/ts/textsecure/AccountManager.ts +++ b/ts/textsecure/AccountManager.ts @@ -899,6 +899,7 @@ export default class AccountManager extends EventTarget { private async createAccount( options: CreateAccountOptionsType ): Promise { + this.dispatchEvent(new Event('startRegistration')); const registrationBaton = this.server.startRegistration(); try { await this.doCreateAccount(options);