aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/scripts/background.js1
-rw-r--r--app/scripts/lib/config-manager.js20
-rw-r--r--app/scripts/lib/idStore.js12
3 files changed, 31 insertions, 2 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js
index e77df1519..f79047db4 100644
--- a/app/scripts/background.js
+++ b/app/scripts/background.js
@@ -183,6 +183,7 @@ function setupControllerConnection(stream){
clearSeedWordCache: idStore.clearSeedWordCache.bind(idStore),
exportAccount: idStore.exportAccount.bind(idStore),
revealAccount: idStore.revealAccount.bind(idStore),
+ saveAccountLabel: idStore.saveAccountLabel.bind(idStore),
})
stream.pipe(dnode).pipe(stream)
dnode.on('remote', function(remote){
diff --git a/app/scripts/lib/config-manager.js b/app/scripts/lib/config-manager.js
index 7b2f2f1f8..f5e1cf38d 100644
--- a/app/scripts/lib/config-manager.js
+++ b/app/scripts/lib/config-manager.js
@@ -230,6 +230,26 @@ ConfigManager.prototype.updateTx = function(tx) {
this._saveTxList(transactions)
}
+// wallet nickname methods
+
+ConfigManager.prototype.getWalletNicknames = function() {
+ var data = this.getData()
+ let nicknames = ('walletNicknames' in data) ? data.walletNicknames : {}
+ return nicknames
+}
+
+ConfigManager.prototype.nicknameForWallet = function(account) {
+ let nicknames = this.getWalletNicknames()
+ return nicknames[account]
+}
+
+ConfigManager.prototype.setNicknameForWallet = function(account, nickname) {
+ let nicknames = this.getWalletNicknames()
+ nicknames[account] = nickname
+ var data = this.getData()
+ data.walletNicknames = nicknames
+ this.setData(data)
+}
// observable
diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js
index 0604c4bca..9d2552e8b 100644
--- a/app/scripts/lib/idStore.js
+++ b/app/scripts/lib/idStore.js
@@ -325,9 +325,10 @@ IdentityStore.prototype._loadIdentities = function(){
// // add to ethStore
this._ethStore.addAccount(address)
// add to identities
+ const defaultLabel = 'Wallet ' + (i+1)
+ const nickname = configManager.nicknameForWallet(address)
var identity = {
- name: 'Wallet ' + (i+1),
- img: 'QmW6hcwYzXrNkuHrpvo58YeZvbZxUddv69ATSHY3BHpPdd',
+ name: nickname || defaultLabel,
address: address,
mayBeFauceting: this._mayBeFauceting(i),
}
@@ -336,6 +337,13 @@ IdentityStore.prototype._loadIdentities = function(){
this._didUpdate()
}
+IdentityStore.prototype.saveAccountLabel = function(account, label, cb) {
+ configManager.setNicknameForWallet(account, label)
+ this._loadIdentities()
+ cb(null, label)
+ this._didUpdate()
+}
+
// mayBeFauceting
// If on testnet, index 0 may be fauceting.
// The UI will have to check the balance to know.