mirror of https://github.com/BTCPrivate/copay.git
add store Profile on adding wallets
This commit is contained in:
parent
ae4dd9a54b
commit
08dc892887
|
@ -13,12 +13,9 @@ angular.module('copayApp.controllers').controller('HeadController', function($sc
|
|||
};
|
||||
|
||||
$scope.signout = function() {
|
||||
logout();
|
||||
controllerUtils.logout();
|
||||
};
|
||||
|
||||
function logout() {
|
||||
controllerUtils.logout();
|
||||
}
|
||||
|
||||
// Ensures a graceful disconnect
|
||||
window.onbeforeunload = function() {
|
||||
|
@ -48,7 +45,7 @@ angular.module('copayApp.controllers').controller('HeadController', function($sc
|
|||
$scope.title = newTitle;
|
||||
});
|
||||
$rootScope.$on('signout', function() {
|
||||
$scope.signout();
|
||||
controllerUtils.logout();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -228,6 +228,8 @@ Identity.prototype.exportWithWalletInfo = function(opts) {
|
|||
* @param {Function} cb
|
||||
*/
|
||||
Identity.prototype.store = function(opts, cb) {
|
||||
log.debug('Storing profile');
|
||||
|
||||
var self = this;
|
||||
opts = opts || {};
|
||||
|
||||
|
@ -348,14 +350,10 @@ Identity.importFromFullJson = function(str, password, opts, cb) {
|
|||
callback();
|
||||
});
|
||||
}, function(err, results) {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
if (err) return cb(err);
|
||||
|
||||
iden.store(null, function(err) {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
return cb(null, iden);
|
||||
return cb(err, iden);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
@ -384,7 +382,9 @@ Identity.prototype.bindWallet = function(w) {
|
|||
});
|
||||
w.on('ready', function() {
|
||||
log.debug('<ready> Wallet' + w.getName());
|
||||
self.storeWallet(w);
|
||||
self.store({noWallets:true}, function() {
|
||||
self.storeWallet(w);
|
||||
});
|
||||
});
|
||||
w.on('addressBookUpdated', function() {
|
||||
log.debug('<addressBookUpdated> Wallet' + w.getName());
|
||||
|
|
|
@ -30,8 +30,12 @@ angular.module('copayApp.services')
|
|||
};
|
||||
|
||||
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['iden'];
|
||||
|
|
Loading…
Reference in New Issue