Fix for when an amount changes from having a separate currency value, to the currency being one string with the amount.
This commit is contained in:
parent
b8de811fbe
commit
69e8c62f5c
3 changed files with 20 additions and 24 deletions
|
|
@ -70,7 +70,6 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
|
|||
initCurrencies();
|
||||
|
||||
passthroughParams = data.stateParams;
|
||||
console.log('stateParams:', data.stateParams);
|
||||
|
||||
vm.fromWalletId = data.stateParams.fromWalletId;
|
||||
vm.toWalletId = data.stateParams.toWalletId;
|
||||
|
|
@ -90,7 +89,6 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
|
|||
vm.toWallet = profileService.getWallet(vm.toWalletId);
|
||||
|
||||
shapeshiftService.getMarketData(vm.fromWallet.coin, vm.toWallet.coin, function(data) {
|
||||
console.log(data);
|
||||
vm.thirdParty.data['minAmount'] = vm.minAmount = parseFloat(data.minimum);
|
||||
vm.thirdParty.data['maxAmount'] = vm.maxAmount = parseFloat(data.maxLimit);
|
||||
});
|
||||
|
|
@ -472,8 +470,6 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
|
|||
confirmData['thirdParty'] = JSON.stringify(this.thirdParty);
|
||||
}
|
||||
|
||||
console.log('confirmData:', confirmData);
|
||||
|
||||
if (!confirmData.fromWalletId) {
|
||||
$state.transitionTo('tabs.paymentRequest.confirm', confirmData);
|
||||
} else {
|
||||
|
|
@ -594,20 +590,19 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
|
|||
if (passthroughParams.fromWalletId && availableSatoshis !== null) {
|
||||
availableFundsInFiat = '';
|
||||
vm.availableFunds = availableFundsInCrypto;
|
||||
var coin = availableUnits[altUnitIndex].isFiat ? availableUnits[unitIndex].id : availableUnits[altUnitIndex].id;
|
||||
txFormatService.formatAlternativeStr(coin, availableSatoshis, function formatCallback(formatted){
|
||||
if (formatted) {
|
||||
availableFundsInFiat = formatted;
|
||||
|
||||
$scope.$apply(function() {
|
||||
if (availableUnits[unitIndex].isFiat) {
|
||||
if (availableUnits[unitIndex].isFiat) {
|
||||
var coin = availableUnits[altUnitIndex].id;
|
||||
txFormatService.formatAlternativeStr(coin, availableSatoshis, function formatCallback(formatted){
|
||||
if (formatted) {
|
||||
availableFundsInFiat = formatted;
|
||||
|
||||
$scope.$apply(function() {
|
||||
vm.availableFunds = availableFundsInFiat;
|
||||
} else {
|
||||
vm.availableFunds = availableFundsInCrypto;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,14 +63,15 @@ angular.module('bitcoincom.directives')
|
|||
};
|
||||
|
||||
var formatNumbers = function() {
|
||||
|
||||
if (!$scope.currency && $scope.value) { // If there is no currency available..
|
||||
// Try to extract currency from value..
|
||||
var currencySplit = $scope.value.split(" ");
|
||||
if (currencySplit.length === 2) {
|
||||
$scope.currency = currencySplit[1];
|
||||
}
|
||||
console.log('formatNumbers("' + $scope.value + '", "' + $scope.currency + '")');
|
||||
// During watch, may be changed from having a separate currency value,
|
||||
// to both being in value. Don't want to use previous currency value.
|
||||
// Try to extract currency from value..
|
||||
var currencySplit = $scope.value.split(" ");
|
||||
if (currencySplit.length === 2) {
|
||||
$scope.currency = currencySplit[1];
|
||||
}
|
||||
|
||||
|
||||
var parsed = parseFloat($scope.value);
|
||||
var valueFormatted = '';
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
<div class="extra available-funds"
|
||||
ng-class="{warning: vm.fundsAreInsufficient}"
|
||||
ng-if="!vm.isRequestingSpecificAmount" translate>
|
||||
<span>Available Funds:</span> <span><formatted-amount value="{{vm.availableFunds}}"></formatted-amount></span>
|
||||
<span>Available Funds:</span> <span><formatted-amount value="{{vm.availableFunds}}" size-equal="true"></formatted-amount></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue