From bbb3acdca1cfd6fb7edce01700c32be6e15818e5 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Wed, 18 Jan 2017 12:09:17 -0300 Subject: [PATCH 1/3] fix delete tx history --- src/js/controllers/preferencesHistory.js | 11 +++++++++-- src/js/services/walletService.js | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/js/controllers/preferencesHistory.js b/src/js/controllers/preferencesHistory.js index 32f4375cc..68c6f8daa 100644 --- a/src/js/controllers/preferencesHistory.js +++ b/src/js/controllers/preferencesHistory.js @@ -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() { diff --git a/src/js/services/walletService.js b/src/js/services/walletService.js index 236b19ee1..44209b3d3 100644 --- a/src/js/services/walletService.js +++ b/src/js/services/walletService.js @@ -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 || {}; From 7c4434adc665cac5883706a00e808a9548933ae8 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Wed, 18 Jan 2017 13:15:46 -0300 Subject: [PATCH 2/3] add wallet indicator in preferences --- src/js/controllers/export.js | 1 + .../preferencesAdvancedController.js | 3 ++ src/js/controllers/preferencesBwsUrl.js | 2 ++ src/js/controllers/preferencesDelete.js | 2 ++ src/js/controllers/preferencesInformation.js | 2 ++ src/sass/icons.scss | 34 +++++++++++++++++++ www/views/export.html | 3 ++ www/views/includes/walletItem.html | 15 ++++++++ www/views/preferences.html | 4 ++- www/views/preferencesAdvanced.html | 5 +-- www/views/preferencesBwsUrl.html | 4 +++ www/views/preferencesDeleteWallet.html | 2 ++ www/views/preferencesHistory.html | 3 +- www/views/preferencesInformation.html | 2 +- 14 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 www/views/includes/walletItem.html diff --git a/src/js/controllers/export.js b/src/js/controllers/export.js index 2203d2df7..8437663a8 100644 --- a/src/js/controllers/export.js +++ b/src/js/controllers/export.js @@ -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; diff --git a/src/js/controllers/preferencesAdvancedController.js b/src/js/controllers/preferencesAdvancedController.js index 0af8cf258..26c45a26d 100644 --- a/src/js/controllers/preferencesAdvancedController.js +++ b/src/js/controllers/preferencesAdvancedController.js @@ -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(); diff --git a/src/js/controllers/preferencesBwsUrl.js b/src/js/controllers/preferencesBwsUrl.js index 45752ee01..010d8ae70 100644 --- a/src/js/controllers/preferencesBwsUrl.js +++ b/src/js/controllers/preferencesBwsUrl.js @@ -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(); diff --git a/src/js/controllers/preferencesDelete.js b/src/js/controllers/preferencesDelete.js index 9c30fda2e..7c869e29c 100644 --- a/src/js/controllers/preferencesDelete.js +++ b/src/js/controllers/preferencesDelete.js @@ -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; diff --git a/src/js/controllers/preferencesInformation.js b/src/js/controllers/preferencesInformation.js index 983b9cef8..70ba5484e 100644 --- a/src/js/controllers/preferencesInformation.js +++ b/src/js/controllers/preferencesInformation.js @@ -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; diff --git a/src/sass/icons.scss b/src/sass/icons.scss index 0e7c431a5..2f21a1a90 100644 --- a/src/sass/icons.scss +++ b/src/sass/icons.scss @@ -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: ''; + } +} diff --git a/www/views/export.html b/www/views/export.html index f1fa5235a..bec03a17a 100644 --- a/www/views/export.html +++ b/www/views/export.html @@ -6,6 +6,9 @@ + +
+
File/Text diff --git a/www/views/includes/walletItem.html b/www/views/includes/walletItem.html new file mode 100644 index 000000000..a1fcd8177 --- /dev/null +++ b/www/views/includes/walletItem.html @@ -0,0 +1,15 @@ +
+ + + +
+ {{wallet.name || wallet.id}} + + {{wallet.m}}-of-{{wallet.n}} + + + {{'Incomplete' | translate}} + +
+
+ diff --git a/www/views/preferences.html b/www/views/preferences.html index b16b93b4d..81c72a92c 100644 --- a/www/views/preferences.html +++ b/www/views/preferences.html @@ -8,7 +8,9 @@
-
+ +
+ Name diff --git a/www/views/preferencesAdvanced.html b/www/views/preferencesAdvanced.html index 3cba1623d..a9f58bdcb 100644 --- a/www/views/preferencesAdvanced.html +++ b/www/views/preferencesAdvanced.html @@ -6,8 +6,9 @@
-
-
+ +
+
Wallet Information diff --git a/www/views/preferencesBwsUrl.html b/www/views/preferencesBwsUrl.html index bb9928073..825a83c38 100644 --- a/www/views/preferencesBwsUrl.html +++ b/www/views/preferencesBwsUrl.html @@ -6,7 +6,11 @@ +
+
+ +

Warning!

diff --git a/www/views/preferencesHistory.html b/www/views/preferencesHistory.html index 272ab99ac..24047a555 100644 --- a/www/views/preferencesHistory.html +++ b/www/views/preferencesHistory.html @@ -5,7 +5,8 @@ -
+
+
Export to file diff --git a/www/views/preferencesInformation.html b/www/views/preferencesInformation.html index 5795790a2..9caa2ea07 100644 --- a/www/views/preferencesInformation.html +++ b/www/views/preferencesInformation.html @@ -6,7 +6,7 @@
-
+
Wallet Name (at creation) From d4183d97d7e6ea242c44f4d6f90476b68d0b7401 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Wed, 18 Jan 2017 14:25:39 -0300 Subject: [PATCH 3/3] add err --- src/js/services/walletService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/services/walletService.js b/src/js/services/walletService.js index 44209b3d3..746631a8d 100644 --- a/src/js/services/walletService.js +++ b/src/js/services/walletService.js @@ -558,7 +558,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim storageService.removeTxHistory(wallet.id, function(err) { if (err) { $log.error(err); - return cb(); + return cb(err); } return cb(); });