aboutsummaryrefslogtreecommitdiff
path: root/Hotline/Application.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Hotline/Application.swift')
-rw-r--r--Hotline/Application.swift38
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