diff options
author | Alexander Tseung <alextsg@gmail.com> | 2018-01-04 03:06:08 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@gmail.com> | 2018-01-04 03:06:08 +0800 |
commit | a6f062a6865d3e1e5ceb98885ab4b38713e4293d (patch) | |
tree | ea379a341cc19f8942536b1800c309f7d79b3583 /app/scripts/popup.js | |
parent | 313b3c087a09bcc4462da15ff3caeac515967cf5 (diff) | |
parent | dfb22471087f040d8345a5a17321e1462842045c (diff) | |
download | tangerine-wallet-browser-a6f062a6865d3e1e5ceb98885ab4b38713e4293d.tar tangerine-wallet-browser-a6f062a6865d3e1e5ceb98885ab4b38713e4293d.tar.gz tangerine-wallet-browser-a6f062a6865d3e1e5ceb98885ab4b38713e4293d.tar.bz2 tangerine-wallet-browser-a6f062a6865d3e1e5ceb98885ab4b38713e4293d.tar.lz tangerine-wallet-browser-a6f062a6865d3e1e5ceb98885ab4b38713e4293d.tar.xz tangerine-wallet-browser-a6f062a6865d3e1e5ceb98885ab4b38713e4293d.tar.zst tangerine-wallet-browser-a6f062a6865d3e1e5ceb98885ab4b38713e4293d.zip |
Merge branch 'NewUI-flat' into NewUI-flat-4.0.5c
Diffstat (limited to 'app/scripts/popup.js')
-rw-r--r-- | app/scripts/popup.js | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/app/scripts/popup.js b/app/scripts/popup.js index 5f17f0651..d0952af6a 100644 --- a/app/scripts/popup.js +++ b/app/scripts/popup.js @@ -1,5 +1,6 @@ const injectCss = require('inject-css') -const MetaMaskUiCss = require('../../ui/css') +const OldMetaMaskUiCss = require('../../old-ui/css') +const NewMetaMaskUiCss = require('../../ui/css') const startPopup = require('./popup-core') const PortStream = require('./lib/port-stream.js') const isPopupOrNotification = require('./lib/is-popup-or-notification') @@ -11,10 +12,6 @@ const notificationManager = new NotificationManager() // create platform global global.platform = new ExtensionPlatform() -// inject css -const css = MetaMaskUiCss() -injectCss(css) - // identify window type (popup, notification) const windowType = isPopupOrNotification() global.METAMASK_UI_TYPE = windowType @@ -28,8 +25,21 @@ const connectionStream = new PortStream(extensionPort) const container = document.getElementById('app-content') startPopup({ container, connectionStream }, (err, store) => { if (err) return displayCriticalError(err) + + let betaUIState = store.getState().metamask.featureFlags.betaUI + let css = betaUIState ? NewMetaMaskUiCss() : OldMetaMaskUiCss() + let deleteInjectedCss = injectCss(css) + let newBetaUIState + store.subscribe(() => { const state = store.getState() + newBetaUIState = state.metamask.featureFlags.betaUI + if (newBetaUIState !== betaUIState) { + deleteInjectedCss() + betaUIState = newBetaUIState + css = betaUIState ? NewMetaMaskUiCss() : OldMetaMaskUiCss() + deleteInjectedCss = injectCss(css) + } if (state.appState.shouldClose) notificationManager.closePopup() }) }) |