From fba17d77de9e60de0e02e90dc6dbcbbf7454158a Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Wed, 23 Jan 2019 07:25:34 -0800 Subject: Refactor first time flow, remove seed phrase from state (#5994) * Refactor and fix styling for first time flow. Remove seed phrase from persisted metamask state * Fix linting and tests * Fix translations, initialization notice routing * Fix drizzle tests * Fix e2e tests * Fix integration tests * Fix styling * Fix migration naming from 030 to 031 * Open extension in browser when user has not completed onboarding --- app/scripts/migrations/031.js | 31 +++++++++++++++++++++++++++++++ app/scripts/migrations/index.js | 1 + 2 files changed, 32 insertions(+) create mode 100644 app/scripts/migrations/031.js (limited to 'app/scripts/migrations') diff --git a/app/scripts/migrations/031.js b/app/scripts/migrations/031.js new file mode 100644 index 000000000..98d182828 --- /dev/null +++ b/app/scripts/migrations/031.js @@ -0,0 +1,31 @@ +// next version number +const version = 31 +const clone = require('clone') + + /* + * The purpose of this migration is to properly set the completedOnboarding flag baesd on the state + * of the KeyringController. + */ +module.exports = { + version, + + migrate: async function (originalVersionedData) { + const versionedData = clone(originalVersionedData) + versionedData.meta.version = version + const state = versionedData.data + const newState = transformState(state) + versionedData.data = newState + return versionedData + }, +} + + function transformState (state) { + const { KeyringController, PreferencesController } = state + + if (KeyringController && PreferencesController) { + const { vault } = KeyringController + PreferencesController.completedOnboarding = Boolean(vault) + } + + return state +} diff --git a/app/scripts/migrations/index.js b/app/scripts/migrations/index.js index 99cca94b8..eb1b51685 100644 --- a/app/scripts/migrations/index.js +++ b/app/scripts/migrations/index.js @@ -41,4 +41,5 @@ module.exports = [ require('./028'), require('./029'), require('./030'), + require('./031'), ] -- cgit v1.2.3