taler-ios

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

commit 53ad00a53111776f76b00754e4a94ebe6c152062
parent 1c756c729fe7137611db46e7bf7e4d5290682c9b
Author: Marc Stibane <marc@taler.net>
Date:   Fri,  6 Nov 2026 04:08:23 +0100

split up

Diffstat:
MTalerWallet1/Views/Transactions/TransactionTypeDetail.swift | 140++++++++++++++++++++++++++++++++++++++++++-------------------------------------
1 file changed, 74 insertions(+), 66 deletions(-)

diff --git a/TalerWallet1/Views/Transactions/TransactionTypeDetail.swift b/TalerWallet1/Views/Transactions/TransactionTypeDetail.swift @@ -70,82 +70,90 @@ struct TransactionTypeDetail: View { return nil } - var body: some View { -#if PRINT_CHANGES - let _ = Self._printChanges() - let _ = symLog.vlog() -#endif + @ViewBuilder func dummyTransactionV(_ common: TransactionCommon) -> some View { #if DEBUG let background = developerMode ? Color.orange : nil #else let background: Color? = nil #endif + Section { + if common.isWorking { + HStack { + Spacer() + RotatingTaler(size: 100, progress: true, once: false, + background: background, + rotationEnabled: $rotationEnabled) + .frame(maxWidth: .infinity, alignment: .center) + // has its own accessibilityLabel + } + } else { + let title = EMPTYSTRING + Text(title) + .talerFont(.body) + } + } + } + + @ViewBuilder func withdrawalTransactionV(_ common: TransactionCommon, + _ details: WithdrawalTransactionDetails) -> some View { + if common.isAborted && details.withdrawalDetails.type == .manual { + if let days = abortedHint(details.withdrawalDetails.reserveClosingDelay) { + let wireBack = days > 0 ? String(localized: "If you have already sent money to the payment service, it will wire it back in \(days) days.") + : String(localized: "If you have already sent money to the payment service, it will wire it back in a few days.") + Text("The withdrawal was aborted.\n\n\(wireBack)") + .talerFont(.callout) + } + } + if common.isPending { + PendingWithdrawalDetails(stack: stack.push(), + transaction: $transaction, + details: details) + } // ManualDetails or Confirm now (with bank) + ThreeAmountsSheet(stack: stack.push(), + scope: scope, + common: common, + topAbbrev: String(localized: "Chosen:", comment: "mini"), + topTitle: String(localized: "Chosen amount to withdraw:"), + baseURL: details.exchangeBaseUrl, + noFees: nil, // TODO: noFees + feeIsNegative: true, + large: false, + summary: nil) + } + + @ViewBuilder func depositTransactionV(_ common: TransactionCommon, + _ details: DepositTransactionDetails) -> some View { + if common.isPendingKYCauth { + KYCauth(stack: stack.push(), common: common) + } else if transaction.isPendingKYC { + KYCbutton(kycUrl: common.kycUrl) + } + ThreeAmountsSheet(stack: stack.push(), + scope: scope, + common: common, + topAbbrev: String(localized: "Deposit:", comment: "mini"), + topTitle: String(localized: "Amount to deposit:"), + baseURL: nil, // TODO: baseURL + noFees: nil, // TODO: noFees + feeIsNegative: false, + large: true, + summary: nil) + } + var body: some View { +#if PRINT_CHANGES + let _ = Self._printChanges() + let _ = symLog.vlog() +#endif let common = transaction.common let pending = transaction.isPending let isDialog = transaction.isDialog Group { switch transaction { - case .dummy(_): Group { - Section { - if common.isWorking { - HStack { - Spacer() - RotatingTaler(size: 100, progress: true, once: false, - background: background, - rotationEnabled: $rotationEnabled) - .frame(maxWidth: .infinity, alignment: .center) - // has its own accessibilityLabel - } - } else { - let title = EMPTYSTRING - Text(title) - .talerFont(.body) - } - } - } - case .withdrawal(let withdrawalTransaction): Group { - let details = withdrawalTransaction.details - if common.isAborted && details.withdrawalDetails.type == .manual { - if let days = abortedHint(details.withdrawalDetails.reserveClosingDelay) { - let wireBack = days > 0 ? String(localized: "If you have already sent money to the payment service, it will wire it back in \(days) days.") - : String(localized: "If you have already sent money to the payment service, it will wire it back in a few days.") - Text("The withdrawal was aborted.\n\n\(wireBack)") - .talerFont(.callout) - } - } - if pending { - PendingWithdrawalDetails(stack: stack.push(), - transaction: $transaction, - details: details) - } // ManualDetails or Confirm now (with bank) - ThreeAmountsSheet(stack: stack.push(), - scope: scope, - common: common, - topAbbrev: String(localized: "Chosen:", comment: "mini"), - topTitle: String(localized: "Chosen amount to withdraw:"), - baseURL: details.exchangeBaseUrl, - noFees: nil, // TODO: noFees - feeIsNegative: true, - large: false, - summary: nil) - } - case .deposit(let depositTransaction): Group { - if transaction.common.isPendingKYCauth { - KYCauth(stack: stack.push(), common: common) - } else if transaction.isPendingKYC { - KYCbutton(kycUrl: common.kycUrl) - } - ThreeAmountsSheet(stack: stack.push(), - scope: scope, - common: common, - topAbbrev: String(localized: "Deposit:", comment: "mini"), - topTitle: String(localized: "Amount to deposit:"), - baseURL: nil, // TODO: baseURL - noFees: nil, // TODO: noFees - feeIsNegative: false, - large: true, - summary: nil) - } + case .dummy(_): dummyTransactionV(common) + case .withdrawal(let withdrawalTransaction): + withdrawalTransactionV(common, withdrawalTransaction.details) + case .deposit(let depositTransaction): + depositTransactionV(common, depositTransaction.details) case .payment(let paymentTransaction): PaymentTransactionView(stack: stack.push(),