From 29facfe4d6194fe519c906983682a655f8fb6406 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Wed, 11 May 2016 22:21:10 -0700 Subject: Fix more transition bugs --- ui/app/actions.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'ui/app/actions.js') diff --git a/ui/app/actions.js b/ui/app/actions.js index dbcf3e577..45af35e67 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -312,19 +312,20 @@ function backToAccountDetail(address) { value: address, } } -function clearSeedWordCache() { +function clearSeedWordCache(account) { return { - type: this.CLEAR_SEED_WORD_CACHE + type: this.CLEAR_SEED_WORD_CACHE, + value: account, } } function confirmSeedWords() { return (dispatch) => { dispatch(this.showLoadingIndication()) - _accountManager.clearSeedWordCache((err, accounts) => { - dispatch(this.clearSeedWordCache()) - console.log('Seed word cache cleared.') - dispatch(this.showAccountDetail(accounts[0].address)) + _accountManager.clearSeedWordCache((err, account) => { + dispatch(this.clearSeedWordCache(account)) + console.log('Seed word cache cleared. ' + account) + dispatch(this.showAccountDetail(account)) }) } } -- cgit v1.2.3 From 041b5493dc43c9f8b69dc5a1dde4b319638618a7 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Fri, 13 May 2016 01:13:14 -0700 Subject: Streamlined some transition logic Fixes #122 Had used multiple actions for some transitions, which would lead to brief intermediary states. Now making a few actions much more explicit about what they route to, so there is less intermediary logic, and we can transition confidently to the correct view. --- ui/app/actions.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'ui/app/actions.js') diff --git a/ui/app/actions.js b/ui/app/actions.js index 45af35e67..f489eede7 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -114,7 +114,7 @@ function tryUnlockMetamask(password) { if (err) { dispatch(this.unlockFailed()) } else { - dispatch(this.unlockMetamask()) + dispatch(this.unlockMetamask(selectedAccount)) } }) } @@ -133,12 +133,12 @@ function recoverFromSeed(password, seed) { return (dispatch) => { // dispatch(this.createNewVaultInProgress()) dispatch(this.showLoadingIndication()) - _accountManager.recoverFromSeed(password, seed, (err, selectedAccount) => { + _accountManager.recoverFromSeed(password, seed, (err, metamaskState) => { dispatch(this.hideLoadingIndication()) if (err) return dispatch(this.displayWarning(err.message)) - dispatch(this.goHome()) - dispatch(this.unlockMetamask()) + var account = Object.keys(metamaskState.identities)[0] + dispatch(this.unlockMetamask(account)) }) } } @@ -271,9 +271,10 @@ function unlockFailed() { } } -function unlockMetamask() { +function unlockMetamask(account) { return { type: this.UNLOCK_METAMASK, + value: account, } } @@ -297,11 +298,13 @@ function lockMetamask() { function showAccountDetail(address) { return (dispatch) => { - _accountManager.setSelectedAddress(address) - - dispatch({ - type: this.SHOW_ACCOUNT_DETAIL, - value: address, + dispatch(this.showLoadingIndication()) + _accountManager.setSelectedAddress(address, (err, address) => { + dispatch(this.hideLoadingIndication()) + dispatch({ + type: this.SHOW_ACCOUNT_DETAIL, + value: address, + }) }) } } @@ -323,7 +326,6 @@ function confirmSeedWords() { return (dispatch) => { dispatch(this.showLoadingIndication()) _accountManager.clearSeedWordCache((err, account) => { - dispatch(this.clearSeedWordCache(account)) console.log('Seed word cache cleared. ' + account) dispatch(this.showAccountDetail(account)) }) -- cgit v1.2.3 From d18d9a8f97216afae4a6c9d8d659952ed5cba765 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Wed, 18 May 2016 12:30:03 -0700 Subject: Add animated sandwich button --- ui/app/actions.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'ui/app/actions.js') diff --git a/ui/app/actions.js b/ui/app/actions.js index f489eede7..c08019d9c 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -1,6 +1,9 @@ var actions = { GO_HOME: 'GO_HOME', goHome: goHome, + // menu state + TOGGLE_MENU: 'TOGGLE_MENU', + toggleMenu: toggleMenu, // remote state UPDATE_METAMASK_STATE: 'UPDATE_METAMASK_STATE', updateMetamaskState: updateMetamaskState, @@ -105,6 +108,14 @@ function goHome() { } } +// menu state + +function toggleMenu() { + return { + type: this.TOGGLE_MENU, + } +} + // async actions function tryUnlockMetamask(password) { -- cgit v1.2.3 From d0b0526765000ab6f56e8c35545d66a760ed7b61 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Wed, 18 May 2016 14:36:35 -0700 Subject: Add dynamic list item styles --- ui/app/actions.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ui/app/actions.js') diff --git a/ui/app/actions.js b/ui/app/actions.js index c08019d9c..ee5e417d4 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -4,6 +4,8 @@ var actions = { // menu state TOGGLE_MENU: 'TOGGLE_MENU', toggleMenu: toggleMenu, + SET_MENU_STATE: 'SET_MENU_STATE', + closeMenu: closeMenu, // remote state UPDATE_METAMASK_STATE: 'UPDATE_METAMASK_STATE', updateMetamaskState: updateMetamaskState, @@ -116,6 +118,13 @@ function toggleMenu() { } } +function closeMenu() { + return { + type: this.SET_MENU_STATE, + value: false, + } +} + // async actions function tryUnlockMetamask(password) { -- cgit v1.2.3 From 7d5aaaa5bd8a0f34694eb3e8ce5ba6bbecf03d71 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Fri, 20 May 2016 12:40:44 -0700 Subject: Add ability to add account to vault Scrolling to the bottom of the accounts page now reveals a downward-facing chevron button. Pressing this button shows loading indication, adds a new account to the identity vault, displays it in the list, and scrolls the list to the bottom of the page. Any number of accounts can be generated in this way, and the UX feels intuitive without having to overly explain how HD paths work. --- ui/app/actions.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ui/app/actions.js') diff --git a/ui/app/actions.js b/ui/app/actions.js index ee5e417d4..5d6f503e2 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -48,6 +48,8 @@ var actions = { SHOW_ACCOUNTS_PAGE: 'SHOW_ACCOUNTS_PAGE', SHOW_CONF_TX_PAGE: 'SHOW_CONF_TX_PAGE', SHOW_CONF_MSG_PAGE: 'SHOW_CONF_MSG_PAGE', + REVEAL_ACCOUNT: 'REVEAL_ACCOUNT', + revealAccount: revealAccount, // account detail screen SHOW_SEND_PAGE: 'SHOW_SEND_PAGE', showSendPage: showSendPage, @@ -175,6 +177,19 @@ function setSelectedAddress(address) { } } +function revealAccount() { + return (dispatch) => { + dispatch(this.showLoadingIndication()) + _accountManager.revealAccount((err) => { + dispatch(this.hideLoadingIndication()) + if (err) return dispatch(this.displayWarning(err.message)) + dispatch({ + type: this.REVEAL_ACCOUNT, + }) + }) + } +} + function signMsg(msgData) { return (dispatch) => { dispatch(this.showLoadingIndication()) -- cgit v1.2.3 From 95a3cfe3fcffee2ffabd4cf71e568ae94693b10f Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Fri, 20 May 2016 16:18:54 -0700 Subject: Added ability to nickname wallets locally The changes are persisted to localstorage, so they cannot be restored on a new computer, but for right now it's a nice organizational feature. --- ui/app/actions.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'ui/app/actions.js') diff --git a/ui/app/actions.js b/ui/app/actions.js index 5d6f503e2..9ff05c460 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -59,6 +59,8 @@ var actions = { exportAccount: exportAccount, SHOW_PRIVATE_KEY: 'SHOW_PRIVATE_KEY', showPrivateKey: showPrivateKey, + SAVE_ACCOUNT_LABEL: 'SAVE_ACCOUNT_LABEL', + saveAccountLabel: saveAccountLabel, // tx conf screen COMPLETED_TX: 'COMPLETED_TX', TRANSACTION_ERROR: 'TRANSACTION_ERROR', @@ -481,6 +483,22 @@ function showPrivateKey(key) { } } +function saveAccountLabel(account, label) { + return (dispatch) => { + dispatch(this.showLoadingIndication()) + _accountManager.saveAccountLabel(account, label, (err) => { + dispatch(this.hideLoadingIndication()) + if (err) { + return dispatch(this.showWarning(err.message)) + } + dispatch({ + type: this.SAVE_ACCOUNT_LABEL, + value: { account, label }, + }) + }) + } +} + function showSendPage() { return { type: this.SHOW_SEND_PAGE, -- cgit v1.2.3