add store Profile on adding wallets
This commit is contained in:
parent
ae4dd9a54b
commit
08dc892887
3 changed files with 16 additions and 15 deletions
|
|
@ -13,12 +13,9 @@ angular.module('copayApp.controllers').controller('HeadController', function($sc
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.signout = function() {
|
$scope.signout = function() {
|
||||||
logout();
|
controllerUtils.logout();
|
||||||
};
|
};
|
||||||
|
|
||||||
function logout() {
|
|
||||||
controllerUtils.logout();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensures a graceful disconnect
|
// Ensures a graceful disconnect
|
||||||
window.onbeforeunload = function() {
|
window.onbeforeunload = function() {
|
||||||
|
|
@ -48,7 +45,7 @@ angular.module('copayApp.controllers').controller('HeadController', function($sc
|
||||||
$scope.title = newTitle;
|
$scope.title = newTitle;
|
||||||
});
|
});
|
||||||
$rootScope.$on('signout', function() {
|
$rootScope.$on('signout', function() {
|
||||||
$scope.signout();
|
controllerUtils.logout();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -228,6 +228,8 @@ Identity.prototype.exportWithWalletInfo = function(opts) {
|
||||||
* @param {Function} cb
|
* @param {Function} cb
|
||||||
*/
|
*/
|
||||||
Identity.prototype.store = function(opts, cb) {
|
Identity.prototype.store = function(opts, cb) {
|
||||||
|
log.debug('Storing profile');
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
|
|
||||||
|
|
@ -348,14 +350,10 @@ Identity.importFromFullJson = function(str, password, opts, cb) {
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
}, function(err, results) {
|
}, function(err, results) {
|
||||||
if (err) {
|
if (err) return cb(err);
|
||||||
return cb(err);
|
|
||||||
}
|
|
||||||
iden.store(null, function(err) {
|
iden.store(null, function(err) {
|
||||||
if (err) {
|
return cb(err, iden);
|
||||||
return cb(err);
|
|
||||||
}
|
|
||||||
return cb(null, iden);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -384,7 +382,9 @@ Identity.prototype.bindWallet = function(w) {
|
||||||
});
|
});
|
||||||
w.on('ready', function() {
|
w.on('ready', function() {
|
||||||
log.debug('<ready> Wallet' + w.getName());
|
log.debug('<ready> Wallet' + w.getName());
|
||||||
self.storeWallet(w);
|
self.store({noWallets:true}, function() {
|
||||||
|
self.storeWallet(w);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
w.on('addressBookUpdated', function() {
|
w.on('addressBookUpdated', function() {
|
||||||
log.debug('<addressBookUpdated> Wallet' + w.getName());
|
log.debug('<addressBookUpdated> Wallet' + w.getName());
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,12 @@ angular.module('copayApp.services')
|
||||||
};
|
};
|
||||||
|
|
||||||
root.logout = function() {
|
root.logout = function() {
|
||||||
if ($rootScope.iden)
|
|
||||||
$rootScope.iden.close();
|
if ($rootScope.iden) {
|
||||||
|
$rootScope.iden.store(null, function(){
|
||||||
|
$rootScope.iden.close();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
delete $rootScope['wallet'];
|
delete $rootScope['wallet'];
|
||||||
delete $rootScope['iden'];
|
delete $rootScope['iden'];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue