taler-ios

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

commit 23bc0ba4eeea0568c22ad9c87914476a3cca8f24
parent a9c21083acfae79406fee3cc7c2dfce46be70e41
Author: Marc Stibane <marc@taler.net>
Date:   Sat, 31 Oct 2026 18:04:45 +0100

Contacts

Diffstat:
MTalerWallet1/Controllers/Controller.swift | 21+++++++++++++++++++++
1 file changed, 21 insertions(+), 0 deletions(-)

diff --git a/TalerWallet1/Controllers/Controller.swift b/TalerWallet1/Controllers/Controller.swift @@ -133,6 +133,7 @@ class Controller: ObservableObject { @Published var subscriptions: [TalerToken] = [] @Published var defaultExchanges: [DefaultExchange] = [] @Published var scannedURLs: [ScannedURL] = [] + @Published var contacts: [ContactEntry] = [] @Published var mailboxConfiguration: MailboxConfiguration? = nil @Published var backendState: BackendState = .none // only used for launch animation @@ -344,6 +345,7 @@ class Controller: ObservableObject { discounts = [] subscriptions = [] defaultExchanges = [] + contacts = [] // printFonts() // checkInternetConnection() startObserving() @@ -384,6 +386,25 @@ class Controller: ObservableObject { } return nil } + @MainActor + @discardableResult + func loadContacts(_ stack: CallStack) async -> Int? { + // Do we have a mailbox? + let model = WalletModel.shared + if mailboxConfiguration == nil { + let configuration = try? await model.getMailbox() + mailboxConfiguration = configuration + } + // if yes, then return how many contacts changed + if mailboxConfiguration != nil { + if let response = try? await model.getContacts() { + let count = contacts.count + contacts = response//.sorted(by: { }) + return response.count - count + } + } + return nil + } // MARK: - @MainActor @discardableResult