aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-04-26 05:14:34 +0800
committerDan Finlay <dan@danfinlay.com>2016-04-26 05:14:34 +0800
commit1025eb3b4f90c2b909fe9d238cebba878c8ce2db (patch)
tree22545ef15f6bb672e3f3070cda9de3a80504ebd2 /ui/app
parent88ed546a9ae9a04f9ba09fe1d24910fe6c88292f (diff)
downloadtangerine-wallet-browser-1025eb3b4f90c2b909fe9d238cebba878c8ce2db.tar
tangerine-wallet-browser-1025eb3b4f90c2b909fe9d238cebba878c8ce2db.tar.gz
tangerine-wallet-browser-1025eb3b4f90c2b909fe9d238cebba878c8ce2db.tar.bz2
tangerine-wallet-browser-1025eb3b4f90c2b909fe9d238cebba878c8ce2db.tar.lz
tangerine-wallet-browser-1025eb3b4f90c2b909fe9d238cebba878c8ce2db.tar.xz
tangerine-wallet-browser-1025eb3b4f90c2b909fe9d238cebba878c8ce2db.tar.zst
tangerine-wallet-browser-1025eb3b4f90c2b909fe9d238cebba878c8ce2db.zip
Persist selected account
When selecting an account, we now persist the selection to the `configManager`, so the selection can be restored when re-unlocking Metamask. Also found the bug where `rawtestrpc` was still being used as a default, and fixed it!
Diffstat (limited to 'ui/app')
-rw-r--r--ui/app/actions.js18
-rw-r--r--ui/app/components/account-panel.js6
-rw-r--r--ui/app/reducers/app.js4
3 files changed, 14 insertions, 14 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js
index e2d81883f..a2106ea85 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -105,13 +105,13 @@ function goHome() {
function tryUnlockMetamask(password) {
return (dispatch) => {
dispatch(this.unlockInProgress())
- _accountManager.submitPassword(password, (err, accounts) => {
+ _accountManager.submitPassword(password, (err, selectedAccount) => {
dispatch(this.hideLoadingIndication())
if (err) {
dispatch(this.unlockFailed())
} else {
dispatch(this.unlockMetamask())
- dispatch(this.showAccountDetail(accounts[0].address))
+ dispatch(this.showAccountDetail(selectedAccount))
}
})
}
@@ -130,7 +130,7 @@ function recoverFromSeed(password, seed) {
return (dispatch) => {
// dispatch(this.createNewVaultInProgress())
dispatch(this.showLoadingIndication())
- _accountManager.recoverFromSeed(password, seed, (err, accounts) => {
+ _accountManager.recoverFromSeed(password, seed, (err, selectedAccount) => {
if (err) {
dispatch(this.hideLoadingIndication())
var message = err.message
@@ -138,7 +138,7 @@ function recoverFromSeed(password, seed) {
}
dispatch(this.unlockMetamask())
- dispatch(this.showAccountDetail(accounts[0].address))
+ dispatch(this.showAccountDetail(selectedAccount))
dispatch(this.hideLoadingIndication())
})
}
@@ -281,9 +281,13 @@ function lockMetamask() {
}
function showAccountDetail(address) {
- return {
- type: this.SHOW_ACCOUNT_DETAIL,
- value: address,
+ return (dispatch) => {
+ _accountManager.setSelectedAddress(address)
+
+ dispatch({
+ type: this.SHOW_ACCOUNT_DETAIL,
+ value: address,
+ })
}
}
diff --git a/ui/app/components/account-panel.js b/ui/app/components/account-panel.js
index 9de29cd91..9fda2ebfc 100644
--- a/ui/app/components/account-panel.js
+++ b/ui/app/components/account-panel.js
@@ -25,7 +25,7 @@ AccountPanel.prototype.render = function() {
style: {
flex: '1 0 auto',
},
- onClick: state.onShowDetail && state.onShowDetail.bind(null, identity.address),
+ onClick: (event) => state.onShowDetail(identity.address, event),
}, [
// account identicon
@@ -53,9 +53,7 @@ AccountPanel.prototype.render = function() {
// navigate to account detail
!state.onShowDetail ? null :
- h('.arrow-right.cursor-pointer', {
- onClick: state.onShowDetail && state.onShowDetail.bind(null, identity.address),
- }, [
+ h('.arrow-right.cursor-pointer', [
h('i.fa.fa-chevron-right.fa-lg'),
]),
])
diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js
index 131b434e9..f522e6042 100644
--- a/ui/app/reducers/app.js
+++ b/ui/app/reducers/app.js
@@ -7,12 +7,10 @@ module.exports = reduceApp
function reduceApp(state, action) {
// clone and defaults
- var accounts = valuesFor(state.metamask.accounts)
- var account = accounts.length ? valuesFor(state.metamask.accounts)[0].address : null
var defaultView = {
name: 'accountDetail',
detailView: null,
- context: account,
+ context: state.metamask.selectedAccount,
}
// confirm seed words