1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 11:22:43 +02:00

Show any pending txs when unlocking

Before the unlock action hard-routed to the home route, now it has a condition where it will show pending transactions instead.
This commit is contained in:
Dan Finlay 2016-05-03 15:04:15 -07:00
parent 46e100f595
commit 9c6ec054b1
4 changed files with 20 additions and 4 deletions

View File

@ -113,7 +113,6 @@ function tryUnlockMetamask(password) {
dispatch(this.unlockFailed())
} else {
dispatch(this.unlockMetamask())
dispatch(this.showAccountDetail(selectedAccount))
}
})
}

View File

@ -23,6 +23,7 @@ const ConfirmTxScreen = require('./conf-tx')
const ConfigScreen = require('./config')
const InfoScreen = require('./info')
const LoadingIndicator = require('./loading')
const txHelper = require('../lib/tx-helper')
module.exports = connect(mapStateToProps)(App)
@ -39,6 +40,8 @@ function mapStateToProps(state) {
activeAddress: state.appState.activeAddress,
transForward: state.appState.transForward,
seedWords: state.metamask.seedWords,
unconfTxs: state.metamask.unconfTxs,
unconfMsgs: state.metamask.unconfMsgs,
}
}
@ -202,8 +205,20 @@ App.prototype.renderPrimary = function(state){
return h(CreateVaultScreen, {key: 'createVault'})
default:
return h(AccountDetailScreen, {key: 'account-detail'})
}
if (this.hasPendingTxs()) {
return h(ConfirmTxScreen, {key: 'confirm-tx'})
} else {
return h(AccountDetailScreen, {key: 'account-detail'})
}
}
}
App.prototype.hasPendingTxs = function() {
var state = this.props
var unconfTxs = state.unconfTxs
var unconfMsgs = state.unconfMsgs
var unconfTxList = txHelper(unconfTxs, unconfMsgs)
return unconfTxList.length > 0
}
function onOffToggle(state){

View File

@ -38,7 +38,8 @@ ConfirmTxScreen.prototype.render = function() {
var unconfTxs = state.unconfTxs
var unconfMsgs = state.unconfMsgs
var unconfTxList = txHelper(unconfTxs, unconfMsgs)
var txData = unconfTxList[state.index] || {}
var index = state.index !== undefined ? state.index : 0
var txData = unconfTxList[index] || {}
return (

View File

@ -108,6 +108,7 @@ function reduceApp(state, action) {
case actions.UNLOCK_METAMASK:
return extend(appState, {
currentView: {},
transForward: true,
warning: null,
})