aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/actions.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-04-26 03:20:33 +0800
committerDan Finlay <dan@danfinlay.com>2016-04-26 03:38:43 +0800
commit2dd7bd6bd0d026da339c1e55d52270674be13f3d (patch)
treebb4b6df2be4720905db8960c3c6e4e40694eb7b9 /ui/app/actions.js
parent652c1d96c1a80864218fa4dadf7aa0f4102a583b (diff)
downloadtangerine-wallet-browser-2dd7bd6bd0d026da339c1e55d52270674be13f3d.tar
tangerine-wallet-browser-2dd7bd6bd0d026da339c1e55d52270674be13f3d.tar.gz
tangerine-wallet-browser-2dd7bd6bd0d026da339c1e55d52270674be13f3d.tar.bz2
tangerine-wallet-browser-2dd7bd6bd0d026da339c1e55d52270674be13f3d.tar.lz
tangerine-wallet-browser-2dd7bd6bd0d026da339c1e55d52270674be13f3d.tar.xz
tangerine-wallet-browser-2dd7bd6bd0d026da339c1e55d52270674be13f3d.tar.zst
tangerine-wallet-browser-2dd7bd6bd0d026da339c1e55d52270674be13f3d.zip
Make account detail view the primary view
- When unlocking, the first account is now selected by default and displayed as the main view. - There is now a "CHANGE ACCT" button on the detail view to show the accounts list. - Clicking an account from the accounts list now navigates to the detail view and selects that account. - Config/Info screen "back" buttons now fire a new action, `GO_HOME`, which is configured to navigate to the accountDetail view, putting that logic in one place. - When locking and unlocking again, the first account is always displayed, eventually we should persist the selection.
Diffstat (limited to 'ui/app/actions.js')
-rw-r--r--ui/app/actions.js25
1 files changed, 15 insertions, 10 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js
index 339c28be3..e2d81883f 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -1,4 +1,6 @@
var actions = {
+ GO_HOME: 'GO_HOME',
+ goHome: goHome,
// remote state
UPDATE_METAMASK_STATE: 'UPDATE_METAMASK_STATE',
updateMetamaskState: updateMetamaskState,
@@ -87,24 +89,29 @@ var actions = {
module.exports = actions
-
var _accountManager = null
function _setAccountManager(accountManager){
_accountManager = accountManager
}
+function goHome() {
+ return {
+ type: this.GO_HOME,
+ }
+}
+
// async actions
function tryUnlockMetamask(password) {
return (dispatch) => {
dispatch(this.unlockInProgress())
- _accountManager.submitPassword(password, (err) => {
+ _accountManager.submitPassword(password, (err, accounts) => {
dispatch(this.hideLoadingIndication())
if (err) {
dispatch(this.unlockFailed())
} else {
dispatch(this.unlockMetamask())
- dispatch(this.setSelectedAddress())
+ dispatch(this.showAccountDetail(accounts[0].address))
}
})
}
@@ -123,7 +130,7 @@ function recoverFromSeed(password, seed) {
return (dispatch) => {
// dispatch(this.createNewVaultInProgress())
dispatch(this.showLoadingIndication())
- _accountManager.recoverFromSeed(password, seed, (err, result) => {
+ _accountManager.recoverFromSeed(password, seed, (err, accounts) => {
if (err) {
dispatch(this.hideLoadingIndication())
var message = err.message
@@ -131,11 +138,9 @@ function recoverFromSeed(password, seed) {
}
dispatch(this.unlockMetamask())
- dispatch(this.setSelectedAddress())
- dispatch(this.updateMetamaskState(result))
+ dispatch(this.showAccountDetail(accounts[0].address))
dispatch(this.hideLoadingIndication())
- dispatch(this.showAccountsPage())
- })
+ })
}
}
@@ -297,10 +302,10 @@ function clearSeedWordCache() {
function confirmSeedWords() {
return (dispatch) => {
dispatch(this.showLoadingIndication())
- _accountManager.clearSeedWordCache((err) => {
+ _accountManager.clearSeedWordCache((err, accounts) => {
dispatch(this.clearSeedWordCache())
console.log('Seed word cache cleared.')
- dispatch(this.setSelectedAddress())
+ dispatch(this.showAccountDetail(accounts[0].address))
})
}
}