From 170c7602b70e475e75fbd1c7181d03e22465ae24 Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Fri, 16 Feb 2018 06:15:09 -0330 Subject: [PATCH] [NewUI] Adds the mascara first time flow to betaUI extension (#3257) * Adds the mascara first time flow to the extension when opened in browser. * Fix tests after addition of mascara first time flow to new ui. --- development/states/first-time.json | 2 +- test/integration/lib/first-time.js | 3 +-- ui/app/app.js | 10 ++++++---- ui/app/reducers/metamask.js | 2 ++ 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/development/states/first-time.json b/development/states/first-time.json index 6e7435db1..4f5352992 100644 --- a/development/states/first-time.json +++ b/development/states/first-time.json @@ -8,7 +8,7 @@ "frequentRpcList": [], "unapprovedTxs": {}, "currentCurrency": "USD", - "featureFlags": {"betaUI": true}, + "featureFlags": {"betaUI": false}, "conversionRate": 12.7527416, "conversionDate": 1487624341, "noActiveNotices": false, diff --git a/test/integration/lib/first-time.js b/test/integration/lib/first-time.js index 6e879dcd0..764eae47c 100644 --- a/test/integration/lib/first-time.js +++ b/test/integration/lib/first-time.js @@ -22,7 +22,6 @@ async function runFirstTimeUsageTest(assert, done) { reactTriggerChange(selectState[0]) await timeout(2000) - const app = $('#app-content') // recurse notices @@ -46,7 +45,7 @@ async function runFirstTimeUsageTest(assert, done) { await timeout() // Scroll through terms - const title = app.find('h1')[1] + const title = app.find('h1')[0] assert.equal(title.textContent, 'MetaMask', 'title screen') // enter password diff --git a/ui/app/app.js b/ui/app/app.js index cdb0c8c61..5ffd263d1 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -9,7 +9,7 @@ const classnames = require('classnames') const MascaraFirstTime = require('../../mascara/src/app/first-time').default const MascaraBuyEtherScreen = require('../../mascara/src/app/first-time/buy-ether-screen').default // init -const InitializeMenuScreen = require('./first-time/init-menu') +const InitializeMenuScreen = MascaraFirstTime const NewKeyChainScreen = require('./new-keychain') // accounts const MainContainer = require('./main-container') @@ -74,6 +74,7 @@ function mapStateToProps (state) { transForward: state.appState.transForward, isMascara: state.metamask.isMascara, isOnboarding: Boolean(!noActiveNotices || seedWords || !isInitialized), + isPopup: state.metamask.isPopup, seedWords: state.metamask.seedWords, unapprovedTxs: state.metamask.unapprovedTxs, unapprovedMsgs: state.metamask.unapprovedMsgs, @@ -85,7 +86,8 @@ function mapStateToProps (state) { lostAccounts: state.metamask.lostAccounts, frequentRpcList: state.metamask.frequentRpcList || [], currentCurrency: state.metamask.currentCurrency, - isMouseUser: state.appState.isMouseUser, + isMouseUser: state.appState.isMouseUser, + betaUI: state.metamask.featureFlags.betaUI, // state needed to get account dropdown temporarily rendering from app bar identities, @@ -351,9 +353,9 @@ App.prototype.renderBackButton = function (style, justArrow = false) { App.prototype.renderPrimary = function () { log.debug('rendering primary') var props = this.props - const {isMascara, isOnboarding} = props + const {isMascara, isOnboarding, betaUI} = props - if (isMascara && isOnboarding) { + if ((isMascara || betaUI) && isOnboarding && !props.isPopup) { return h(MascaraFirstTime) } diff --git a/ui/app/reducers/metamask.js b/ui/app/reducers/metamask.js index 294c29948..beeba948d 100644 --- a/ui/app/reducers/metamask.js +++ b/ui/app/reducers/metamask.js @@ -1,6 +1,7 @@ const extend = require('xtend') const actions = require('../actions') const MetamascaraPlatform = require('../../../app/scripts/platforms/window') +const environmentType = require('../../../app/scripts/lib/environment-type') const { OLD_UI_NETWORK_TYPE } = require('../../../app/scripts/config').enums module.exports = reduceMetamask @@ -14,6 +15,7 @@ function reduceMetamask (state, action) { isUnlocked: false, isAccountMenuOpen: false, isMascara: window.platform instanceof MetamascaraPlatform, + isPopup: environmentType() === 'popup', rpcTarget: 'https://rawtestrpc.metamask.io/', identities: {}, unapprovedTxs: {},