fix(@wallet): fix amount input send modal

fixes #9207
This commit is contained in:
Anthony Laibe 2023-01-27 10:41:18 +01:00 committed by Anthony Laibe
parent 289005c0e6
commit 64d6c484b2
2 changed files with 13 additions and 4 deletions

View File

@ -29,8 +29,11 @@ QtObject {
function numberFromLocaleString(num, locale = null) {
locale = locale || Qt.locale()
return Number.fromLocaleString(locale, num)
try {
return Number.fromLocaleString(locale, num)
} catch (_) {
return parseFloat(num)
}
}
function currencyAmountToLocaleString(currencyAmount, options = null, locale = null) {

View File

@ -23,14 +23,20 @@ ColumnLayout {
Binding {
target: root
property: "cryptoValueToSend"
value: root.selectedAsset, !inputIsFiat ? getCryptoCurrencyAmount(LocaleUtils.numberFromLocaleString(topAmountToSendInput.text)) : getCryptoValue(fiatValueToSend ? fiatValueToSend.amount : 0.0)
value: {
const value = !inputIsFiat ? getCryptoCurrencyAmount(LocaleUtils.numberFromLocaleString(topAmountToSendInput.text)) : getCryptoValue(fiatValueToSend ? fiatValueToSend.amount : 0.0)
return root.selectedAsset, value
}
delayed: true
}
property var fiatValueToSend
Binding {
target: root
property: "fiatValueToSend"
value: root.selectedAsset, inputIsFiat ? getFiatCurrencyAmount(LocaleUtils.numberFromLocaleString(topAmountToSendInput.text)) : getFiatValue(cryptoValueToSend ? cryptoValueToSend.amount : 0.0)
value: {
const value = inputIsFiat ? getFiatCurrencyAmount(LocaleUtils.numberFromLocaleString(topAmountToSendInput.text)) : getFiatValue(cryptoValueToSend ? cryptoValueToSend.amount : 0.0)
return root.selectedAsset, value
}
delayed: true
}
property string currentCurrency