diff options
author | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2019-01-30 22:16:40 +0800 |
---|---|---|
committer | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2019-02-05 20:19:55 +0800 |
commit | a7a6318c132d2c0014f7f6ee2ff70d4a9ec259ac (patch) | |
tree | 5d8343474f52d12044b590174b39d2172db7af00 | |
parent | c18b6f4117d7c3ccc36fde3c2792f7eb9641dfd9 (diff) | |
download | tangerine-wallet-browser-a7a6318c132d2c0014f7f6ee2ff70d4a9ec259ac.tar tangerine-wallet-browser-a7a6318c132d2c0014f7f6ee2ff70d4a9ec259ac.tar.gz tangerine-wallet-browser-a7a6318c132d2c0014f7f6ee2ff70d4a9ec259ac.tar.bz2 tangerine-wallet-browser-a7a6318c132d2c0014f7f6ee2ff70d4a9ec259ac.tar.lz tangerine-wallet-browser-a7a6318c132d2c0014f7f6ee2ff70d4a9ec259ac.tar.xz tangerine-wallet-browser-a7a6318c132d2c0014f7f6ee2ff70d4a9ec259ac.tar.zst tangerine-wallet-browser-a7a6318c132d2c0014f7f6ee2ff70d4a9ec259ac.zip |
Default to the new UI for all users
-rw-r--r-- | app/scripts/ui.js | 22 | ||||
-rw-r--r-- | ui/app/app.js | 2 | ||||
-rw-r--r-- | ui/app/components/send/tests/send-selectors-test-data.js | 2 | ||||
-rw-r--r-- | ui/app/root.js | 12 | ||||
-rw-r--r-- | ui/app/select-app.js | 65 | ||||
-rw-r--r-- | ui/app/selectors.js | 26 |
6 files changed, 13 insertions, 116 deletions
diff --git a/app/scripts/ui.js b/app/scripts/ui.js index e4b9b7b9c..67ec6bf06 100644 --- a/app/scripts/ui.js +++ b/app/scripts/ui.js @@ -1,7 +1,5 @@ const injectCss = require('inject-css') -const OldMetaMaskUiCss = require('../../old-ui/css') const NewMetaMaskUiCss = require('../../ui/css') -const {getShouldUseNewUi} = require('../../ui/app/selectors') const startPopup = require('./popup-core') const PortStream = require('extension-port-stream') const { getEnvironmentType } = require('./lib/util') @@ -49,30 +47,14 @@ async function start () { if (err) return displayCriticalError(err) const state = store.getState() - const { metamask: { completedOnboarding, featureFlags } = {} } = state + const { metamask: { completedOnboarding } = {} } = state if (!completedOnboarding && windowType !== ENVIRONMENT_TYPE_FULLSCREEN) { global.platform.openExtensionInBrowser() return } - let betaUIState = Boolean(featureFlags && featureFlags.betaUI) - const useBetaCss = getShouldUseNewUi(state) - - let css = useBetaCss ? 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) - } - }) + injectCss(NewMetaMaskUiCss()) }) diff --git a/ui/app/app.js b/ui/app/app.js index 28f4860a8..886bef35a 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -303,7 +303,6 @@ App.propTypes = { unapprovedTypedMessagesCount: PropTypes.number, welcomeScreenSeen: PropTypes.bool, isPopup: PropTypes.bool, - betaUI: PropTypes.bool, isMouseUser: PropTypes.bool, setMouseUserState: PropTypes.func, t: PropTypes.func, @@ -375,7 +374,6 @@ function mapStateToProps (state) { frequentRpcListDetail: state.metamask.frequentRpcListDetail || [], currentCurrency: state.metamask.currentCurrency, isMouseUser: state.appState.isMouseUser, - betaUI: state.metamask.featureFlags.betaUI, isRevealingSeedWords: state.metamask.isRevealingSeedWords, Qr: state.appState.Qr, welcomeScreenSeen: state.metamask.welcomeScreenSeen, diff --git a/ui/app/components/send/tests/send-selectors-test-data.js b/ui/app/components/send/tests/send-selectors-test-data.js index 66c0da229..d43d7c650 100644 --- a/ui/app/components/send/tests/send-selectors-test-data.js +++ b/ui/app/components/send/tests/send-selectors-test-data.js @@ -2,7 +2,7 @@ module.exports = { 'metamask': { 'isInitialized': true, 'isUnlocked': true, - 'featureFlags': {'betaUI': true, 'sendHexData': true}, + 'featureFlags': {'sendHexData': true}, 'rpcTarget': 'https://rawtestrpc.metamask.io/', 'identities': { '0xfdea65c8e26263f6d9a1b5de9555d2931a33b825': { diff --git a/ui/app/root.js b/ui/app/root.js index 09deae1b1..f9e3709a0 100644 --- a/ui/app/root.js +++ b/ui/app/root.js @@ -2,7 +2,9 @@ const { Component } = require('react') const PropTypes = require('prop-types') const { Provider } = require('react-redux') const h = require('react-hyperscript') -const SelectedApp = require('./select-app') +const { HashRouter } = require('react-router-dom') +const App = require('./app') +const I18nProvider = require('./i18n-provider') class Root extends Component { render () { @@ -10,7 +12,13 @@ class Root extends Component { return ( h(Provider, { store }, [ - h(SelectedApp), + h(HashRouter, { + hashType: 'noslash', + }, [ + h(I18nProvider, [ + h(App), + ]), + ]), ]) ) } diff --git a/ui/app/select-app.js b/ui/app/select-app.js deleted file mode 100644 index f5f9e33ab..000000000 --- a/ui/app/select-app.js +++ /dev/null @@ -1,65 +0,0 @@ -const inherits = require('util').inherits -const Component = require('react').Component -const connect = require('react-redux').connect -const h = require('react-hyperscript') -const { HashRouter } = require('react-router-dom') -const App = require('./app') -const OldApp = require('../../old-ui/app/app') -const { getShouldUseNewUi } = require('./selectors') -const { setFeatureFlag } = require('./actions') -const I18nProvider = require('./i18n-provider') - -function mapStateToProps (state) { - return { - isMascara: state.metamask.isMascara, - shouldUseNewUi: getShouldUseNewUi(state), - } -} - -function mapDispatchToProps (dispatch) { - return { - setFeatureFlagWithModal: () => { - return dispatch(setFeatureFlag('betaUI', true, 'BETA_UI_NOTIFICATION_MODAL')) - }, - setFeatureFlagWithoutModal: () => { - return dispatch(setFeatureFlag('betaUI', true)) - }, - } -} -module.exports = connect(mapStateToProps, mapDispatchToProps)(SelectedApp) - -inherits(SelectedApp, Component) -function SelectedApp () { - Component.call(this) -} - -SelectedApp.prototype.componentWillReceiveProps = function (nextProps) { - // Code commented out until we begin auto adding users to NewUI - const { - // isUnlocked, - // setFeatureFlagWithModal, - setFeatureFlagWithoutModal, - isMascara, - // firstTime, - } = this.props - - // if (isMascara || firstTime) { - if (isMascara) { - setFeatureFlagWithoutModal() - } - // } else if (!isUnlocked && nextProps.isUnlocked && (nextProps.autoAdd)) { - // setFeatureFlagWithModal() - // } -} - -SelectedApp.prototype.render = function () { - const { shouldUseNewUi } = this.props - const newUi = h(HashRouter, { - hashType: 'noslash', - }, [ - h(I18nProvider, [ - h(App), - ]), - ]) - return shouldUseNewUi ? newUi : h(OldApp) -} diff --git a/ui/app/selectors.js b/ui/app/selectors.js index c60b27ab4..6e9bf6470 100644 --- a/ui/app/selectors.js +++ b/ui/app/selectors.js @@ -28,8 +28,6 @@ const selectors = { getSendAmount, getSelectedTokenToFiatRate, getSelectedTokenContract, - autoAddToBetaUI, - getShouldUseNewUi, getSendMaxModeState, getCurrentViewContext, getTotalUnapprovedCount, @@ -212,30 +210,6 @@ function getSelectedTokenContract (state) { : null } -function autoAddToBetaUI (state) { - const autoAddTransactionThreshold = 12 - const autoAddAccountsThreshold = 2 - const autoAddTokensThreshold = 1 - - const numberOfTransactions = state.metamask.selectedAddressTxList.length - const numberOfAccounts = Object.keys(getMetaMaskAccounts(state)).length - const numberOfTokensAdded = state.metamask.tokens.length - - const userPassesThreshold = (numberOfTransactions > autoAddTransactionThreshold) && - (numberOfAccounts > autoAddAccountsThreshold) && - (numberOfTokensAdded > autoAddTokensThreshold) - const userIsNotInBeta = !state.metamask.featureFlags.betaUI - - return userIsNotInBeta && userPassesThreshold -} - -function getShouldUseNewUi (state) { - const isAlreadyUsingBetaUi = state.metamask.featureFlags.betaUI - const isMascara = state.metamask.isMascara - const isFreshInstall = Object.keys(state.metamask.identities).length === 0 - return isAlreadyUsingBetaUi || isMascara || isFreshInstall -} - function getCurrentViewContext (state) { const { currentView = {} } = state.appState return currentView.context |