diff options
author | Alexander Tseung <alextsg@users.noreply.github.com> | 2017-10-27 14:02:56 +0800 |
---|---|---|
committer | Daniel Tsui <szehungdanieltsui@gmail.com> | 2017-10-27 14:02:56 +0800 |
commit | 4e8d8639cb29bd47c110765467393865e1c19f4e (patch) | |
tree | e05bc657bedede06fd9f7b839ca3f29f36f3f8ed /ui | |
parent | 3d53716f4366212ed7a51b49ce747584b13fd1ce (diff) | |
download | tangerine-wallet-browser-4e8d8639cb29bd47c110765467393865e1c19f4e.tar tangerine-wallet-browser-4e8d8639cb29bd47c110765467393865e1c19f4e.tar.gz tangerine-wallet-browser-4e8d8639cb29bd47c110765467393865e1c19f4e.tar.bz2 tangerine-wallet-browser-4e8d8639cb29bd47c110765467393865e1c19f4e.tar.lz tangerine-wallet-browser-4e8d8639cb29bd47c110765467393865e1c19f4e.tar.xz tangerine-wallet-browser-4e8d8639cb29bd47c110765467393865e1c19f4e.tar.zst tangerine-wallet-browser-4e8d8639cb29bd47c110765467393865e1c19f4e.zip |
Fix Settings/Info screen being visible on logout (#2490)
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/actions.js | 43 | ||||
-rw-r--r-- | ui/app/main-container.js | 6 |
2 files changed, 43 insertions, 6 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js index 2e9b34c58..8da530a79 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -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 () { 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) { diff --git a/ui/app/main-container.js b/ui/app/main-container.js index 6e2342c2b..031f61e84 100644 --- a/ui/app/main-container.js +++ b/ui/app/main-container.js @@ -37,11 +37,7 @@ MainContainer.prototype.render = function () { break case 'config': log.debug('rendering config screen from unlock screen.') - contents = { - component: Settings, - key: 'config', - } - break + return h(Settings, {key: 'config'}) default: log.debug('rendering locked screen') contents = { |