commit 08a200e6c93f7e5bca497737cdebce76c2ca3e51
parent 8ba44768bb3869261b902b25076f7e5bce8401ba
Author: Iván Ávalos <avalos@disroot.org>
Date: Thu, 11 Apr 2024 11:11:58 -0600
Fixes for error handling rebase
Diffstat:
3 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/TalerWallet1/Controllers/Controller.swift b/TalerWallet1/Controllers/Controller.swift
@@ -89,17 +89,13 @@ class Controller: ObservableObject {
@MainActor
func getInfo(from exchangeBaseUrl: String, model: WalletModel) async throws -> CurrencyInfo? {
let exchange = try await model.getExchangeByUrl(url: exchangeBaseUrl)
- if let scopeInfo = exchange.scopeInfo {
- if let info = hasInfo(for: scopeInfo.currency) {
- return info
- }
- let info = try await model.getCurrencyInfoM(scope: scopeInfo, delay: 0)
- await setInfo(info)
+ let scopeInfo = exchange.scopeInfo
+ if let info = hasInfo(for: scopeInfo.currency) {
return info
- } else {
- // TODO: Error "Can't get Exchange Info"
}
- return nil
+ let info = try await model.getCurrencyInfoM(scope: scopeInfo, delay: 0)
+ await setInfo(info)
+ return info
}
@MainActor
diff --git a/TalerWallet1/Model/Model+Transactions.swift b/TalerWallet1/Model/Model+Transactions.swift
@@ -104,7 +104,7 @@ struct ResumeTransaction: WalletBackendFormattedRequest {
extension WalletModel {
/// ask wallet-core for its list of transactions filtered by searchString
func transactionsT(_ stack: CallStack, scopeInfo: ScopeInfo, searchString: String? = nil,
- sort: String = "descending", includeRefreshes: includeRefreshes, viewHandles: Bool = false)
+ sort: String = "descending", includeRefreshes: Bool = false, viewHandles: Bool = false)
async throws -> [Transaction] {
let request = GetTransactions(scopeInfo: scopeInfo, currency: scopeInfo.currency, search: searchString, sort: sort, includeRefreshes: includeRefreshes)
let response = try await sendRequest(request, ASYNCDELAY, viewHandles: viewHandles)
diff --git a/TalerWallet1/Views/Sheets/WithdrawExchangeV.swift b/TalerWallet1/Views/Sheets/WithdrawExchangeV.swift
@@ -50,9 +50,7 @@ struct WithdrawExchangeV: View {
if let amount = withdrawExchange.amount {
amountToTransfer = amount
} else {
- let currency = exc.scopeInfo?.currency
- ?? exc.currency
- ?? String(localized: "Unknown", comment: "unknown currency")
+ let currency = exc.scopeInfo.currency
amountToTransfer.setCurrency(currency)
// is already Amount.zero(currency: "")
}