commit a98f3a26840da0007a737c39da8b763c4b79cf8f parent c3c2492d7a741f0d88fb3ab760fbd4ad47ff1d03 Author: Marc Stibane <marc@taler.net> Date: Wed, 21 May 2025 09:54:38 +0200 shortcuts if available >= value Diffstat:
8 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/TalerWallet1/Views/Actions/Banking/DepositAmountView.swift b/TalerWallet1/Views/Actions/Banking/DepositAmountView.swift @@ -148,7 +148,7 @@ struct DepositAmountView: View { CurrencyInputView(scope: scopeInfo, amount: $amountToTransfer, amountLastUsed: amountLastUsed, - available: nil, // amountAvailable, + available: amountAvailable, // enable shortcuts if available >= value title: amountLabel, a11yTitle: a11yLabel, shortcutAction: nil) diff --git a/TalerWallet1/Views/Actions/Banking/ManualWithdraw.swift b/TalerWallet1/Views/Actions/Banking/ManualWithdraw.swift @@ -239,7 +239,7 @@ struct ManualWithdrawContent: View { CurrencyInputView(scope: scope, amount: $amountToTransfer, amountLastUsed: amountLastUsed, - available: nil, + available: nil, // enable shortcuts always title: amountLabel, a11yTitle: a11yLabel, shortcutAction: nil) diff --git a/TalerWallet1/Views/Actions/Peer2peer/RequestPayment.swift b/TalerWallet1/Views/Actions/Peer2peer/RequestPayment.swift @@ -296,7 +296,7 @@ struct RequestPaymentContent: View { summary: $summary, shortcutAction: shortcutAction, buttonAction: buttonAction, - feeIsNegative: true, + isIncoming: true, computeFee: computeFee) .background(actions) } else { diff --git a/TalerWallet1/Views/Actions/Peer2peer/SendAmountView.swift b/TalerWallet1/Views/Actions/Peer2peer/SendAmountView.swift @@ -180,7 +180,7 @@ struct SendAmountView: View { summary: $summary, shortcutAction: shortcutAction, buttonAction: buttonAction, - feeIsNegative: false, + isIncoming: false, computeFee: computeFee) .background(actions) } // Group diff --git a/TalerWallet1/Views/HelperViews/AmountInputV.swift b/TalerWallet1/Views/HelperViews/AmountInputV.swift @@ -44,7 +44,8 @@ struct AmountInputV: View { // @Binding var feeAmount: Amount? let shortcutAction: ((_ amount: Amount) -> Void)? let buttonAction: () -> Void - let feeIsNegative: Bool +// let feeIsNegative: Bool + let isIncoming: Bool let computeFee: ((_ amount: Amount) async -> ComputeFeeResult?)? @EnvironmentObject private var controller: Controller @@ -90,7 +91,7 @@ struct AmountInputV: View { CurrencyInputView(scope: scope, amount: $amountToTransfer, amountLastUsed: amountLastUsed, - available: amountAvailable, + available: isIncoming ? nil : amountAvailable, title: amountLabel, a11yTitle: a11yLabel, shortcutAction: shortcutAction) @@ -100,7 +101,7 @@ struct AmountInputV: View { QuiteSomeCoins(scope: scope, coinData: coinData, shouldShowFee: true, // TODO: set to false if we never charge withdrawal fees - feeIsNegative: feeIsNegative) + feeIsNegative: isIncoming) let flags = checkAvailable(coinData) let hint = String(localized: "enabled when amount is non-zero", comment: "a11y") Button("Next") { buttonAction() } diff --git a/TalerWallet1/Views/HelperViews/CurrencyInputView.swift b/TalerWallet1/Views/HelperViews/CurrencyInputView.swift @@ -16,7 +16,7 @@ struct ShortcutButton: View { let currency: String let currencyField: CurrencyField let shortcut: Int - let available: Amount? + let available: Amount? // disable if available < value let action: (Int, CurrencyField) -> Void func makeButton(with newShortcut: Int) -> ShortcutButton { diff --git a/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift b/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift @@ -186,7 +186,7 @@ struct PayTemplateV: View { summary: $summary, shortcutAction: shortcutAction, buttonAction: buttonAction1, - feeIsNegative: false, + isIncoming: false, computeFee: computeFeePayTemplate) ScrollView { if summaryIsEditable { // after amount input, diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift @@ -185,7 +185,7 @@ struct WithdrawURIView: View { summary: $summary, shortcutAction: shortcutAction, buttonAction: buttonAction, - feeIsNegative: true, + isIncoming: true, computeFee: computeFeeWithdraw) .background(actions) } // ScrollView