commit b61c9c1bebc7db7b3d9a06a7e847e8e7277f367f
parent 4dad3c43d56b56a258377df3e3808e85f898b7d7
Author: Marc Stibane <marc@taler.net>
Date: Fri, 14 Aug 2026 19:42:39 +0200
AI: guard deposit amount <= available
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/TalerWallet1/Views/Actions/Banking/DepositAmountView.swift b/TalerWallet1/Views/Actions/Banking/DepositAmountView.swift
@@ -28,7 +28,6 @@ struct DepositAmountView: View {
@AppStorage("minimalistic") var minimalistic: Bool = false
@State var checkDepositResult: CheckDepositResponse? = nil
- @State private var insufficient = false
@State private var feeAmount: Amount? = nil
@State private var feeStr: String = EMPTYSTRING
@State private var exchange: Exchange? = nil // wg. noFees
@@ -101,6 +100,11 @@ struct DepositAmountView: View {
let insufficientLabel = String(localized: "You don't have enough \(currencyInfo.specs.name).")
// let insufficientLabel2 = String(localized: "but you only have \(available) to deposit.")
+ // amountAvailable is wallet-core's getMaxDepositAmount() verdict for this scope.
+ // Fail closed when the two amounts cannot be compared - this happens while the
+ // scope (and thus the currency) is being switched.
+ let insufficient = !amountToTransfer.isZero
+ && ((try? amountToTransfer > amountAvailable) ?? true)
let disabled = insufficient || amountToTransfer.isZero
Text("Available: \(availableStr.0)")