Merge pull request #4263 from JDonadio/fix/deleting-wallet
Fix deleting wallet
This commit is contained in:
commit
5b3ef6e0cb
1 changed files with 27 additions and 27 deletions
|
|
@ -77,7 +77,7 @@ angular.module('copayApp.services')
|
||||||
root.walletClients[credentials.walletId] = client;
|
root.walletClients[credentials.walletId] = client;
|
||||||
|
|
||||||
if (client.incorrectDerivation) {
|
if (client.incorrectDerivation) {
|
||||||
storageService.clearLastAddress(credentials.walletId,function() {});
|
storageService.clearLastAddress(credentials.walletId, function() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
client.removeAllListeners();
|
client.removeAllListeners();
|
||||||
|
|
@ -148,7 +148,7 @@ angular.module('copayApp.services')
|
||||||
root.isDisclaimerAccepted(function(val) {
|
root.isDisclaimerAccepted(function(val) {
|
||||||
if (!val) {
|
if (!val) {
|
||||||
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
|
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
|
||||||
}
|
}
|
||||||
return cb();
|
return cb();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -324,8 +324,8 @@ angular.module('copayApp.services')
|
||||||
|
|
||||||
// check if exist
|
// check if exist
|
||||||
if (lodash.find(root.profile.credentials, {
|
if (lodash.find(root.profile.credentials, {
|
||||||
'walletId': walletData.walletId
|
'walletId': walletData.walletId
|
||||||
})) {
|
})) {
|
||||||
return cb(gettext('Cannot join the same wallet more that once'));
|
return cb(gettext('Cannot join the same wallet more that once'));
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
|
@ -356,36 +356,36 @@ angular.module('copayApp.services')
|
||||||
pushNotificationsService.unsubscribe(root.getClient(walletId), function(err) {
|
pushNotificationsService.unsubscribe(root.getClient(walletId), function(err) {
|
||||||
if (err) $log.warn('Unsubscription error: ' + err.message);
|
if (err) $log.warn('Unsubscription error: ' + err.message);
|
||||||
else $log.debug('Unsubscribed from push notifications service');
|
else $log.debug('Unsubscribed from push notifications service');
|
||||||
|
});
|
||||||
|
|
||||||
$log.debug('Deleting Wallet:', fc.credentials.walletName);
|
$log.debug('Deleting Wallet:', fc.credentials.walletName);
|
||||||
|
|
||||||
fc.removeAllListeners();
|
fc.removeAllListeners();
|
||||||
root.profile.credentials = lodash.reject(root.profile.credentials, {
|
root.profile.credentials = lodash.reject(root.profile.credentials, {
|
||||||
walletId: walletId
|
walletId: walletId
|
||||||
});
|
});
|
||||||
|
|
||||||
delete root.walletClients[walletId];
|
delete root.walletClients[walletId];
|
||||||
root.focusedClient = null;
|
root.focusedClient = null;
|
||||||
|
|
||||||
storageService.clearLastAddress(walletId, function(err) {
|
storageService.clearLastAddress(walletId, function(err) {
|
||||||
if (err) $log.warn(err);
|
if (err) $log.warn(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
storageService.removeTxHistory(walletId, function(err) {
|
storageService.removeTxHistory(walletId, function(err) {
|
||||||
if (err) $log.warn(err);
|
if (err) $log.warn(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
storageService.clearBackupFlag(walletId, function(err) {
|
storageService.clearBackupFlag(walletId, function(err) {
|
||||||
if (err) $log.warn(err);
|
if (err) $log.warn(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
root.setWalletClients();
|
root.setWalletClients();
|
||||||
root.setAndStoreFocus(null, function() {
|
root.setAndStoreFocus(null, function() {
|
||||||
storageService.storeProfile(root.profile, function(err) {
|
storageService.storeProfile(root.profile, function(err) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
return cb();
|
return cb();
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue