commit be420eff45c217909e8858541d1eb6959a205257
parent da472b30de8e1a9690ae9ab81fda781f358c6339
Author: Marc Stibane <marc@taler.net>
Date: Tue, 9 Apr 2024 15:17:15 +0200
updateExchangeEntry (temporarily) back to exchangeBaseUrl (instead of scopeInfo)
Diffstat:
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/TalerWallet1/Model/Model+Exchange.swift b/TalerWallet1/Model/Model+Exchange.swift
@@ -117,12 +117,14 @@ fileprivate struct GetExchangeByUrl: WalletBackendFormattedRequest {
fileprivate struct UpdateExchange: WalletBackendFormattedRequest {
struct Response: Decodable {} // no result - getting no error back means success
func operation() -> String { "updateExchangeEntry" }
- func args() -> Args { Args(scopeInfo: scopeInfo) }
+// func args() -> Args { Args(scopeInfo: scopeInfo) }
+ func args() -> Args { Args(exchangeBaseUrl: exchangeBaseUrl) }
- var scopeInfo: ScopeInfo
+// var scopeInfo: ScopeInfo
+ var exchangeBaseUrl: String
struct Args: Encodable {
- var scopeInfo: ScopeInfo
+ var exchangeBaseUrl: String
}
}
@@ -200,10 +202,12 @@ extension WalletModel {
}
/// ask wallet-core to update an existing exchange by querying it for denominations, fees, and scoped currency info
- func updateExchange(scopeInfo: ScopeInfo)
+// func updateExchange(scopeInfo: ScopeInfo)
+ func updateExchange(exchangeBaseUrl: String)
async throws {
- let request = UpdateExchange(scopeInfo: scopeInfo)
- logger.info("updating exchange for: \(scopeInfo.currency, privacy: .public)")
+// let request = UpdateExchange(scopeInfo: scopeInfo)
+ let request = UpdateExchange(exchangeBaseUrl: exchangeBaseUrl)
+ logger.info("updating exchange: \(exchangeBaseUrl, privacy: .public)")
_ = try await sendRequest(request)
}
diff --git a/TalerWallet1/Views/Banking/DepositWithdrawV.swift b/TalerWallet1/Views/Banking/DepositWithdrawV.swift
@@ -26,11 +26,14 @@ struct DepositWithdrawV: View {
amountToTransfer.setCurrency(currency)
buttonSelected = button // will trigger NavigationLink
// after user tapped a button, while navigation animation runs, contact Exchange to update Fees
- Task { // runs on MainActor
- do {
- try await model.updateExchange(scopeInfo: scopeInfo)
- } catch { // TODO: error handling - couldn't updateExchange
- symLog.log("error: \(error)")
+ if let url = scopeInfo.url {
+ Task { // runs on MainActor
+ do {
+// try await model.updateExchange(scopeInfo: scopeInfo)
+ try await model.updateExchange(exchangeBaseUrl: url)
+ } catch { // TODO: error handling - couldn't updateExchange
+ symLog.log("error: \(error)")
+ }
}
}
}