diff options
| author | Dustin Mierau <dustin@mierau.me> | 2024-01-15 20:20:47 -0800 |
|---|---|---|
| committer | Dustin Mierau <dustin@mierau.me> | 2024-01-15 20:20:47 -0800 |
| commit | 7c9f6686044035c022a17551151cf1cbed0dc665 (patch) | |
| tree | d41403b6f64d3375fdea8cee48d9db91c3ce26e0 /Hotline/Application.swift | |
| parent | faae9cd1b47c6f22f3bcf4b1a24a4f7df41af9ed (diff) | |
Add classic sound effects. Fix read user access bits. Better no content/no access views. Add Server menu. Add keep alive ping to server every 3 minutes.
Diffstat (limited to 'Hotline/Application.swift')
| -rw-r--r-- | Hotline/Application.swift | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Hotline/Application.swift b/Hotline/Application.swift index e7445dc..fdada40 100644 --- a/Hotline/Application.swift +++ b/Hotline/Application.swift @@ -13,6 +13,10 @@ struct Application: App { #endif @State private var preferences = Prefs() + @State private var soundEffects = SoundEffectPlayer() + + @FocusedValue(\.activeHotlineModel) private var activeHotline: Hotline? + @FocusedValue(\.activeServerState) private var activeServerState: ServerState? var body: some Scene { #if os(iOS) @@ -35,6 +39,7 @@ struct Application: App { ServerView(server: server) .frame(minWidth: 400, minHeight: 300) .environment(preferences) + .environment(soundEffects) } defaultValue: { Server(name: nil, description: nil, address: "") } @@ -47,6 +52,39 @@ struct Application: App { } .keyboardShortcut(.init("K"), modifiers: .command) } + CommandMenu("Server") { + Button("Disconnect") { + activeHotline?.disconnect() + } + .disabled(activeHotline?.status == .disconnected) + Divider() + Button("Broadcast Message...") { + // TODO: Implement broadcast message when user is allowed. + } + .disabled(true) + .keyboardShortcut(.init("B"), modifiers: .command) + Divider() + Button("Show Chat") { + activeServerState?.selection = .chat + } + .disabled(activeHotline?.status != .loggedIn) + .keyboardShortcut(.init("1"), modifiers: .command) + Button("Show News") { + activeServerState?.selection = .news + } + .disabled(activeHotline?.status != .loggedIn) + .keyboardShortcut(.init("2"), modifiers: .command) + Button("Show Message Board") { + activeServerState?.selection = .board + } + .disabled(activeHotline?.status != .loggedIn) + .keyboardShortcut(.init("3"), modifiers: .command) + Button("Show Files") { + activeServerState?.selection = .files + } + .disabled(activeHotline?.status != .loggedIn) + .keyboardShortcut(.init("4"), modifiers: .command) + } } // MARK: Settings Window |