diff options
author | Iván Ávalos <avalos@disroot.org> | 2024-04-11 11:11:58 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2024-04-11 11:11:58 -0600 |
commit | 3ac46474be7af7350e66468d779d915e208843a7 (patch) | |
tree | de758eda2bc820c836bc87dbb31813260e6b0076 | |
parent | d22326733dc7725530b235101b7546da2faf1087 (diff) | |
download | taler-ios-3ac46474be7af7350e66468d779d915e208843a7.tar.gz taler-ios-3ac46474be7af7350e66468d779d915e208843a7.tar.bz2 taler-ios-3ac46474be7af7350e66468d779d915e208843a7.zip |
Fixes for error handling rebasedev/ivan-avalos/errors
-rw-r--r-- | TalerWallet1/Controllers/Controller.swift | 14 | ||||
-rw-r--r-- | TalerWallet1/Model/Model+Transactions.swift | 2 | ||||
-rw-r--r-- | TalerWallet1/Views/Banking/ManualWithdraw.swift | 2 | ||||
-rw-r--r-- | TalerWallet1/Views/Sheets/WithdrawExchangeV.swift | 4 |
4 files changed, 8 insertions, 14 deletions
diff --git a/TalerWallet1/Controllers/Controller.swift b/TalerWallet1/Controllers/Controller.swift index 2045c8f..a3b79ee 100644 --- 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 index 401c43a..c8d19df 100644 --- 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/Banking/ManualWithdraw.swift b/TalerWallet1/Views/Banking/ManualWithdraw.swift index 1b83c38..f6b5743 100644 --- a/TalerWallet1/Views/Banking/ManualWithdraw.swift +++ b/TalerWallet1/Views/Banking/ManualWithdraw.swift @@ -118,7 +118,7 @@ struct ManualWithdraw: View { if !amountToTransfer.isZero { withdrawalAmountDetails = try? await model.getWithdrawalDetailsForAmountM(exchangeBaseUrl, amount: amountToTransfer) - agePicker.setAges(ages: withdrawalAmountDetails?.ageRestrictionOptions) +// agePicker.setAges(ages: withdrawalAmountDetails?.ageRestrictionOptions) } } } diff --git a/TalerWallet1/Views/Sheets/WithdrawExchangeV.swift b/TalerWallet1/Views/Sheets/WithdrawExchangeV.swift index fd1a9df..8968849 100644 --- 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: "") } |