taler-ios

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

commit 5e348c8bb127604fd2f276b486025e28d2d37e84
parent 78183fec534191e98f22c1e470413d4f286794fe
Author: Marc Stibane <marc@taler.net>
Date:   Thu, 18 Jul 2024 14:57:45 +0200

Pass in currencyInfo

Diffstat:
MTalerWallet1/Views/Banking/DepositAmountV.swift | 10+++++-----
MTalerWallet1/Views/Banking/DepositIbanV.swift | 1+
2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/TalerWallet1/Views/Banking/DepositAmountV.swift b/TalerWallet1/Views/Banking/DepositAmountV.swift @@ -13,6 +13,7 @@ import SymLog struct DepositAmountV: View { private let symLog = SymLogV(0) let stack: CallStack + let currencyInfo: CurrencyInfo // let exchangeBaseUrl: String let paytoUri: String? @@ -58,12 +59,12 @@ struct DepositAmountV: View { : false } - private func buttonTitle(_ amount: Amount, _ currencyInfo: CurrencyInfo) -> String { + private func buttonTitle(_ amount: Amount) -> String { let amountWithCurrency = amount.formatted(currencyInfo, isNegative: false, useISO: true) return String(localized: "Deposit \(amountWithCurrency)", comment: "amount with currency") } - private func subjectTitle(_ amount: Amount, _ currencyInfo: CurrencyInfo) -> String { + private func subjectTitle(_ amount: Amount) -> String { let amountStr = amount.formatted(currencyInfo, isNegative: false) return String(localized: "NavTitle_Deposit_AmountStr", defaultValue: "Deposit", comment: "NavTitle: Deposit") @@ -84,14 +85,13 @@ struct DepositAmountV: View { } else { let currency = amountToTransfer.currencyStr - let currencyInfo = controller.info(for: currency, controller.currencyTicker) let currencySymbol = currencyInfo.specs.altUnitNames?[0] ?? currencyInfo.specs.name let navTitle = String(localized: "NavTitle_Deposit_Currency", defaultValue: "Deposit \(currencySymbol)", comment: "NavTitle: Deposit 'currencySymbol'") let available = amountAvailable?.formatted(currencyInfo, isNegative: false) ?? "an unknown amount" let _ = print("available: \(available)") - let _ = symLog.log("currency: \(currency), available: \(available)") + let _ = symLog.log("currency: \(currencyInfo.specs.name), available: \(available)") let amountVoiceOver = amountToTransfer.formatted(currencyInfo, isNegative: false) let insufficientLabel = String(localized: "You don't have enough \(currencyInfo.specs.name).") let insufficientLabel2 = String(localized: "but you only have \(available) to deposit.") @@ -118,7 +118,7 @@ struct DepositAmountV: View { : (feeAmount?.isZero ?? true) ? WalletColors().secondary(colorScheme, colorSchemeContrast) : .red) .padding(4) - Button(buttonTitle(amountToTransfer, currencyInfo)) { + Button(buttonTitle(amountToTransfer)) { if let paytoUri { depositStarted = true // don't run twice Task { // runs on MainActor diff --git a/TalerWallet1/Views/Banking/DepositIbanV.swift b/TalerWallet1/Views/Banking/DepositIbanV.swift @@ -55,6 +55,7 @@ struct DepositIbanV: View { let currencyInfo = controller.info(for: currency, controller.currencyTicker) let destination = LazyView { DepositAmountV(stack: stack.push(), + currencyInfo: currencyInfo, paytoUri: paytoUri, // exchangeBaseUrl: baseURL, amountAvailable: amountAvailable,