diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-09-28 05:43:23 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-09-28 05:43:34 +0800 |
commit | 96ebbde634c5f89793f72a2316a0c9aa2a38bc4b (patch) | |
tree | a9e46e5b20edda852a37d28fd7b48408a504f5cd /app | |
parent | 87458dae2432559a501a867ecc0ab02ae5c64f05 (diff) | |
download | tangerine-wallet-browser-96ebbde634c5f89793f72a2316a0c9aa2a38bc4b.tar tangerine-wallet-browser-96ebbde634c5f89793f72a2316a0c9aa2a38bc4b.tar.gz tangerine-wallet-browser-96ebbde634c5f89793f72a2316a0c9aa2a38bc4b.tar.bz2 tangerine-wallet-browser-96ebbde634c5f89793f72a2316a0c9aa2a38bc4b.tar.lz tangerine-wallet-browser-96ebbde634c5f89793f72a2316a0c9aa2a38bc4b.tar.xz tangerine-wallet-browser-96ebbde634c5f89793f72a2316a0c9aa2a38bc4b.tar.zst tangerine-wallet-browser-96ebbde634c5f89793f72a2316a0c9aa2a38bc4b.zip |
Fix Account Selection
Do not select accounts on restore, only on creation and deliberate selection.
Fixes #2164
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/controllers/preferences.js | 2 | ||||
-rw-r--r-- | app/scripts/keyring-controller.js | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js index e45224593..bc4848421 100644 --- a/app/scripts/controllers/preferences.js +++ b/app/scripts/controllers/preferences.js @@ -22,7 +22,7 @@ class PreferencesController { }) } - getSelectedAddress (_address) { + getSelectedAddress () { return this.store.getState().selectedAddress } diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js index 1a1904621..b5c51fd03 100644 --- a/app/scripts/keyring-controller.js +++ b/app/scripts/keyring-controller.js @@ -107,7 +107,6 @@ class KeyringController extends EventEmitter { const firstAccount = accounts[0] if (!firstAccount) throw new Error('KeyringController - First Account not found.') const hexAccount = normalizeAddress(firstAccount) - this.emit('newAccount', hexAccount) return this.setupAccounts(accounts) }) .then(this.persistAllKeyrings.bind(this, password)) @@ -207,6 +206,12 @@ class KeyringController extends EventEmitter { // and then saves those changes. addNewAccount (selectedKeyring) { return selectedKeyring.addAccounts(1) + .then((accounts) => { + accounts.forEach((hexAccount) => { + this.emit('newAccount', hexAccount) + }) + return accounts + }) .then(this.setupAccounts.bind(this)) .then(this.persistAllKeyrings.bind(this)) .then(this._updateMemStoreKeyrings.bind(this)) @@ -325,7 +330,6 @@ class KeyringController extends EventEmitter { const firstAccount = accounts[0] if (!firstAccount) throw new Error('KeyringController - No account found on keychain.') const hexAccount = normalizeAddress(firstAccount) - this.emit('newAccount', hexAccount) this.emit('newVault', hexAccount) return this.setupAccounts(accounts) }) |