diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2017-03-02 02:01:21 +0800 |
---|---|---|
committer | Kevin Serrano <kevgagser@gmail.com> | 2017-03-02 02:01:21 +0800 |
commit | 0a3849ec8477b4a61c50d715bd72b3e8f1ea8b66 (patch) | |
tree | cb569b1419363928282cd9ae0b4862d436c8fa58 /ui/app/reducers | |
parent | 930dafc4b0648353f847c529cdc19e2d762553ad (diff) | |
parent | f162a11585392df5e593018a02549f8b03018d22 (diff) | |
download | tangerine-wallet-browser-0a3849ec8477b4a61c50d715bd72b3e8f1ea8b66.tar tangerine-wallet-browser-0a3849ec8477b4a61c50d715bd72b3e8f1ea8b66.tar.gz tangerine-wallet-browser-0a3849ec8477b4a61c50d715bd72b3e8f1ea8b66.tar.bz2 tangerine-wallet-browser-0a3849ec8477b4a61c50d715bd72b3e8f1ea8b66.tar.lz tangerine-wallet-browser-0a3849ec8477b4a61c50d715bd72b3e8f1ea8b66.tar.xz tangerine-wallet-browser-0a3849ec8477b4a61c50d715bd72b3e8f1ea8b66.tar.zst tangerine-wallet-browser-0a3849ec8477b4a61c50d715bd72b3e8f1ea8b66.zip |
Fix merge conflicts.
Diffstat (limited to 'ui/app/reducers')
-rw-r--r-- | ui/app/reducers/app.js | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index de6536c2e..7ea1e1d7c 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' } @@ -294,27 +296,32 @@ function reduceApp (state, action) { }, 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, network) - .filter(tx => tx !== tx.id) + var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, unapprovedPersonalMsgs, network) + .filter(tx => tx.id !== action.value ) - if (unconfTxList && unconfTxList.length > 0) { + pendingTxs = 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) { |