diff --git a/js/background.js b/js/background.js index e9cfde8e0..c55d0c988 100644 --- a/js/background.js +++ b/js/background.js @@ -107,6 +107,7 @@ // Ensure accounts created prior to 1.0.0-beta8 do have their // 'primaryDevicePubKey' defined. + if (Whisper.Registration.isDone() && !storage.get('primaryDevicePubKey', null)) { storage.put( 'primaryDevicePubKey', diff --git a/js/registration.js b/js/registration.js deleted file mode 100644 index 499e981bf..000000000 --- a/js/registration.js +++ /dev/null @@ -1,28 +0,0 @@ -/* global storage, Whisper */ - -// eslint-disable-next-line func-names -(function() { - 'use strict'; - - Whisper.Registration = { - markEverDone() { - storage.put('chromiumRegistrationDoneEver', ''); - }, - markDone() { - this.markEverDone(); - storage.put('chromiumRegistrationDone', ''); - }, - isDone() { - return storage.get('chromiumRegistrationDone') === ''; - }, - everDone() { - return ( - storage.get('chromiumRegistrationDoneEver') === '' || - storage.get('chromiumRegistrationDone') === '' - ); - }, - remove() { - storage.remove('chromiumRegistrationDone'); - }, - }; -})(); diff --git a/ts/util/registration.ts b/ts/util/registration.ts new file mode 100644 index 000000000..b7b16d2c6 --- /dev/null +++ b/ts/util/registration.ts @@ -0,0 +1,21 @@ +function markEverDone() { + storage.put('chromiumRegistrationDoneEver', ''); +} +function markDone() { + this.markEverDone(); + storage.put('chromiumRegistrationDone', ''); +} +function isDone() { + return storage.get('chromiumRegistrationDone') === ''; +} +function everDone() { + return ( + storage.get('chromiumRegistrationDoneEver') === '' || + storage.get('chromiumRegistrationDone') === '' + ); +} +function remove() { + storage.remove('chromiumRegistrationDone'); +} + +export const Registration = { markEverDone, markDone, isDone, everDone, remove };