diff options
author | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2019-01-30 22:30:42 +0800 |
---|---|---|
committer | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2019-02-05 20:19:55 +0800 |
commit | c52ba96b85998f34bfb034f801556f4c89b8b6ba (patch) | |
tree | 6537c1d50b0f4ec2fe75425a4b3812420e4e2cab /app/scripts/migrations | |
parent | a7a6318c132d2c0014f7f6ee2ff70d4a9ec259ac (diff) | |
download | tangerine-wallet-browser-c52ba96b85998f34bfb034f801556f4c89b8b6ba.tar tangerine-wallet-browser-c52ba96b85998f34bfb034f801556f4c89b8b6ba.tar.gz tangerine-wallet-browser-c52ba96b85998f34bfb034f801556f4c89b8b6ba.tar.bz2 tangerine-wallet-browser-c52ba96b85998f34bfb034f801556f4c89b8b6ba.tar.lz tangerine-wallet-browser-c52ba96b85998f34bfb034f801556f4c89b8b6ba.tar.xz tangerine-wallet-browser-c52ba96b85998f34bfb034f801556f4c89b8b6ba.tar.zst tangerine-wallet-browser-c52ba96b85998f34bfb034f801556f4c89b8b6ba.zip |
Remove betaUI preference state, replace with completedUiMigration
Diffstat (limited to 'app/scripts/migrations')
-rw-r--r-- | app/scripts/migrations/032.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/app/scripts/migrations/032.js b/app/scripts/migrations/032.js new file mode 100644 index 000000000..e89fe383f --- /dev/null +++ b/app/scripts/migrations/032.js @@ -0,0 +1,29 @@ +const version = 32 +const clone = require('clone') + +/** + * The purpose of this migration is to set the {@code completedUiMigration} flag based on the user's UI preferences + */ +module.exports = { + version, + migrate: async function (originalVersionedData) { + const versionedData = clone(originalVersionedData) + versionedData.meta.version = version + const state = versionedData.data + versionedData.data = transformState(state) + return versionedData + }, +} + +function transformState (state) { + const { PreferencesController } = state + + if (PreferencesController) { + const { betaUI } = PreferencesController.featureFlags || {} + // Users who have been using the "beta" UI are considered to have completed the migration + // as they'll see no difference in this version + PreferencesController.completedUiMigration = betaUI + } + + return state +} |