switch between wallets in profile working

This commit is contained in:
Matias Alejo Garcia 2014-10-05 15:59:41 -03:00
commit ac491d10b0
19 changed files with 293 additions and 179 deletions

View file

@ -12,7 +12,7 @@ function Profile(info, storage) {
this.hash = info.hash;
this.email = info.email;
this.extra = info.extra;
this.extra = info.extra || {};
this.walletInfos = info.walletInfos || {};
this.key = Profile.key(this.hash);
@ -69,7 +69,7 @@ Profile.prototype.getWallet = function(walletId, cb) {
Profile.prototype.listWallets = function(opts, cb) {
return _.sortBy(this.walletInfos, function(winfo) {
return winfo.lastOpenedTs || winfo.createdTs;
return -winfo.lastOpenedTs || -winfo.createdTs;
});
};
@ -141,4 +141,9 @@ Profile.prototype.store = function(opts, cb) {
});
};
Profile.prototype.getName = function() {
return this.extra.nickname || this.email;
};
module.exports = Profile;