taler-ios

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

commit 8eb478d5d086a10ca5a627b34fc5dad16b548c19
parent b51169c4b6ed931b25835eac278c32791663544d
Author: Marc Stibane <marc@taler.net>
Date:   Mon, 10 Aug 2026 19:22:46 +0200

AccountDetailsArray.validDetails

Diffstat:
MTalerWallet1/Model/Model+Withdraw.swift | 20++++++++++++++++++--
MTalerWallet1/Views/HelperViews/AccountPicker.swift | 2+-
MTalerWallet1/Views/HelperViews/SegmentControl.swift | 2+-
3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/TalerWallet1/Model/Model+Withdraw.swift b/TalerWallet1/Model/Model+Withdraw.swift @@ -57,6 +57,22 @@ struct ExchangeAccountDetails: Codable, Hashable { // var conversionError: TalerErrorDetail? // only if error var scope: ScopeInfo? // for Deposit } + +typealias AccountDetailsArray = [ExchangeAccountDetails] + +extension AccountDetailsArray { + /// filter array from Exchange for "ok" + var validDetails: AccountDetailsArray? { + let result = self.filter { detail in + detail.status.lowercased() == "ok" + } + if !result.isEmpty { + return result // guaranteed to have at least 1 item + } + return nil + } +} + // MARK: - enum WithdrawalOperationStatus: String, Codable { case pending @@ -121,7 +137,7 @@ struct WithdrawalDetailsForAmount: Decodable { var amountRaw: Amount // Amount that the user will transfer to the exchange var amountEffective: Amount // Amount that will be added to the user's wallet balance var numCoins: Int? // Number of coins this amountEffective will create - var withdrawalAccountsList: [ExchangeAccountDetails]? + var withdrawalAccountsList: AccountDetailsArray? var ageRestrictionOptions: [Int]? // Array of ages var scopeInfo: ScopeInfo } @@ -218,7 +234,7 @@ fileprivate struct AcceptBankIntegratedWithdrawal: WalletBackendFormattedRequest // MARK: - struct AcceptManualWithdrawalResult: Decodable { var reservePub: String - var withdrawalAccountsList: [ExchangeAccountDetails] + var withdrawalAccountsList: AccountDetailsArray var transactionId: String } /// A request to accept a manual withdrawl. diff --git a/TalerWallet1/Views/HelperViews/AccountPicker.swift b/TalerWallet1/Views/HelperViews/AccountPicker.swift @@ -10,7 +10,7 @@ import SwiftUI struct AccountPicker: View { let title: String @Binding var value: Int - let accountDetails: [ExchangeAccountDetails] + let accountDetails: AccountDetailsArray let action: (Int) -> Void @State private var selected = 0 diff --git a/TalerWallet1/Views/HelperViews/SegmentControl.swift b/TalerWallet1/Views/HelperViews/SegmentControl.swift @@ -9,7 +9,7 @@ import SwiftUI struct SegmentControl: View { @Binding var value: Int - let accountDetails: [ExchangeAccountDetails] + let accountDetails: AccountDetailsArray let action: (Int) -> Void @Environment(\.colorScheme) private var colorScheme