Fix to provide an amount (canSendMax was never set to false when shapeshift)

This commit is contained in:
Jean-Baptiste Dominguez 2018-09-06 20:16:25 +09:00
commit 176f0c3141

View file

@ -109,14 +109,6 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
setAvailableUnits(); setAvailableUnits();
updateUnitUI(); updateUnitUI();
if (passthroughParams.thirdParty) {
vm.thirdParty = passthroughParams.thirdParty; // Parse stringified JSON-object
if (vm.thirdParty) {
initShapeshift();
}
}
var reNr = /^[1234567890\.]$/; var reNr = /^[1234567890\.]$/;
var reOp = /^[\*\+\-\/]$/; var reOp = /^[\*\+\-\/]$/;
@ -216,6 +208,13 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
var fromWallet = profileService.getWallet(passthroughParams.fromWalletId); var fromWallet = profileService.getWallet(passthroughParams.fromWalletId);
updateAvailableFundsFromWallet(fromWallet); 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) { if (canSendMax) {
useSendMax = true; useSendMax = true;
finish(); finish();
} else { } else {
var transactionSendableAmountInUnits = transactionSendableAmount.satoshis * satToUnit; var transactionSendableAmountInUnits = transactionSendableAmount.satoshis * satToUnit;
if (vm.minAmount && transactionSendableAmountInUnits < vm.minAmount) { 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); vm.amount = transactionSendableAmountInUnits.toFixed(LENGTH_AFTER_COMMA_EXPRESSION_LIMIT);
finish(); finish();
} }
} }
} }
@ -526,7 +523,7 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
$state.transitionTo('tabs.paymentRequest.confirm', confirmData); $state.transitionTo('tabs.paymentRequest.confirm', confirmData);
} else { } else {
sendFlowService.goNext(confirmData); 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.'); 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 // Enabling send max here is a little dangerous, if they receive funds between pressing
// this and the calculation in the Review screen. // this and the calculation in the Review screen.
canSendMax = true; canSendMax = false;
vm.showSendMaxButton = true; vm.showSendMaxButton = true;
vm.showSendLimitMaxButton = false; vm.showSendLimitMaxButton = false;
transactionSendableAmount.satoshis = walletSpendableAmount.satoshis; transactionSendableAmount.satoshis = walletSpendableAmount.satoshis;