From a9c7be18895e77bdb44b1b930ebcc99f4e3b3ecc Mon Sep 17 00:00:00 2001 From: JDonadio Date: Mon, 19 Jun 2017 11:29:44 -0300 Subject: [PATCH 1/3] display fee values - txp details --- src/js/controllers/modals/txpDetails.js | 10 ++++++++++ src/sass/views/includes/txp-details.scss | 9 +++++++-- www/views/modals/txp-details.html | 9 +++++---- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/js/controllers/modals/txpDetails.js b/src/js/controllers/modals/txpDetails.js index 01ab9277b..b59c11897 100644 --- a/src/js/controllers/modals/txpDetails.js +++ b/src/js/controllers/modals/txpDetails.js @@ -16,11 +16,21 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi $scope.data = {}; $scope.displayAmount = getDisplayAmount($scope.tx.amountStr); $scope.displayUnit = getDisplayUnit($scope.tx.amountStr); + displayFeeValues(); initActionList(); checkPaypro(); applyButtonText(); }; + function displayFeeValues() { + txFormatService.formatAlternativeStr($scope.tx.fee, function(v) { + $scope.tx.feeFiatStr = v; + }); + $scope.tx.feeRateStr = ($scope.tx.fee / ($scope.tx.amount + $scope.tx.fee) * 100).toFixed(2) + '%'; + if ($scope.tx.feeLevel == 'superEconomy') $scope.tx.feeLevelStr = gettextCatalog.getString('Super Economy'); + else $scope.tx.feeLevelStr = $scope.tx.feeLevelStr = $scope.tx.feeLevel.charAt(0).toUpperCase() + $scope.tx.feeLevel.slice(1); + }; + function applyButtonText() { $scope.buttonText = $scope.isCordova ? gettextCatalog.getString('Slide') + ' ' : gettextCatalog.getString('Click') + ' '; diff --git a/src/sass/views/includes/txp-details.scss b/src/sass/views/includes/txp-details.scss index d08087180..c68841a4c 100644 --- a/src/sass/views/includes/txp-details.scss +++ b/src/sass/views/includes/txp-details.scss @@ -5,7 +5,12 @@ $item-vertical-padding: 10px; $item-border-color: #EFEFEF; $item-label-color: #6C6C6E; - + .item-note { + float: none; + .fee-rate { + display: inline-block; + } + } .list { background: #f5f5f5; } @@ -107,7 +112,7 @@ margin-top: 5px; font-size: 14px; color: $item-label-color; - } + } .item-divider { padding-top: 1.2rem; color: $item-label-color; diff --git a/www/views/modals/txp-details.html b/www/views/modals/txp-details.html index d18128132..a093ba441 100644 --- a/www/views/modals/txp-details.html +++ b/www/views/modals/txp-details.html @@ -97,10 +97,11 @@ {{tx.message}} -
- Fee - - {{tx.feeStr}} +
+ {{'Fee:' | translate}} {{tx.feeLevelStr | translate}} + {{tx.feeStr || '...'}} + + {{tx.feeFiatStr || '...'}} - {{tx.feeRateStr}} of the transaction
From 5ee310ec50421e47c0d76ac69c60156c8f495fa3 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Wed, 21 Jun 2017 11:11:40 -0300 Subject: [PATCH 2/3] modified in tx details --- src/js/controllers/modals/txpDetails.js | 5 ++--- src/js/controllers/tx-details.js | 19 +++++++++++++------ www/views/tx-details.html | 10 +++++----- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/js/controllers/modals/txpDetails.js b/src/js/controllers/modals/txpDetails.js index b59c11897..bfab29089 100644 --- a/src/js/controllers/modals/txpDetails.js +++ b/src/js/controllers/modals/txpDetails.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('txpDetailsController', function($scope, $rootScope, $timeout, $interval, $log, ongoingProcess, platformInfo, $ionicScrollDelegate, txFormatService, bwcError, gettextCatalog, lodash, walletService, popupService, $ionicHistory) { +angular.module('copayApp.controllers').controller('txpDetailsController', function($scope, $rootScope, $timeout, $interval, $log, ongoingProcess, platformInfo, $ionicScrollDelegate, txFormatService, bwcError, gettextCatalog, lodash, walletService, popupService, $ionicHistory, feeService) { var isGlidera = $scope.isGlidera; var GLIDERA_LOCK_TIME = 6 * 60 * 60; var now = Math.floor(Date.now() / 1000); @@ -27,8 +27,7 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi $scope.tx.feeFiatStr = v; }); $scope.tx.feeRateStr = ($scope.tx.fee / ($scope.tx.amount + $scope.tx.fee) * 100).toFixed(2) + '%'; - if ($scope.tx.feeLevel == 'superEconomy') $scope.tx.feeLevelStr = gettextCatalog.getString('Super Economy'); - else $scope.tx.feeLevelStr = $scope.tx.feeLevelStr = $scope.tx.feeLevel.charAt(0).toUpperCase() + $scope.tx.feeLevel.slice(1); + $scope.tx.feeLevelStr = feeService.feeOpts[$scope.tx.feeLevel]; }; function applyButtonText() { diff --git a/src/js/controllers/tx-details.js b/src/js/controllers/tx-details.js index 9416bbaee..5af36a0e0 100644 --- a/src/js/controllers/tx-details.js +++ b/src/js/controllers/tx-details.js @@ -11,10 +11,12 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio $scope.wallet = profileService.getWallet(data.stateParams.walletId); $scope.color = $scope.wallet.color; $scope.copayerId = $scope.wallet.credentials.copayerId; - $scope.isShared = $scope.wallet.credentials.n > 1; + $scope.isShared = $scope.wallet.credentials.n > 1; txConfirmNotification.checkIfEnabled(txId, function(res) { - $scope.txNotification = { value: res }; + $scope.txNotification = { + value: res + }; }); }); @@ -24,7 +26,9 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio listeners = [ $rootScope.$on('bwsEvent', function(e, walletId, type, n) { if (type == 'NewBlock' && n && n.data && n.data.network == 'livenet') { - updateTxDebounced({hideLoading: true}); + updateTxDebounced({ + hideLoading: true + }); } }) ]; @@ -108,7 +112,8 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio $scope.btx = txFormatService.processTx(tx); txFormatService.formatAlternativeStr(tx.fees, function(v) { - $scope.feeFiatStr = v; + $scope.btx.feeFiatStr = v; + $scope.btx.feeRateStr = ($scope.btx.fees / ($scope.btx.amount + $scope.btx.fees) * 100).toFixed(2) + '%'; }); if ($scope.btx.action != 'invalid') { @@ -130,7 +135,7 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio }; var updateTxDebounced = lodash.debounce(updateTx, 5000); - + $scope.showCommentPopup = function() { var opts = {}; if ($scope.btx.message) { @@ -194,7 +199,9 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio $scope.txConfirmNotificationChange = function() { if ($scope.txNotification.value) { - txConfirmNotification.subscribe($scope.wallet, { txid: txId }); + txConfirmNotification.subscribe($scope.wallet, { + txid: txId + }); } else { txConfirmNotification.unsubscribe($scope.wallet, txId); } diff --git a/www/views/tx-details.html b/www/views/tx-details.html index 18163cb88..a9fff2256 100644 --- a/www/views/tx-details.html +++ b/www/views/tx-details.html @@ -77,11 +77,11 @@
-
+
Fee - - {{btx.feeStr}} - {{feeFiatStr}} + {{btx.feeStr || '...'}} + + {{btx.feeFiatStr || '...'}} - {{btx.feeRateStr}} of the transaction
@@ -104,7 +104,7 @@
Notify me if confirmed From dadd89e32299a7242a2cf4fea0f9b678db38d586 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Thu, 22 Jun 2017 10:39:09 -0300 Subject: [PATCH 3/3] only on sent txs --- www/views/tx-details.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/views/tx-details.html b/www/views/tx-details.html index a9fff2256..5af45c3aa 100644 --- a/www/views/tx-details.html +++ b/www/views/tx-details.html @@ -77,7 +77,7 @@
-
+
Fee {{btx.feeStr || '...'}}