taler-ios

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

commit 5efb9f682382646284e03a543e10824d259c0939
parent 9b397c7f71f5f593579637de6c3e430aa74bd33f
Author: Marc Stibane <marc@taler.net>
Date:   Tue, 30 Jul 2024 09:24:58 +0200

currencyInfo

Diffstat:
MTalerWallet1/Views/Sheets/Payment/PaymentView.swift | 18++++++++++++++++++
1 file changed, 18 insertions(+), 0 deletions(-)

diff --git a/TalerWallet1/Views/Sheets/Payment/PaymentView.swift b/TalerWallet1/Views/Sheets/Payment/PaymentView.swift @@ -88,6 +88,20 @@ struct PaymentView: View { let navTitle = String(localized: "Confirm Payment", comment:"pay merchant") + func checkCurrencyInfo(for result: PreparePayResult) async { + let exchanges = result.contractTerms.exchanges + for exchange in exchanges { + let baseUrl = exchange.url + if let someExchange = try? await model.getExchangeByUrl(url: baseUrl) { + symLog.log("\(baseUrl.trimURL()) loaded") + await controller.checkCurrencyInfo(for: baseUrl, model: model) + symLog.log("Info(for: \(baseUrl.trimURL())) loaded") + return + } + } + symLog.log("Couldn't load Info(for: \(result.amountRaw.currencyStr))") + } + var body: some View { Group { if let preparePayResult { @@ -177,6 +191,7 @@ struct PaymentView: View { .task(id: controller.currencyTicker) { let currency = amountToTransfer.currencyStr currencyInfo = controller.info(for: currency, controller.currencyTicker) + symLog.log("Info(for: \(currency)) loaded: \(currencyInfo.scope.currency)") // currencyName = currencyInfo.scope.currency } } else { @@ -187,10 +202,13 @@ struct PaymentView: View { if let result = try? await model.preparePayForTemplateM(url.absoluteString, amount: amountIsEditable ? amountToTransfer : nil, summary: summaryIsEditable ? summary : nil) { + await checkCurrencyInfo(for: result) preparePayResult = result } } else { if let result = try? await model.preparePayForUriM(url.absoluteString) { + amountToTransfer = result.amountRaw + await checkCurrencyInfo(for: result) preparePayResult = result } }