diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2024-06-10 15:19:11 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2024-06-10 15:19:11 -0700 |
| commit | f8bb263ad12b87da4a7a249edd44932a9e7d1f17 (patch) | |
| tree | f74af8ce88789204c760f286957a2551c5f1bf04 /Hotline/Models | |
| parent | bb292ec9ade3ed323108ff805b4a6c53115122ba (diff) | |
Add account management functionality
Diffstat (limited to 'Hotline/Models')
| -rw-r--r-- | Hotline/Models/Hotline.swift | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Hotline/Models/Hotline.swift b/Hotline/Models/Hotline.swift index 93f1762..70073c2 100644 --- a/Hotline/Models/Hotline.swift +++ b/Hotline/Models/Hotline.swift @@ -125,6 +125,7 @@ class Hotline: Equatable, HotlineClientDelegate, HotlineFileClientDelegate { var access: HotlineUserAccessOptions? var agreed: Bool = false var users: [User] = [] + var accounts: [HotlineAccount] = [] var chat: [ChatMessage] = [] var messageBoard: [String] = [] var messageBoardLoaded: Bool = false @@ -133,6 +134,7 @@ class Hotline: Equatable, HotlineClientDelegate, HotlineFileClientDelegate { var news: [NewsInfo] = [] private var newsLookup: [String:NewsInfo] = [:] var newsLoaded: Bool = false + var accountsLoaded: Bool = false var instantMessages: [UInt16:[InstantMessage]] = [:] var transfers: [TransferInfo] = [] var downloads: [HotlineFileClient] = [] @@ -308,6 +310,14 @@ class Hotline: Equatable, HotlineClientDelegate, HotlineFileClientDelegate { } + @MainActor func getAccounts() async -> [HotlineAccount] { + return await withCheckedContinuation { [weak self] continuation in + self?.client.sendGetAccounts() { articles in + continuation.resume(returning: articles) + } + } + } + @MainActor func getNewsList(at path: [String] = []) async { return await withCheckedContinuation { [weak self] continuation in let parentNewsGroup = self?.findNews(in: self?.news ?? [], at: path) |