aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/popup.js
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@gmail.com>2017-12-23 03:00:46 +0800
committerAlexander Tseung <alextsg@gmail.com>2017-12-23 03:00:46 +0800
commit06410381d4b738fe22aa24973c7f9568d295f570 (patch)
tree69bd8701cdaa417cb6c0f46deff43414122101db /app/scripts/popup.js
parent06f496310ce7d719bbb5690f307db143ba57a1a7 (diff)
parenta218008adf85dfb5fa8ca93c789e14d9f2090813 (diff)
downloadtangerine-wallet-browser-06410381d4b738fe22aa24973c7f9568d295f570.tar.gz
tangerine-wallet-browser-06410381d4b738fe22aa24973c7f9568d295f570.tar.zst
tangerine-wallet-browser-06410381d4b738fe22aa24973c7f9568d295f570.zip
Merge branch 'NewUI-flat' into merge-master
Diffstat (limited to 'app/scripts/popup.js')
-rw-r--r--app/scripts/popup.js20
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()
})
})