aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2017-11-16 01:39:54 +0800
committerDan <danjm.com@gmail.com>2017-12-05 10:38:23 +0800
commitdb06e7e649c5bdc98063bfeb7d7cbff999543c32 (patch)
tree9fff2b3fab229a1b5b6ddb1d48bca1c30ab1e8e9 /app/scripts
parentce14ee2ffcc784849ab42797d5c999b76ed57a78 (diff)
downloadtangerine-wallet-browser-db06e7e649c5bdc98063bfeb7d7cbff999543c32.tar
tangerine-wallet-browser-db06e7e649c5bdc98063bfeb7d7cbff999543c32.tar.gz
tangerine-wallet-browser-db06e7e649c5bdc98063bfeb7d7cbff999543c32.tar.bz2
tangerine-wallet-browser-db06e7e649c5bdc98063bfeb7d7cbff999543c32.tar.lz
tangerine-wallet-browser-db06e7e649c5bdc98063bfeb7d7cbff999543c32.tar.xz
tangerine-wallet-browser-db06e7e649c5bdc98063bfeb7d7cbff999543c32.tar.zst
tangerine-wallet-browser-db06e7e649c5bdc98063bfeb7d7cbff999543c32.zip
Css selected in background based on betaUI state.
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/popup.js21
1 files changed, 15 insertions, 6 deletions
diff --git a/app/scripts/popup.js b/app/scripts/popup.js
index 8cef06931..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,11 +12,6 @@ const notificationManager = new NotificationManager()
// create platform global
global.platform = new ExtensionPlatform()
-// inject css
-console.log(`MetaMaskUiCss`, MetaMaskUiCss);
-const css = MetaMaskUiCss()
-injectCss(css)
-
// identify window type (popup, notification)
const windowType = isPopupOrNotification()
global.METAMASK_UI_TYPE = windowType
@@ -29,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()
})
})