commit 73c64bd79d809a1c641bb9d3c3cb23001b1dd9e0
parent 9da5f4bac94c84da613ebce37008600cd3fe8f7e
Author: Marc Stibane <marc@taler.net>
Date: Sun, 12 Nov 2023 13:23:27 +0100
Debugging: Delay currency info
Diffstat:
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/TalerWallet1/Model/Model+Exchange.swift b/TalerWallet1/Model/Model+Exchange.swift
@@ -191,10 +191,10 @@ extension WalletModel {
_ = try await sendRequest(request)
}
- func getCurrencyInfo(scope: ScopeInfo)
+ func getCurrencyInfo(scope: ScopeInfo, delay: UInt = 0)
async throws -> CurrencyInfo {
let request = GetCurrencySpecification(scope: scope)
- let response = try await sendRequest(request, ASYNCDELAY)
+ let response = try await sendRequest(request, ASYNCDELAY + delay)
return CurrencyInfo(scope: scope, specs: response.currencySpecification,
formatter: CurrencyFormatter.formatter(scope: scope,
specs: response.currencySpecification))
diff --git a/TalerWallet1/Views/Main/MainView.swift b/TalerWallet1/Views/Main/MainView.swift
@@ -166,6 +166,9 @@ extension MainView {
// } else {
let _ = Self._printChanges()
// }
+ let delay: UInt = 5
+#else
+ let delay: UInt = 0
#endif
Group {
#if TABBAR // Taler Wallet
@@ -270,7 +273,7 @@ extension MainView {
Task { // runs on MainActor
logger.info("Task to get info for: \(scope.currency, privacy: .public)")
do {
- let info = try await model.getCurrencyInfo(scope: scope)
+ let info = try await model.getCurrencyInfo(scope: scope, delay: delay)
logger.info("got info: \(scope.currency, privacy: .public)")
await controller.setInfo(info)
} catch { // TODO: error handling - couldn't get CurrencyInfo