From a7a6318c132d2c0014f7f6ee2ff70d4a9ec259ac Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Wed, 30 Jan 2019 10:46:40 -0330 Subject: Default to the new UI for all users --- ui/app/app.js | 2 - .../send/tests/send-selectors-test-data.js | 2 +- ui/app/root.js | 12 +++- ui/app/select-app.js | 65 ---------------------- ui/app/selectors.js | 26 --------- 5 files changed, 11 insertions(+), 96 deletions(-) delete mode 100644 ui/app/select-app.js (limited to 'ui/app') 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 -- cgit