diff --git a/src/js/controllers/confirm.js b/src/js/controllers/confirm.js index ffeafc6a3..6c9934a8b 100644 --- a/src/js/controllers/confirm.js +++ b/src/js/controllers/confirm.js @@ -20,7 +20,6 @@ angular.module('copayApp.controllers').controller('confirmController', function( toAmount = data.stateParams.toAmount; cachedSendMax = {}; - $scope.showFeeFiat = false; $scope.showAddress = false; $scope.useSendMax = data.stateParams.useSendMax == 'true' ? true : false; $scope.recipientType = data.stateParams.recipientType || null; @@ -44,10 +43,17 @@ angular.module('copayApp.controllers').controller('confirmController', function( $scope.feeLevel = feeService.feeOpts[feeLevel]; $scope.network = (new bitcore.Address($scope.toAddress)).network.name; resetValues(); - setwallets(); + if (!$scope.wallet) setwallets(); + else useSelectedWallet(); applyButtonText(); }); + + function useSelectedWallet() { + if (!$scope.useSendMax) displayValues(); + $scope.onWalletSelect($scope.wallet); + } + function applyButtonText(multisig) { $scope.buttonText = $scope.isCordova ? gettextCatalog.getString('Slide') + ' ' : gettextCatalog.getString('Click') + ' '; @@ -95,7 +101,6 @@ angular.module('copayApp.controllers').controller('confirmController', function( } if (++index == $scope.wallets.length) { - if (!lodash.isEmpty(filteredWallets)) { $scope.wallets = lodash.clone(filteredWallets); if ($scope.useSendMax) { @@ -133,10 +138,6 @@ angular.module('copayApp.controllers').controller('confirmController', function( }); }; - $scope.toggleFeeValue = function() { - $scope.showFeeFiat = !$scope.showFeeFiat; - }; - $scope.toggleAddress = function() { $scope.showAddress = !$scope.showAddress; }; @@ -163,8 +164,8 @@ angular.module('copayApp.controllers').controller('confirmController', function( }; function resetValues() { - $scope.displayAmount = $scope.displayUnit = $scope.fee = $scope.alternativeAmountStr = $scope.insufficientFunds = $scope.noMatchingWallet = null; - $scope.showFeeFiat = $scope.showAddress = false; + $scope.displayAmount = $scope.displayUnit = $scope.fee = $scope.feeFiat = $scope.feePercent = $scope.alternativeAmountStr = $scope.insufficientFunds = $scope.noMatchingWallet = null; + $scope.showAddress = false; }; $scope.getSendMaxInfo = function() { @@ -255,10 +256,14 @@ angular.module('copayApp.controllers').controller('confirmController', function( $scope.displayAmount = getDisplayAmount($scope.amountStr); $scope.displayUnit = getDisplayUnit($scope.amountStr); $scope.fee = txFormatService.formatAmountStr(data.fee); + txFormatService.formatAlternativeStr(data.fee, function(v) { + $scope.feeFiat = v; + }); toAmount = parseFloat((data.amount * satToUnit).toFixed(unitDecimals)); txFormatService.formatAlternativeStr(data.amount, function(v) { $scope.alternativeAmountStr = v; }); + $scope.feePercent = (data.fee * 100 / (data.amount + data.fee)).toFixed(2); $timeout(function() { $scope.$apply(); }); @@ -347,7 +352,6 @@ angular.module('copayApp.controllers').controller('confirmController', function( var stop; $scope.wallet = wallet; $scope.fee = $scope.txp = null; - if (stop) { $timeout.cancel(stop); stop = null; @@ -385,6 +389,7 @@ angular.module('copayApp.controllers').controller('confirmController', function( $scope.feeFiat = v; }); $scope.txp = txp; + $scope.feePercent = (txp.fee * 100 / (txp.amount + txp.fee)).toFixed(2); $timeout(function() { $scope.$apply(); }); @@ -576,4 +581,10 @@ angular.module('copayApp.controllers').controller('confirmController', function( if (err) return setSendError(err); }, onSendStatusChange); }; + + $scope.chooseFeeLevel = function() { + cachedTxp = {}; + $state.go('tabs.send.confirm.fee'); + }; + }); diff --git a/src/js/controllers/tab-send.js b/src/js/controllers/tab-send.js index 96694847f..d76b4db98 100644 --- a/src/js/controllers/tab-send.js +++ b/src/js/controllers/tab-send.js @@ -12,6 +12,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function( $scope.wallets = profileService.getWallets({ onlyComplete: true }); + console.log($scope.wallets); $scope.hasWallets = lodash.isEmpty($scope.wallets) ? false : true; }; @@ -158,6 +159,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function( return popupService.showAlert(err); } $log.debug('Got toAddress:' + addr + ' | ' + item.name); + console.log(item); return $state.transitionTo('tabs.send.amount', { recipientType: item.recipientType, toAddress: addr, diff --git a/src/js/routes.js b/src/js/routes.js index a6320d2a3..eb987a4c2 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -295,6 +295,15 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr paypro: null } }) + .state('tabs.send.confirm.fee', { + url: '/fee', + views: { + 'tab-send@tabs': { + controller: 'preferencesFeeController', + templateUrl: 'views/preferencesFee.html' + } + } + }) .state('tabs.send.addressbook', { url: '/addressbook/add/:fromSendTab/:addressbookEntry', views: { diff --git a/src/sass/views/confirm.scss b/src/sass/views/confirm.scss index 71415b71c..6d6425a6f 100644 --- a/src/sass/views/confirm.scss +++ b/src/sass/views/confirm.scss @@ -1,6 +1,12 @@ #view-confirm { background-color: #ffffff; @extend .deflash-blue; + .item-note { + float: none; + .fee-percent { + display: inline-block; + } + } .icon-amazon { background-image: url("../img/icon-amazon.svg"); } diff --git a/src/sass/views/includes/txp-details.scss b/src/sass/views/includes/txp-details.scss index 1ee5702a1..420c7ab96 100644 --- a/src/sass/views/includes/txp-details.scss +++ b/src/sass/views/includes/txp-details.scss @@ -142,10 +142,6 @@ padding: .2rem 0; margin-bottom: 5px; - ~ .bp-arrow-right { - top: 14px; - } - > i { padding: 0; position: static; diff --git a/www/views/confirm.html b/www/views/confirm.html index b5b746d1b..8b6ad0df7 100644 --- a/www/views/confirm.html +++ b/www/views/confirm.html @@ -48,7 +48,7 @@
- +
@@ -77,18 +77,21 @@
- +
+ {{'Fee' | translate}}: {{feeLevel | translate}} + {{fee || '...'}} + + {{feeFiat || '...'}} - {{feePercent}} % of the transaction + + +
+
Add Memo {{description}} -
- {{'Fee' | translate}}: {{feeLevel | translate}} - {{fee || '...'}} - {{feeFiat || '...'}} -
No wallets available