diff options
| author | Dustin Mierau <dustin@mierau.me> | 2024-05-01 21:22:18 -0700 |
|---|---|---|
| committer | Dustin Mierau <dustin@mierau.me> | 2024-05-01 21:32:15 -0700 |
| commit | 60a3f2d29dfff945f59787f5a7786c6e78ba7bb9 (patch) | |
| tree | e3d0aa6ae541790ea700353b0ac01fe8b4950f9f /Hotline/Models | |
| parent | b9529a0d255ad41c62a4e3b93a47ebb5bb82a565 (diff) | |
New Hotline toolbar window for banner.
Diffstat (limited to 'Hotline/Models')
| -rw-r--r-- | Hotline/Models/ApplicationState.swift | 14 | ||||
| -rw-r--r-- | Hotline/Models/Hotline.swift | 9 |
2 files changed, 20 insertions, 3 deletions
diff --git a/Hotline/Models/ApplicationState.swift b/Hotline/Models/ApplicationState.swift new file mode 100644 index 0000000..124db6b --- /dev/null +++ b/Hotline/Models/ApplicationState.swift @@ -0,0 +1,14 @@ +import SwiftUI + +@Observable +class ApplicationState { + static let shared = ApplicationState() + + var activeHotline: Hotline? = nil + var activeServerState: ServerState? = nil + + // Frontmost server window information + var activeServerID: UUID? = nil + var activeServerBanner: NSImage? = nil + var activeServerName: String? = nil +} diff --git a/Hotline/Models/Hotline.swift b/Hotline/Models/Hotline.swift index f1c745f..3cc8366 100644 --- a/Hotline/Models/Hotline.swift +++ b/Hotline/Models/Hotline.swift @@ -1,10 +1,14 @@ import SwiftUI @Observable -final class Hotline: HotlineClientDelegate, HotlineFileClientDelegate { +class Hotline: Equatable, HotlineClientDelegate, HotlineFileClientDelegate { + let id: UUID = UUID() let trackerClient: HotlineTrackerClient let client: HotlineClient - let soundEffects: SoundEffectPlayer = SoundEffectPlayer() + + static func == (lhs: Hotline, rhs: Hotline) -> Bool { + return lhs.id == rhs.id + } #if os(macOS) static func getClassicIcon(_ index: Int) -> NSImage? { @@ -178,7 +182,6 @@ final class Hotline: HotlineClientDelegate, HotlineFileClientDelegate { self.iconID = iconID self.client.login(address: server.address, port: server.port, login: server.login, password: server.password, username: username, iconID: UInt16(iconID)) { [weak self] err, serverName, serverVersion in - print("Server info:", serverName, serverVersion) self?.serverVersion = serverVersion ?? 123 if serverName != nil { self?.serverName = serverName |