From a1672e1e952fac4ecb106c055e1e00d8901fa4b9 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Mon, 5 Sep 2016 17:36:11 -0300 Subject: [PATCH] Fix fee level, preferences by wallet, delete, info --- public/views/modals/addressbook.html | 6 ++-- public/views/preferences.html | 27 +++++---------- public/views/preferencesAlias.html | 18 ++++++---- public/views/preferencesBwsUrl.html | 20 +++++------ public/views/preferencesDeleteWallet.html | 14 ++++---- public/views/preferencesEmail.html | 18 ++++++---- public/views/preferencesFee.html | 22 ++++++------ public/views/preferencesHistory.html | 4 +-- public/views/preferencesInformation.html | 42 +++++++++++------------ public/views/tab-settings.html | 2 +- src/js/controllers/preferences.js | 5 +-- src/js/controllers/preferencesAlias.js | 3 +- src/js/controllers/preferencesDelete.js | 27 ++++----------- src/js/controllers/preferencesFee.js | 10 +++--- src/js/controllers/preferencesHistory.js | 9 +++-- src/js/services/onGoingProcess.js | 1 + src/js/services/profileService.js | 6 ++-- 17 files changed, 106 insertions(+), 128 deletions(-) diff --git a/public/views/modals/addressbook.html b/public/views/modals/addressbook.html index 77b43b5ef..e6a434a8c 100644 --- a/public/views/modals/addressbook.html +++ b/public/views/modals/addressbook.html @@ -1,13 +1,13 @@ -
Addressbook Add entry
- -
Changing wallet alias only affects the local wallet name.
+
Changing wallet alias only affects the local wallet name.
diff --git a/public/views/preferencesBwsUrl.html b/public/views/preferencesBwsUrl.html index 71542f87f..4cb483b88 100644 --- a/public/views/preferencesBwsUrl.html +++ b/public/views/preferencesBwsUrl.html @@ -6,17 +6,15 @@ -
-
- -
-
- -
+
+
- + diff --git a/public/views/preferencesDeleteWallet.html b/public/views/preferencesDeleteWallet.html index c68b8e984..0cc6f099b 100644 --- a/public/views/preferencesDeleteWallet.html +++ b/public/views/preferencesDeleteWallet.html @@ -4,12 +4,14 @@ - -
Warning!
-
Permanently delete this wallet. THIS ACTION CANNOT BE REVERSED
-
- {{alias}}{{walletName}} + +
+

Warning!

+
Permanently delete this wallet. THIS ACTION CANNOT BE REVERSED
+
+ {{alias}}{{walletName}} +
- +
diff --git a/public/views/preferencesEmail.html b/public/views/preferencesEmail.html index 2ac020111..d7a81e90e 100644 --- a/public/views/preferencesEmail.html +++ b/public/views/preferencesEmail.html @@ -6,13 +6,19 @@
- - +
+ +
+
-
Setting up email notifications could weaken your privacy, if the wallet service provider is compromised. Information available to an attacker would include your wallet addresses and its balance, but no more. +
Setting up email notifications could weaken your privacy, if the wallet service provider is compromised. Information available to an attacker would include your wallet addresses and its balance, but no more.
diff --git a/public/views/preferencesFee.html b/public/views/preferencesFee.html index 89c2d417e..fb178fbf8 100644 --- a/public/views/preferencesFee.html +++ b/public/views/preferencesFee.html @@ -6,19 +6,17 @@ -
- Loading... -
- {{feeOpts[fee.level]|translate}} + + {{feeOpts[fee.level]|translate}} -
-
- Average confirmation time: {{fee.nbBlocks * 10}} minutes. -
- Current fee rate for this policy: {{fee.feePerKBUnit}}/kiB -
-
- Bitcoin transactions may include a fee collected by miners on the network. The higher the fee, the greater the incentive a miner has to include that transaction in a block. Current fees are determined based on network load and the selected policy. +
+
+ Average confirmation time: {{fee.nbBlocks * 10}} minutes.
+ Current fee rate for this policy: {{fee.feePerKBUnit}}/kiB +
+
+ Bitcoin transactions may include a fee collected by miners on the network. The higher the fee, the greater the incentive a miner has to include that transaction in a block. Current fees are determined based on network load and the selected policy. +
diff --git a/public/views/preferencesHistory.html b/public/views/preferencesHistory.html index 001ab547a..e2d2d8d55 100644 --- a/public/views/preferencesHistory.html +++ b/public/views/preferencesHistory.html @@ -6,7 +6,7 @@
-
+
Export to file
@@ -15,7 +15,7 @@ preparing...
-
+
Clear cache
diff --git a/public/views/preferencesInformation.html b/public/views/preferencesInformation.html index e527bdf63..2fe6298ce 100644 --- a/public/views/preferencesInformation.html +++ b/public/views/preferencesInformation.html @@ -6,9 +6,7 @@
-
- Wallet Information -
+
Wallet Name (at creation) @@ -64,23 +62,23 @@
-
+
Copayers
-
- {{copayer.name}} ({{'Me'|translate}}) - {{copayer.name}} - +
+ {{copayer.name}} + + ({{'Me'|translate}}) +
-
+
Extended Public Keys
- Copayer {{$index}}< - + Copayer {{$index}} Copayer {{$index}} {{pk}} @@ -89,27 +87,27 @@
-
+
Last Wallet Addresses
- {{a.address}} - {{a.path}} · {{a.createdOn *1000 | amDateFormat:'MMMM Do YYYY, h:mm a' }} - + {{a.address}} + {{a.path}} · {{a.createdOn *1000 | amDateFormat:'MMMM Do YYYY, h:mm a' }}
-
+
Only Main (not change) addresses are shown. The addresses on this list were not verified locally at this time.
+ Scan addresses for funds + + Send addresses by email + +
-
-
+
+
Balance By Address
diff --git a/public/views/tab-settings.html b/public/views/tab-settings.html index 3f0ec2605..1b8220bb6 100644 --- a/public/views/tab-settings.html +++ b/public/views/tab-settings.html @@ -83,7 +83,7 @@ Use Unconfirmed Funds -
Wallets Settings
+
Wallets Preferences
diff --git a/src/js/controllers/preferences.js b/src/js/controllers/preferences.js index f66aad999..288ef49f4 100644 --- a/src/js/controllers/preferences.js +++ b/src/js/controllers/preferences.js @@ -2,7 +2,7 @@ angular.module('copayApp.controllers').controller('preferencesController', function($scope, $rootScope, $timeout, $log, $stateParams, $ionicHistory, $ionicNavBarDelegate, gettextCatalog, configService, profileService, fingerprintService, walletService) { - $ionicNavBarDelegate.title(gettextCatalog.getString('Preferences')); + $ionicNavBarDelegate.title(gettextCatalog.getString('Wallet Preferences')); var wallet = profileService.getWallet($stateParams.walletId); var walletId = wallet.credentials.walletId; $scope.wallet = wallet; @@ -14,9 +14,6 @@ angular.module('copayApp.controllers').controller('preferencesController', return $ionicHistory.goBack(); var config = configService.getSync(); - config.aliasFor = config.aliasFor || {}; - $scope.alias = config.aliasFor[walletId] || wallet.credentials.walletName; - $scope.color = config.colorFor[walletId] || '#4A90E2'; $scope.encryptEnabled = walletService.isEncrypted(wallet); if (wallet.isPrivKeyExternal) diff --git a/src/js/controllers/preferencesAlias.js b/src/js/controllers/preferencesAlias.js index 41557fa80..d51957301 100644 --- a/src/js/controllers/preferencesAlias.js +++ b/src/js/controllers/preferencesAlias.js @@ -8,9 +8,8 @@ angular.module('copayApp.controllers').controller('preferencesAliasController', var walletId = wallet.credentials.walletId; var config = configService.getSync(); - config.aliasFor = config.aliasFor || {}; $scope.walletName = wallet.credentials.walletName; - $scope.alias = config.aliasFor[walletId] || wallet.walletName; + $scope.alias = (config.aliasFor && config.aliasFor[walletId]) || wallet.walletName; $scope.save = function() { var opts = { diff --git a/src/js/controllers/preferencesDelete.js b/src/js/controllers/preferencesDelete.js index 19cdccb1e..8e95a31c1 100644 --- a/src/js/controllers/preferencesDelete.js +++ b/src/js/controllers/preferencesDelete.js @@ -1,32 +1,17 @@ 'use strict'; angular.module('copayApp.controllers').controller('preferencesDeleteWalletController', - function($scope, $ionicPopup, $stateParams, $ionicNavBarDelegate, $ionicHistory, gettextCatalog, lodash, profileService, $state, ongoingProcess, popupService) { - $ionicNavBarDelegate.title(gettextCatalog.getString('Delete Wallet')); + function($scope, $stateParams, $ionicNavBarDelegate, $ionicHistory, gettextCatalog, lodash, profileService, $state, ongoingProcess, popupService) { + $ionicNavBarDelegate.title(gettextCatalog.getString('Delete')); var wallet = profileService.getWallet($stateParams.walletId); $scope.alias = lodash.isEqual(wallet.name, wallet.credentials.walletName) ? null : wallet.name + ' '; $scope.walletName = '[' + wallet.credentials.walletName + ']'; $scope.showDeletePopup = function() { - var popup = $ionicPopup.show({ - template: '' + gettextCatalog.getString('Are you sure you want to delete this wallet?') + '', - title: gettextCatalog.getString('Confirm'), - buttons: [ - { - text: gettextCatalog.getString('Cancel'), - onTap: function(e) { - popup.close(); - } - }, - { - text: gettextCatalog.getString('Accept'), - type: 'button-positive', - onTap: function(e) { - deleteWallet(); - popup.close(); - } - } - ] + var title = gettextCatalog.getString('Warning!'); + var message = gettextCatalog.getString('Are you sure you want to delete this wallet?'); + popupService.showConfirm(title, message, function(res) { + if (res) deleteWallet(); }); }; diff --git a/src/js/controllers/preferencesFee.js b/src/js/controllers/preferencesFee.js index e254f0411..4fa0c0761 100644 --- a/src/js/controllers/preferencesFee.js +++ b/src/js/controllers/preferencesFee.js @@ -1,12 +1,12 @@ 'use strict'; -angular.module('copayApp.controllers').controller('preferencesFeeController', function($scope, $timeout, $ionicHistory, $ionicNavBarDelegate, gettextCatalog, configService, feeService) { - $ionicNavBarDelegate.title(gettextCatalog.getString('Preferences fee')); +angular.module('copayApp.controllers').controller('preferencesFeeController', function($scope, $timeout, $ionicHistory, $ionicNavBarDelegate, gettextCatalog, configService, feeService, ongoingProcess) { + $ionicNavBarDelegate.title(gettextCatalog.getString('Bitcoin Network Fee Policy')); $scope.init = function() { - $scope.loading = true; + ongoingProcess.set('gettingFeeLevels', true); feeService.getFeeLevels(function(levels) { - $scope.loading = false; + ongoingProcess.set('gettingFeeLevels', false); $scope.feeOpts = feeService.feeOpts; $scope.currentFeeLevel = feeService.getCurrentFeeLevel(); $scope.feeLevels = levels; @@ -29,7 +29,7 @@ angular.module('copayApp.controllers').controller('preferencesFeeController', fu $ionicHistory.goBack(); $timeout(function() { $scope.$apply(); - }, 10); + }, 100); }); }; }); diff --git a/src/js/controllers/preferencesHistory.js b/src/js/controllers/preferencesHistory.js index b0c6d45e9..a44f69b36 100644 --- a/src/js/controllers/preferencesHistory.js +++ b/src/js/controllers/preferencesHistory.js @@ -3,15 +3,14 @@ angular.module('copayApp.controllers').controller('preferencesHistory', function($scope, $log, $stateParams, $timeout, $ionicNavBarDelegate, gettextCatalog, storageService, $state, $ionicHistory, profileService, lodash) { $ionicNavBarDelegate.title(gettextCatalog.getString('Transaction History')); - var wallet = profileService.getWallet($stateParams.walletId); - var c = wallet.credentials; + $scope.wallet = profileService.getWallet($stateParams.walletId); $scope.csvReady = false; $scope.csvHistory = function(cb) { var allTxs = []; function getHistory(cb) { - storageService.getTxHistory(c.walletId, function(err, txs) { + storageService.getTxHistory($scope.wallet.id, function(err, txs) { if (err) return cb(err); var txsFromLocal = []; @@ -40,7 +39,7 @@ angular.module('copayApp.controllers').controller('preferencesHistory', var data = txs; var satToBtc = 1 / 100000000; $scope.csvContent = []; - $scope.csvFilename = 'Copay-' + ($scope.alias || $scope.walletName) + '.csv'; + $scope.csvFilename = 'Copay-' + $scope.wallet.name + '.csv'; $scope.csvHeader = ['Date', 'Destination', 'Description', 'Amount', 'Currency', 'Txid', 'Creator', 'Copayers', 'Comment']; var _amount, _note, _copayers, _creator, _comment; @@ -118,7 +117,7 @@ angular.module('copayApp.controllers').controller('preferencesHistory', }; $scope.clearTransactionHistory = function() { - storageService.removeTxHistory(c.walletId, function(err) { + storageService.removeTxHistory($scope.wallet.id, function(err) { if (err) { $log.error(err); return; diff --git a/src/js/services/onGoingProcess.js b/src/js/services/onGoingProcess.js index 2c433a4af..8f6b3c014 100644 --- a/src/js/services/onGoingProcess.js +++ b/src/js/services/onGoingProcess.js @@ -31,6 +31,7 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti 'sweepingWallet': gettext('Sweeping Wallet...'), 'deletingWallet': gettext('Deleting Wallet...'), 'extractingWalletInfo': gettext('Extracting Wallet Information...'), + 'gettingFeeLevels': gettext('Getting fee levels...'), }; root.clear = function() { diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index 9a3ae09fa..4bd0612b0 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -31,9 +31,9 @@ angular.module('copayApp.services') root.updateWalletSettings = function(wallet) { var defaults = configService.getDefaults(); configService.whenAvailable(function(config){ - wallet.usingCustomBWS = config.bwsFor[wallet.id] && (config.bwsFor[wallet.id] != defaults.bws.url); - wallet.name = config.aliasFor[wallet.id] || wallet.credentials.walletName; - wallet.color = config.colorFor[wallet.id] || '#4A90E2'; + wallet.usingCustomBWS = config.bwsFor && config.bwsFor[wallet.id] && (config.bwsFor[wallet.id] != defaults.bws.url); + wallet.name = (config.aliasFor && config.aliasFor[wallet.id]) || wallet.credentials.walletName; + wallet.color = (config.colorFor && config.colorFor[wallet.id]) || '#4A90E2'; wallet.email = config.emailFor && config.emailFor[wallet.id]; }); }