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

Fix Settings/Info screen being visible on logout (#2490)

This commit is contained in:
Alexander Tseung 2017-10-26 23:02:56 -07:00 committed by Daniel Tsui
parent 3d53716f43
commit 4e8d8639cb
2 changed files with 43 additions and 6 deletions

View File

@ -808,9 +808,50 @@ function updateMetamaskState (newState) {
} }
} }
const backgroundSetLocked = () => {
return new Promise((resolve, reject) => {
background.setLocked(error => {
if (error) {
return reject(error)
}
resolve()
})
})
}
const updateMetamaskStateFromBackground = () => {
log.debug(`background.getState`)
return new Promise((resolve, reject) => {
background.getState((error, newState) => {
if (error) {
return reject(error)
}
resolve(newState)
})
})
}
function lockMetamask () { function lockMetamask () {
log.debug(`background.setLocked`) log.debug(`background.setLocked`)
return callBackgroundThenUpdate(background.setLocked)
return dispatch => {
dispatch(actions.showLoadingIndication())
return backgroundSetLocked()
.then(() => updateMetamaskStateFromBackground())
.catch(error => {
dispatch(actions.displayWarning(error.message))
return Promise.reject(error)
})
.then(newState => {
dispatch(actions.updateMetamaskState(newState))
dispatch({ type: actions.LOCK_METAMASK })
})
.catch(() => dispatch({ type: actions.LOCK_METAMASK }))
}
} }
function setCurrentAccountTab (newTabName) { function setCurrentAccountTab (newTabName) {

View File

@ -37,11 +37,7 @@ MainContainer.prototype.render = function () {
break break
case 'config': case 'config':
log.debug('rendering config screen from unlock screen.') log.debug('rendering config screen from unlock screen.')
contents = { return h(Settings, {key: 'config'})
component: Settings,
key: 'config',
}
break
default: default:
log.debug('rendering locked screen') log.debug('rendering locked screen')
contents = { contents = {