Clean last address and scann all addresses
This commit is contained in:
parent
8c540894d5
commit
8ef15e5eae
3 changed files with 31 additions and 4 deletions
|
|
@ -481,7 +481,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
self.clientError = function(err) {
|
self.clientError = function(err) {
|
||||||
if (isCordova) {
|
if (isCordova) {
|
||||||
navigator.notification.confirm(
|
navigator.notification.confirm(
|
||||||
|
|
@ -549,9 +548,8 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
c.startScan({
|
c.startScan({
|
||||||
includeCopayerBranches: true,
|
includeCopayerBranches: true,
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
if (err) {
|
if (err && self.walletId == walletId) {
|
||||||
if (self.walletId == walletId)
|
self.setOngoingProcess('scanning', false);
|
||||||
self.setOngoingProcess('scanning', false);
|
|
||||||
self.handleError(err);
|
self.handleError(err);
|
||||||
$rootScope.$apply();
|
$rootScope.$apply();
|
||||||
}
|
}
|
||||||
|
|
@ -624,6 +622,22 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
|
|
||||||
$rootScope.$on('Local/BWSUpdated', function(event) {
|
$rootScope.$on('Local/BWSUpdated', function(event) {
|
||||||
profileService.applyConfig();
|
profileService.applyConfig();
|
||||||
|
storageService.setCleanAndScanAddresses(function() {});
|
||||||
|
});
|
||||||
|
|
||||||
|
$rootScope.$on('Local/CleanAndScanAddresses', function(event) {
|
||||||
|
storageService.getCleanAndScanAddresses(function(err, val) {
|
||||||
|
if (val) {
|
||||||
|
$log.debug('Clear last address cache and Scan');
|
||||||
|
var wallets = profileService.walletClients;
|
||||||
|
for (var walletId in wallets) {
|
||||||
|
storageService.clearLastAddress(walletId, function(err) {
|
||||||
|
self.startScan(walletId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
storageService.removeCleanAndScanAddresses(function() {});
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$rootScope.$on('Local/WalletCompleted', function(event) {
|
$rootScope.$on('Local/WalletCompleted', function(event) {
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,7 @@ angular.module('copayApp.services')
|
||||||
storageService.getFocusedWalletId(function(err, focusedWalletId) {
|
storageService.getFocusedWalletId(function(err, focusedWalletId) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
root._setFocus(focusedWalletId, cb);
|
root._setFocus(focusedWalletId, cb);
|
||||||
|
$rootScope.$emit('Local/CleanAndScanAddresses');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,18 @@ angular.module('copayApp.services')
|
||||||
storage.get('backup-' + walletId, cb);
|
storage.get('backup-' + walletId, cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
root.setCleanAndScanAddresses = function(cb) {
|
||||||
|
storage.set('CleanAndScanAddresses', Date.now(), cb);
|
||||||
|
};
|
||||||
|
|
||||||
|
root.getCleanAndScanAddresses = function(cb) {
|
||||||
|
storage.get('CleanAndScanAddresses', cb);
|
||||||
|
};
|
||||||
|
|
||||||
|
root.removeCleanAndScanAddresses = function(cb) {
|
||||||
|
storage.remove('CleanAndScanAddresses', cb);
|
||||||
|
};
|
||||||
|
|
||||||
root.getConfig = function(cb) {
|
root.getConfig = function(cb) {
|
||||||
storage.get('config', cb);
|
storage.get('config', cb);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue