Save last opened wallet
This commit is contained in:
parent
698bd3f616
commit
9b1708b88e
6 changed files with 62 additions and 1 deletions
|
|
@ -143,6 +143,7 @@ WalletFactory.prototype.create = function(opts) {
|
|||
opts.version = opts.version || this.version;
|
||||
var w = new Wallet(opts);
|
||||
w.store();
|
||||
this.storage.setLastOpened(w.id);
|
||||
return w;
|
||||
};
|
||||
|
||||
|
|
@ -179,6 +180,8 @@ WalletFactory.prototype.open = function(walletId, opts) {
|
|||
if (w) {
|
||||
w.store();
|
||||
}
|
||||
|
||||
this.storage.setLastOpened(walletId);
|
||||
return w;
|
||||
};
|
||||
|
||||
|
|
@ -194,6 +197,7 @@ WalletFactory.prototype.delete = function(walletId, cb) {
|
|||
var s = this.storage;
|
||||
this.log('## DELETING WALLET ID:' + walletId); //TODO
|
||||
s.deleteWallet(walletId);
|
||||
s.setLastOpened(undefined);
|
||||
return cb();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -172,6 +172,13 @@ Storage.prototype.deleteWallet = function(walletId) {
|
|||
}
|
||||
};
|
||||
|
||||
Storage.prototype.setLastOpened = function(walletId) {
|
||||
this.setGlobal('lastOpened', walletId);
|
||||
}
|
||||
|
||||
Storage.prototype.getLastOpened = function() {
|
||||
return this.getGlobal('lastOpened');
|
||||
}
|
||||
|
||||
//obj contains keys to be set
|
||||
Storage.prototype.setFromObj = function(walletId, obj) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue