macOS: add settings previews

This commit is contained in:
Peter Steinberger
2025-12-09 18:04:11 +01:00
parent d5cd1058ab
commit 959ba94eca
16 changed files with 360 additions and 58 deletions

View File

@@ -36,7 +36,7 @@ enum DebugActions {
_ = await NotificationManager().send(title: "Clawdis", body: "Test notification", sound: nil)
}
static func sendDebugVoice() async -> Result<String, String> {
static func sendDebugVoice() async -> Result<String, DebugActionError> {
let message = """
This is a debug test from the Mac app. Reply with "Debug test works (and a funny pun)" \
if you received that.
@@ -51,7 +51,7 @@ enum DebugActions {
return .success("Forwarded. Await reply.")
case let .failure(error):
let detail = error.localizedDescription.trimmingCharacters(in: .whitespacesAndNewlines)
return .failure("Forward failed: \(detail)")
return .failure(.message("Forward failed: \(detail)"))
}
}
@@ -75,11 +75,11 @@ enum DebugActions {
let detail = (reason?.isEmpty == false)
? reason!
: "No error returned. Check /tmp/clawdis.log or rpc output."
return .failure("Local send failed: \(detail)")
return .failure(.message("Local send failed: \(detail)"))
}
} catch {
let detail = error.localizedDescription.trimmingCharacters(in: .whitespacesAndNewlines)
return .failure("Local send failed: \(detail)")
return .failure(.message("Local send failed: \(detail)"))
}
}
@@ -91,7 +91,7 @@ enum DebugActions {
}
}
private static func pinoLogPath() -> String {
static func pinoLogPath() -> String {
let df = DateFormatter()
df.calendar = Calendar(identifier: .iso8601)
df.locale = Locale(identifier: "en_US_POSIX")
@@ -102,3 +102,13 @@ enum DebugActions {
return "/tmp/clawdis.log"
}
}
enum DebugActionError: LocalizedError {
case message(String)
var errorDescription: String? {
switch self {
case let .message(text): text
}
}
}