Merge pull request #5479 from matiu/bug/delete-tx-history

fix delete tx history
This commit is contained in:
Gustavo Maximiliano Cortez 2017-01-18 14:38:01 -03:00 committed by GitHub
commit 5a945a8c8b
16 changed files with 101 additions and 7 deletions

View file

@ -3,6 +3,7 @@
angular.module('copayApp.controllers').controller('exportController',
function($scope, $timeout, $log, $ionicHistory, $ionicScrollDelegate, backupService, walletService, storageService, profileService, platformInfo, gettextCatalog, $state, $stateParams, popupService, appConfigService) {
var wallet = profileService.getWallet($stateParams.walletId);
$scope.wallet = wallet;
$scope.showAdvChange = function() {
$scope.showAdv = !$scope.showAdv;

View file

@ -3,6 +3,9 @@
angular.module('copayApp.controllers').controller('preferencesAdvancedController', function($scope, $timeout, $stateParams, profileService) {
var wallet = profileService.getWallet($stateParams.walletId);
$scope.network = wallet.network;
$scope.wallet = wallet;
$timeout(function() {
$scope.$apply();

View file

@ -5,6 +5,8 @@ angular.module('copayApp.controllers').controller('preferencesBwsUrlController',
$scope.success = null;
var wallet = profileService.getWallet($stateParams.walletId);
$scope.wallet = wallet;
var walletId = wallet.credentials.walletId;
var defaults = configService.getDefaults();
var config = configService.getSync();

View file

@ -3,6 +3,8 @@
angular.module('copayApp.controllers').controller('preferencesDeleteWalletController',
function($scope, $stateParams, $ionicHistory, gettextCatalog, lodash, profileService, $state, ongoingProcess, popupService) {
var wallet = profileService.getWallet($stateParams.walletId);
$scope.wallet = wallet;
$scope.alias = lodash.isEqual(wallet.name, wallet.credentials.walletName) ? null : wallet.name + ' ';
$scope.walletName = wallet.credentials.walletName;

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

@ -3,6 +3,8 @@
angular.module('copayApp.controllers').controller('preferencesInformation',
function($scope, $log, $ionicHistory, platformInfo, lodash, profileService, configService, $stateParams, $state) {
var wallet = profileService.getWallet($stateParams.walletId);
$scope.wallet = wallet;
var walletId = wallet.id;
var config = configService.getSync();
var colorCounter = 1;

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(err);
}
return cb();
});
};
root.getTxHistory = function(wallet, opts, cb) {
opts = opts || {};

View file

@ -49,3 +49,37 @@
}
}
}
.wallet-item {
margin: 1rem 0 2rem 0;
.name {
color: #445;
text-align:center;
}
.big-icon-svg {
&.circle{
left:8px;
.bg {
border-radius: 50%;
width: 70px;
height: 70px;
padding:.1rem;
margin: 0.2rem;
box-shadow: 0px 1px 5px rgba($mid-gray, .1);
display:flex;
margin:auto;
}
}
}
&:before {
display: block;
position: absolute;
width: 100%;
height: 1px;
background: rgba(221, 221, 221, 0.3);
top: 0;
right: 0;
content: '';
}
}