From 176f0c3141ebdf0d8a267d16f938406ebe6cb715 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Thu, 6 Sep 2018 20:16:25 +0900 Subject: [PATCH] Fix to provide an amount (canSendMax was never set to false when shapeshift) --- src/js/controllers/amount.controller.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/js/controllers/amount.controller.js b/src/js/controllers/amount.controller.js index 0c3be6bd3..398872c03 100644 --- a/src/js/controllers/amount.controller.js +++ b/src/js/controllers/amount.controller.js @@ -109,14 +109,6 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory, setAvailableUnits(); updateUnitUI(); - if (passthroughParams.thirdParty) { - vm.thirdParty = passthroughParams.thirdParty; // Parse stringified JSON-object - if (vm.thirdParty) { - initShapeshift(); - } - } - - var reNr = /^[1234567890\.]$/; var reOp = /^[\*\+\-\/]$/; @@ -216,6 +208,13 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory, var fromWallet = profileService.getWallet(passthroughParams.fromWalletId); updateAvailableFundsFromWallet(fromWallet); } + + if (passthroughParams.thirdParty) { + vm.thirdParty = passthroughParams.thirdParty; // Parse stringified JSON-object + if (vm.thirdParty) { + initShapeshift(); + } + } } } @@ -269,7 +268,6 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory, if (canSendMax) { useSendMax = true; finish(); - } else { var transactionSendableAmountInUnits = transactionSendableAmount.satoshis * satToUnit; if (vm.minAmount && transactionSendableAmountInUnits < vm.minAmount) { @@ -286,7 +284,6 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory, } vm.amount = transactionSendableAmountInUnits.toFixed(LENGTH_AFTER_COMMA_EXPRESSION_LIMIT); finish(); - } } } @@ -526,7 +523,7 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory, $state.transitionTo('tabs.paymentRequest.confirm', confirmData); } else { sendFlowService.goNext(confirmData); - $scope.useSendMax = null; + useSendMax = false; } } @@ -741,7 +738,7 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory, console.log('sendmax Showing sendmax as all available as less than max limit.'); // Enabling send max here is a little dangerous, if they receive funds between pressing // this and the calculation in the Review screen. - canSendMax = true; + canSendMax = false; vm.showSendMaxButton = true; vm.showSendLimitMaxButton = false; transactionSendableAmount.satoshis = walletSpendableAmount.satoshis;