implemented appropriate send max button for shapeshift
This commit is contained in:
parent
040f9a72a8
commit
efe2c333a8
2 changed files with 18 additions and 3 deletions
|
|
@ -395,7 +395,6 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
}
|
||||
|
||||
if ($scope.nextStep) {
|
||||
|
||||
$state.transitionTo($scope.nextStep, {
|
||||
id: _id,
|
||||
amount: $scope.useSendMax ? null : _amount,
|
||||
|
|
@ -428,6 +427,22 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
shapeshiftOrderUrl += $scope.shapeshiftOrderId;
|
||||
confirmData.description = shapeshiftOrderUrl;
|
||||
confirmData.fromWalletId = $scope.fromWalletId;
|
||||
|
||||
if (confirmData.useSendMax) {
|
||||
var wallet = lodash.find(profileService.getWallets({ coin: coin }),
|
||||
function(w) {
|
||||
return w.id == $scope.fromWalletId;
|
||||
});
|
||||
|
||||
var balance = parseFloat(wallet.cachedBalance.substring(0, wallet.cachedBalance.length-4));
|
||||
if (balance < $scope.minShapeshiftAmount * 1.04) {
|
||||
confirmData.useSendMax = false;
|
||||
confirmData.toAmount = $scope.minShapeshiftAmount * unitToSatoshi;
|
||||
} else if (balance > $scope.maxShapeshiftAmount) {
|
||||
confirmData.useSendMax = false;
|
||||
confirmData.toAmount = $scope.maxShapeshiftAmount * unitToSatoshi * 0.99;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$state.transitionTo('tabs.send.confirm', confirmData);
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
<div class="amount__result-equiv">≈ {{alternativeAmount || '0.00'}} {{alternativeUnit}}</div>
|
||||
</div>
|
||||
<div>
|
||||
<button class="button button-sendmax" ng-if="!shapeshiftOrderId" ng-click="sendMax()">
|
||||
<button class="button button-sendmax" ng-click="sendMax()">
|
||||
<span>
|
||||
<i class="icon ion-ios-speedometer-outline"></i> 
|
||||
<span translate>Send max amount</span>
|
||||
|
|
@ -74,7 +74,7 @@
|
|||
<span>≈ {{alternativeAmount || '0.00'}} {{alternativeUnit}}</span>
|
||||
</div>
|
||||
<div>
|
||||
<button class="button button-sendmax" ng-if="!shapeshiftOrderId" ng-click="sendMax()">
|
||||
<button class="button button-sendmax" ng-click="sendMax()">
|
||||
<span>
|
||||
<i class="icon ion-ios-speedometer-outline"></i> 
|
||||
<span translate>Send max amount</span>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue