fix delete tx history

This commit is contained in:
Matias Alejo Garcia 2017-01-18 12:09:17 -03:00
parent bca128a7ff
commit bbb3acdca1
No known key found for this signature in database
GPG Key ID: 02470DB551277AB3
2 changed files with 24 additions and 2 deletions

View File

@ -1,12 +1,14 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesHistory',
function($scope, $log, $stateParams, $timeout, $state, $ionicHistory, storageService, platformInfo, profileService, lodash, appConfigService) {
function($scope, $log, $stateParams, $timeout, $state, $ionicHistory, storageService, platformInfo, profileService, lodash, appConfigService, walletService) {
$scope.wallet = profileService.getWallet($stateParams.walletId);
$scope.csvReady = false;
$scope.isCordova = platformInfo.isCordova;
$scope.appName = appConfigService.nameCase;
// TODO : move this to walletService.
$scope.csvHistory = function(cb) {
var allTxs = [];
@ -123,12 +125,17 @@ angular.module('copayApp.controllers').controller('preferencesHistory',
};
$scope.clearTransactionHistory = function() {
storageService.removeTxHistory($scope.wallet.id, function(err) {
$log.info('Removing Transaction history ' + $scope.wallet.id);
walletService.clearTxHistory($scope.wallet, function(err) {
if (err) {
$log.error(err);
return;
}
$log.info('Transaction history cleared for :' + $scope.wallet.id);
$ionicHistory.removeBackView();
$state.go('tabs.home');
$timeout(function() {

View File

@ -551,6 +551,21 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
};
};
root.clearTxHistory = function(wallet, cb) {
root.invalidateCache(wallet);
storageService.removeTxHistory(wallet.id, function(err) {
if (err) {
$log.error(err);
return cb();
}
return cb();
});
};
root.getTxHistory = function(wallet, opts, cb) {
opts = opts || {};