ui: drop default sound picker; use cli per-notification sound

This commit is contained in:
Peter Steinberger
2025-12-08 00:56:36 +01:00
parent 42012389c4
commit 79b76fb5f4
4 changed files with 4 additions and 20 deletions

View File

@@ -14,10 +14,6 @@ final class AppState: ObservableObject {
didSet { UserDefaults.standard.set(self.isPaused, forKey: pauseDefaultsKey) }
}
@Published var defaultSound: String {
didSet { UserDefaults.standard.set(self.defaultSound, forKey: "clawdis.defaultSound") }
}
@Published var launchAtLogin: Bool {
didSet { Task { AppStateStore.updateLaunchAtLogin(enabled: self.launchAtLogin) } }
}
@@ -130,7 +126,6 @@ final class AppState: ObservableObject {
init() {
self.isPaused = UserDefaults.standard.bool(forKey: pauseDefaultsKey)
self.defaultSound = UserDefaults.standard.string(forKey: "clawdis.defaultSound") ?? ""
self.launchAtLogin = LaunchAgentManager.status()
self.onboardingSeen = UserDefaults.standard.bool(forKey: "clawdis.onboardingSeen")
self.debugPaneEnabled = UserDefaults.standard.bool(forKey: "clawdis.debugPaneEnabled")
@@ -224,7 +219,6 @@ final class AppState: ObservableObject {
enum AppStateStore {
static let shared = AppState()
static var isPausedFlag: Bool { UserDefaults.standard.bool(forKey: pauseDefaultsKey) }
static var defaultSound: String { UserDefaults.standard.string(forKey: "clawdis.defaultSound") ?? "" }
static func updateLaunchAtLogin(enabled: Bool) {
LaunchAgentManager.set(enabled: enabled, bundlePath: Bundle.main.bundlePath)

View File

@@ -48,17 +48,6 @@ var body: some View {
title: "Enable debug tools",
subtitle: "Show the Debug tab with development utilities.",
binding: self.$state.debugPaneEnabled)
LabeledContent("Default sound") {
Picker("Sound", selection: self.$state.defaultSound) {
Text("None").tag("")
Text("Glass").tag("Glass")
Text("Basso").tag("Basso")
Text("Ping").tag("Ping")
}
.labelsHidden()
.frame(width: 140)
}
}
Spacer(minLength: 12)

View File

@@ -37,7 +37,7 @@ final class ClawdisXPCService: NSObject, ClawdisXPCProtocol {
switch request {
case let .notify(title, body, sound):
let chosenSound: String = if let sound { sound } else { await MainActor.run { AppStateStore.defaultSound } }
let chosenSound = sound?.trimmingCharacters(in: .whitespacesAndNewlines)
let ok = await notifier.send(title: title, body: body, sound: chosenSound)
return ok ? Response(ok: true) : Response(ok: false, message: "notification not authorized")