taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit de01b1a18d40124e4601b110e754a5b5f3a4aca4
parent d1251ec20baf72e33dab99730077fa68b02777ee
Author: Marc Stibane <marc@taler.net>
Date:   Wed,  5 Jul 2023 14:10:03 +0200

Check that amount is valid

Diffstat:
MTalerWallet1/Views/Exchange/ManualWithdraw.swift | 27+++++++++++++--------------
MTalerWallet1/Views/Peer2peer/RequestPayment.swift | 2+-
2 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/TalerWallet1/Views/Exchange/ManualWithdraw.swift b/TalerWallet1/Views/Exchange/ManualWithdraw.swift @@ -31,18 +31,18 @@ struct ManualWithdraw: View { // let agePicker = AgePicker(ageMenuList: $ageMenuList, selectedAge: $selectedAge) ScrollViewReader { scrollView in - VStack { - Text("from \(exchange.exchangeBaseUrl.trimURL())") - .font(.title3) - CurrencyInputView(currencyField: currencyField, - title: String(localized: "Amount to withdraw:")) + VStack { + Text("from \(exchange.exchangeBaseUrl.trimURL())") + .font(.title3) + CurrencyInputView(currencyField: currencyField, + title: String(localized: "Amount to withdraw:")) - let someCoins = SomeCoins(details: withdrawalAmountDetails) - QuiteSomeCoins(someCoins: someCoins, shouldShowFee: true, - currency: currency, amountEffective: withdrawalAmountDetails?.amountEffective) + let someCoins = SomeCoins(details: withdrawalAmountDetails) + QuiteSomeCoins(someCoins: someCoins, shouldShowFee: true, + currency: currency, amountEffective: withdrawalAmountDetails?.amountEffective) - if !someCoins.invalid { - if !someCoins.tooMany { + let disabled = (centsToTransfer == 0) || someCoins.invalid || someCoins.tooMany + if !disabled { // agePicker if let tosAccepted = withdrawalAmountDetails?.tosAccepted { @@ -67,10 +67,9 @@ struct ManualWithdraw: View { }.buttonStyle(TalerButtonStyle(type: .prominent)) } } - } // tooMany - } // invalid - Spacer() - } + } // disabled + Spacer() + } } .frame(maxWidth: .infinity, alignment: .leading) .padding(.horizontal) diff --git a/TalerWallet1/Views/Peer2peer/RequestPayment.swift b/TalerWallet1/Views/Peer2peer/RequestPayment.swift @@ -38,7 +38,7 @@ struct RequestPayment: View { currency: currency, amountEffective: peerPullCheck?.amountEffective) HStack { - let disabled = centsToTransfer == 0 + let disabled = (centsToTransfer == 0) || someCoins.invalid || someCoins.tooMany NavigationLink(destination: LazyView { PaymentPurpose(scopeInfo: scopeInfo,