diff --git a/js/src/modals/FirstRun/Welcome/welcome.js b/js/src/modals/FirstRun/Welcome/welcome.js index 629ec47bc..df438d112 100644 --- a/js/src/modals/FirstRun/Welcome/welcome.js +++ b/js/src/modals/FirstRun/Welcome/welcome.js @@ -49,7 +49,7 @@ export default class FirstRun extends Component { defaultMessage='As part of a new installation, the next few steps will guide you through the process of setting up you Parity instance and your associated accounts. Our aim is to make it as simple as possible and to get you up and running in record-time, so please bear with us. Once completed you will have -' />

-

+

-

+

{ this.firstrunVisible = visible; - store.set('showFirstRun', !!visible); + + // There's no need to write to storage that the + // First Run should be visible + if (!visible) { + store.set(LS_FIRST_RUN_KEY, !!visible); + } + } + + /** + * Migrate the old LocalStorage ket format + * to the new one + */ + _migrateStore () { + const oldValue = store.get(OLD_LS_FIRST_RUN_KEY); + const newValue = store.get(LS_FIRST_RUN_KEY); + + if (newValue === undefined && oldValue !== undefined) { + store.set(LS_FIRST_RUN_KEY, oldValue); + store.remove(OLD_LS_FIRST_RUN_KEY); + } } _checkAccounts () { - this._api.parity - .allAccountsInfo() - .then((info) => { + return Promise + .all([ + this._api.parity.listVaults(), + this._api.parity.allAccountsInfo() + ]) + .then(([ vaults, info ]) => { const accounts = Object.keys(info).filter((address) => info[address].uuid); + // Has accounts if any vaults or accounts + const hasAccounts = (accounts && accounts.length > 0) || (vaults && vaults.length > 0); - this.toggleFirstrun(this.firstrunVisible || !accounts || !accounts.length); + // Show First Run if no accounts and no vaults + this.toggleFirstrun(this.firstrunVisible || !hasAccounts); }) .catch((error) => { console.error('checkAccounts', error);