1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Fix NewUI reveal seed flow. (#3410)

This commit is contained in:
Dan J Miller 2018-03-02 22:44:05 -03:30 committed by GitHub
parent 0c163dcb32
commit 0d97ff2210
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 8 deletions

View File

@ -853,15 +853,16 @@ function markPasswordForgotten () {
function unMarkPasswordForgotten () { function unMarkPasswordForgotten () {
return (dispatch) => { return (dispatch) => {
return background.unMarkPasswordForgotten(() => { return background.unMarkPasswordForgotten(() => {
dispatch(actions.forgotPassword()) dispatch(actions.forgotPassword(false))
forceUpdateMetamaskState(dispatch) forceUpdateMetamaskState(dispatch)
}) })
} }
} }
function forgotPassword () { function forgotPassword (forgotPasswordState = true) {
return { return {
type: actions.FORGOT_PASSWORD, type: actions.FORGOT_PASSWORD,
value: forgotPasswordState,
} }
} }

View File

@ -89,6 +89,7 @@ function mapStateToProps (state) {
currentCurrency: state.metamask.currentCurrency, currentCurrency: state.metamask.currentCurrency,
isMouseUser: state.appState.isMouseUser, isMouseUser: state.appState.isMouseUser,
betaUI: state.metamask.featureFlags.betaUI, betaUI: state.metamask.featureFlags.betaUI,
isRevealingSeedWords: state.metamask.isRevealingSeedWords,
// state needed to get account dropdown temporarily rendering from app bar // state needed to get account dropdown temporarily rendering from app bar
identities, identities,
@ -362,9 +363,16 @@ App.prototype.renderBackButton = function (style, justArrow = false) {
App.prototype.renderPrimary = function () { App.prototype.renderPrimary = function () {
log.debug('rendering primary') log.debug('rendering primary')
var props = this.props var props = this.props
const {isMascara, isOnboarding, betaUI} = props const {
isMascara,
isOnboarding,
betaUI,
isRevealingSeedWords,
} = props
const isMascaraOnboarding = isMascara && isOnboarding
const isBetaUIOnboarding = betaUI && isOnboarding && !props.isPopup && !isRevealingSeedWords
if ((isMascara || betaUI) && isOnboarding && !props.isPopup) { if (isMascaraOnboarding || isBetaUIOnboarding) {
return h(MascaraFirstTime) return h(MascaraFirstTime)
} }
@ -388,7 +396,7 @@ App.prototype.renderPrimary = function () {
if (props.isInitialized && props.forgottenPassword) { if (props.isInitialized && props.forgottenPassword) {
log.debug('rendering restore vault screen') log.debug('rendering restore vault screen')
return h(HDRestoreVaultScreen, {key: 'HDRestoreVaultScreen'}) return h(HDRestoreVaultScreen, {key: 'HDRestoreVaultScreen'})
} else if (!props.isInitialized && !props.isUnlocked) { } else if (!props.isInitialized && !props.isUnlocked && !isRevealingSeedWords) {
log.debug('rendering menu screen') log.debug('rendering menu screen')
return props.isPopup return props.isPopup
? h(OldUIInitializeMenuScreen, {key: 'menuScreenInit'}) ? h(OldUIInitializeMenuScreen, {key: 'menuScreenInit'})

View File

@ -140,10 +140,10 @@ function reduceApp (state, action) {
case actions.FORGOT_PASSWORD: case actions.FORGOT_PASSWORD:
return extend(appState, { return extend(appState, {
currentView: { currentView: {
name: 'restoreVault', name: action.value ? 'restoreVault' : 'accountDetail',
}, },
transForward: false, transForward: false,
forgottenPassword: true, forgottenPassword: action.value,
}) })
case actions.SHOW_INIT_MENU: case actions.SHOW_INIT_MENU:

View File

@ -43,12 +43,15 @@ function reduceMetamask (state, action) {
useBlockie: false, useBlockie: false,
featureFlags: {}, featureFlags: {},
networkEndpointType: OLD_UI_NETWORK_TYPE, networkEndpointType: OLD_UI_NETWORK_TYPE,
isRevealingSeedWords: false,
}, state.metamask) }, state.metamask)
switch (action.type) { switch (action.type) {
case actions.SHOW_ACCOUNTS_PAGE: case actions.SHOW_ACCOUNTS_PAGE:
newState = extend(metamaskState) newState = extend(metamaskState, {
isRevealingSeedWords: false,
})
delete newState.seedWords delete newState.seedWords
return newState return newState
@ -124,10 +127,12 @@ function reduceMetamask (state, action) {
}, },
}) })
case actions.SHOW_NEW_VAULT_SEED: case actions.SHOW_NEW_VAULT_SEED:
return extend(metamaskState, { return extend(metamaskState, {
isUnlocked: true, isUnlocked: true,
isInitialized: false, isInitialized: false,
isRevealingSeedWords: true,
seedWords: action.value, seedWords: action.value,
}) })