diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2017-02-28 05:54:07 +0800 |
---|---|---|
committer | Kevin Serrano <kevgagser@gmail.com> | 2017-02-28 05:54:07 +0800 |
commit | 9e6e3f55b719b2b186a1e26f25f03d95f2b2fd96 (patch) | |
tree | f6b9e9d7d2c57507269bdd422b0178dedbf9f120 /ui/app/reducers | |
parent | a77a5f0ab329433404893ff1280fb90ff2a12029 (diff) | |
parent | 462c7ae21316cbb3a242f53a0b726194a0faa64e (diff) | |
download | tangerine-wallet-browser-9e6e3f55b719b2b186a1e26f25f03d95f2b2fd96.tar tangerine-wallet-browser-9e6e3f55b719b2b186a1e26f25f03d95f2b2fd96.tar.gz tangerine-wallet-browser-9e6e3f55b719b2b186a1e26f25f03d95f2b2fd96.tar.bz2 tangerine-wallet-browser-9e6e3f55b719b2b186a1e26f25f03d95f2b2fd96.tar.lz tangerine-wallet-browser-9e6e3f55b719b2b186a1e26f25f03d95f2b2fd96.tar.xz tangerine-wallet-browser-9e6e3f55b719b2b186a1e26f25f03d95f2b2fd96.tar.zst tangerine-wallet-browser-9e6e3f55b719b2b186a1e26f25f03d95f2b2fd96.zip |
Merge branch 'i765-gaslimits' of github.com:MetaMask/metamask-plugin into i765-gaslimits
Diffstat (limited to 'ui/app/reducers')
-rw-r--r-- | ui/app/reducers/app.js | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index de6536c2e..136326301 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -6,14 +6,16 @@ const notification = require('../../../app/scripts/lib/notifications') module.exports = reduceApp function reduceApp (state, action) { + log.debug('App Reducer got ' + action.type) // clone and defaults const selectedAddress = state.metamask.selectedAddress - const pendingTxs = hasPendingTxs(state) + let pendingTxs = hasPendingTxs(state) let name = 'accounts' if (selectedAddress) { name = 'accountDetail' } if (pendingTxs) { + log.debug('pending txs detected, defaulting to conf-tx view.') name = 'confTx' } @@ -289,32 +291,37 @@ function reduceApp (state, action) { case actions.SHOW_CONF_TX_PAGE: return extend(appState, { currentView: { - name: 'confTx', + name: pendingTxs ? 'confTx' : 'account-detail', context: 0, }, transForward: action.transForward, warning: null, + isLoading: false, }) case actions.SHOW_CONF_MSG_PAGE: return extend(appState, { currentView: { - name: 'confTx', + name: pendingTxs ? 'confTx' : 'account-detail', context: 0, }, transForward: true, warning: null, + isLoading: false, }) case actions.COMPLETED_TX: - var unapprovedTxs = state.metamask.unapprovedTxs - var unapprovedMsgs = state.metamask.unapprovedMsgs - var network = state.metamask.network + log.debug('reducing COMPLETED_TX for tx ' + action.value) + var { unapprovedTxs, unapprovedMsgs, + unapprovedPersonalMsgs, network } = state.metamask + + var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, unapprovedPersonalMsgs, network) + .filter(tx => tx.id !== action.value ) - var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, network) - .filter(tx => tx !== tx.id) + pendingTxs = unconfTxList.length > 0 - if (unconfTxList && unconfTxList.length > 0) { + if (pendingTxs) { + log.debug('reducer detected txs - rendering confTx view') return extend(appState, { transForward: false, currentView: { @@ -324,6 +331,7 @@ function reduceApp (state, action) { warning: null, }) } else { + log.debug('attempting to close popup') notification.closePopup() return extend(appState, { @@ -572,11 +580,12 @@ function reduceApp (state, action) { } function hasPendingTxs (state) { - var unapprovedTxs = state.metamask.unapprovedTxs - var unapprovedMsgs = state.metamask.unapprovedMsgs - var network = state.metamask.network - var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, network) - return unconfTxList.length > 0 + var { unapprovedTxs, unapprovedMsgs, + unapprovedPersonalMsgs, network } = state.metamask + + var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, unapprovedPersonalMsgs, network) + var has = unconfTxList.length > 0 + return has } function indexForPending (state, txId) { |