From aeb7766b936c8baf533f3cc538fcad3d3f1be7e9 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Thu, 12 Nov 2015 17:08:24 -0300 Subject: [PATCH] rm TX history after scan --- src/js/controllers/index.js | 15 +++++++++++---- src/js/controllers/preferencesInformation.js | 1 - 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index a4bc2e2a2..a88fc149f 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -796,7 +796,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.getTxsFromServer(client, skip, endingTxid, requestLimit, function(err, res, shouldContinue) { if (err) return i_cb(err); - newTxs = newTxs.concat(lodash.compact(res)); skip = skip + requestLimit; @@ -820,7 +819,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r getNewTxs([], 0, function(err, txs) { if (err) return cb(err); - var newHistory = lodash.compact(txs.concat(txsFromLocal)); $log.debug('Tx History synced. Total Txs: ' + newHistory.length); @@ -1071,7 +1069,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r $rootScope.$on('Local/ClearHistory', function(event) { $log.debug('The wallet transaction history has been deleted'); - self.txHistory = []; + self.txHistory = self.completeHistory = []; self.updateHistory(); }); @@ -1200,7 +1198,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r $log.debug('Backup done stored'); addressService.expireAddress(walletId, function(err) { $timeout(function() { - self.startScan(walletId); + self.txHistory = self.completeHistory = []; + storageService.removeTxHistory(walletId, function() { + self.startScan(walletId); + }); }, 500); }); }); @@ -1258,6 +1259,12 @@ angular.module('copayApp.controllers').controller('indexController', function($r }); }); + $rootScope.$on('ScanFinished', function() { + console.log('Scan Finished. Updating history'); + storageService.removeTxHistory(self.walletId, function() { + self.updateHistory(); + }); + }); lodash.each(['TxProposalRejectedBy', 'TxProposalAcceptedBy'], function(eventName) { $rootScope.$on(eventName, function() { diff --git a/src/js/controllers/preferencesInformation.js b/src/js/controllers/preferencesInformation.js index 6ecbcfcab..b0ea5a395 100644 --- a/src/js/controllers/preferencesInformation.js +++ b/src/js/controllers/preferencesInformation.js @@ -100,7 +100,6 @@ angular.module('copayApp.controllers').controller('preferencesInformation', $log.error(err); return; } - $scope.$emit('Local/ClearHistory'); $timeout(function() {