diff options
author | brunobar79 <brunobar79@gmail.com> | 2018-07-12 09:21:36 +0800 |
---|---|---|
committer | brunobar79 <brunobar79@gmail.com> | 2018-07-12 09:21:36 +0800 |
commit | 80e875308b4447ed38d7e0f677570d73956dd9de (patch) | |
tree | fb2f0bdf95c6358295e3894b8302867bc8a16d51 /ui/app/actions.js | |
parent | 89cc48789af2bb6f0925384abe4d4a53179a3956 (diff) | |
download | tangerine-wallet-browser-80e875308b4447ed38d7e0f677570d73956dd9de.tar tangerine-wallet-browser-80e875308b4447ed38d7e0f677570d73956dd9de.tar.gz tangerine-wallet-browser-80e875308b4447ed38d7e0f677570d73956dd9de.tar.bz2 tangerine-wallet-browser-80e875308b4447ed38d7e0f677570d73956dd9de.tar.lz tangerine-wallet-browser-80e875308b4447ed38d7e0f677570d73956dd9de.tar.xz tangerine-wallet-browser-80e875308b4447ed38d7e0f677570d73956dd9de.tar.zst tangerine-wallet-browser-80e875308b4447ed38d7e0f677570d73956dd9de.zip |
forget device and autiload account features added
Diffstat (limited to 'ui/app/actions.js')
-rw-r--r-- | ui/app/actions.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js index 3bdd548d3..9330a864b 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -79,6 +79,8 @@ var actions = { importNewAccount, addNewAccount, connectHardware, + checkHardwareStatus, + forgetDevice, unlockTrezorAccount, NEW_ACCOUNT_SCREEN: 'NEW_ACCOUNT_SCREEN', navigateToNewAccountScreen, @@ -622,6 +624,48 @@ function addNewAccount () { } } +function checkHardwareStatus (deviceName) { + log.debug(`background.checkHardwareStatus`, deviceName) + return (dispatch, getState) => { + dispatch(actions.showLoadingIndication()) + return new Promise((resolve, reject) => { + background.checkHardwareStatus(deviceName, (err, unlocked) => { + if (err) { + log.error(err) + dispatch(actions.displayWarning(err.message)) + return reject(err) + } + + dispatch(actions.hideLoadingIndication()) + + forceUpdateMetamaskState(dispatch) + return resolve(unlocked) + }) + }) + } +} + +function forgetDevice (deviceName) { + log.debug(`background.forgetDevice`, deviceName) + return (dispatch, getState) => { + dispatch(actions.showLoadingIndication()) + return new Promise((resolve, reject) => { + background.forgetDevice(deviceName, (err, response) => { + if (err) { + log.error(err) + dispatch(actions.displayWarning(err.message)) + return reject(err) + } + + dispatch(actions.hideLoadingIndication()) + + forceUpdateMetamaskState(dispatch) + return resolve() + }) + }) + } +} + function connectHardware (deviceName, page) { log.debug(`background.connectHardware`, deviceName, page) return (dispatch, getState) => { |