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: '';
}
}

View File

@ -6,6 +6,9 @@
</ion-nav-bar>
<ion-content>
<div class="wallet-item" ng-include="'views/includes/walletItem.html'"></div>
<div class="row text-center top-tabs">
<div class="col" ng-click="file.value = true" ng-style="file.value && {'border-bottom-style': 'solid'}">
<span class="" translate>File/Text</span>

View File

@ -0,0 +1,15 @@
<div class="wallet-item">
<i class="icon big-icon-svg circle">
<img src="img/icon-wallet.svg" ng-style="{'background-color': wallet.color}" class="bg"/>
</i>
<div class="name">
{{wallet.name || wallet.id}}
<span class="size-12 text-light" ng-show="wallet.n > 1">
{{wallet.m}}-of-{{wallet.n}}
</span>
<span class=" size-12 text-light assertive" ng-show="!wallet.isComplete()">
{{'Incomplete' | translate}}
</span>
</div>
</div>

View File

@ -8,7 +8,9 @@
</ion-nav-bar>
<ion-content>
<div class="list settings-list">
<div class="item item-divider"></div>
<div class="wallet-item" ng-include="'views/includes/walletItem.html'"></div>
<a class="item item-icon-right" ui-sref="tabs.preferences.preferencesAlias">
<span translate>Name</span>
<span class="item-note">

View File

@ -6,8 +6,9 @@
</ion-nav-bar>
<ion-content>
<div class="list">
<div class="item item-divider">
</div>
<div class="wallet-item" ng-include="'views/includes/walletItem.html'"></div>
<a class="item item-icon-right" ui-sref="tabs.preferences.information">
<span translate>Wallet Information</span>
<i class="icon bp-arrow-right"></i>

View File

@ -6,7 +6,11 @@
</ion-nav-bar>
<ion-content>
<div class="wallet-item" ng-include="'views/includes/walletItem.html'"></div>
<div class="list settings-list settings-input-group">
<label class="item item-input item-stacked-label">
<span class="input-label">Wallet Service URL</span>
<input type="text" id="bwsurl" type="text" name="bwsurl" ng-model="bwsurl.value">

View File

@ -5,6 +5,8 @@
</ion-nav-back-button>
</ion-nav-bar>
<ion-content>
<div class="wallet-item" ng-include="'views/includes/walletItem.html'"></div>
<div class="padding">
<h1 class="text-center assertive" translate>Warning!</h1>
<div class="padding text-center">

View File

@ -5,7 +5,8 @@
</ion-nav-back-button>
</ion-nav-bar>
<ion-content>
<div class="item item-divider" ng-show="!isCordova"></div>
<div class="wallet-item" ng-include="'views/includes/walletItem.html'"></div>
<a class="item ng-hide" href ng-show="csvReady && !isCordova" ng-csv="csvContent" csv-header="csvHeader" filename="{{appName}}-{{wallet.name}}.csv">
<span translate>Export to file</span>
</a>

View File

@ -6,7 +6,7 @@
</ion-nav-bar>
<ion-content>
<div class="list">
<div class="item item-divider"></div>
<div class="wallet-item" ng-include="'views/includes/walletItem.html'"></div>
<div class="item" ng-click="saveBlack()">
<span translate>Wallet Name (at creation)</span>
<span class="item-note">