aboutsummaryrefslogtreecommitdiff
path: root/Hotline/Models
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2023-12-12 15:27:00 -0800
committerDustin Mierau <dustin@mierau.me>2023-12-12 15:27:00 -0800
commit248fcbbd5dca84747e6f3fd9d1d52c41ab8640c3 (patch)
treef8f76c7b071aff2fe56c4e900c72dcbaddd3c62a /Hotline/Models
parentf71c4cae3b21db506573bcdfa9fdb6cde41cc0ca (diff)
New category listing is working again. Added optionset for user access info. Some UI cleanup across the board.
Diffstat (limited to 'Hotline/Models')
-rw-r--r--Hotline/Models/Hotline.swift15
1 files changed, 11 insertions, 4 deletions
diff --git a/Hotline/Models/Hotline.swift b/Hotline/Models/Hotline.swift
index b2a9489..beb3a74 100644
--- a/Hotline/Models/Hotline.swift
+++ b/Hotline/Models/Hotline.swift
@@ -137,6 +137,7 @@ struct User: Identifiable {
var server: Server? = nil
var serverVersion: UInt16? = nil
+ var serverName: String? = nil
var username: String = "bolt"
var iconID: UInt = 128
@@ -180,8 +181,11 @@ struct User: Identifiable {
self.iconID = iconID
return await withCheckedContinuation { [weak self] continuation in
- let _ = self?.client.login(server.address, port: UInt16(server.port), login: login, password: password, username: username, iconID: UInt16(iconID)) { [weak self] err, serverVersion in
+ let _ = self?.client.login(server.address, port: UInt16(server.port), login: login, password: password, username: username, iconID: UInt16(iconID)) { [weak self] err, serverName, serverVersion in
self?.serverVersion = serverVersion
+ if serverName != nil {
+ self?.serverName = serverName
+ }
continuation.resume(returning: (err != nil))
}
}
@@ -212,7 +216,6 @@ struct User: Identifiable {
continuation.resume(returning: [])
return
}
- // Failed to send?
}, reply: { [weak self] files in
let parentFile = self?.findFile(in: self?.files ?? [], at: path)
@@ -222,11 +225,9 @@ struct User: Identifiable {
}
if let parent = parentFile {
- print("FOUND PARENT AT \(path)")
parent.children = newFiles
}
else if path.isEmpty {
- print("FOUND ROOT AT \(path)")
self?.files = newFiles
}
@@ -270,6 +271,7 @@ struct User: Identifiable {
if status == .disconnected {
self.serverVersion = nil
+ self.serverName = nil
self.users = []
self.chat = []
self.messageBoard = []
@@ -334,6 +336,11 @@ struct User: Identifiable {
}
}
+ func hotlineReceivedUserAccess(options: HotlineUserAccessOptions) {
+ print("Hotline: got access options")
+ print(options, options.contains(.canSendChat), options.contains(.canBroadcast))
+ }
+
func hotlineReceivedError(message: String) {
}