style: tidy macos swift formatting

This commit is contained in:
Peter Steinberger
2025-12-20 12:56:57 +01:00
parent 2d8e11b78b
commit 636e4d38d5
8 changed files with 25 additions and 26 deletions

View File

@@ -100,6 +100,7 @@ enum DebugActions {
// ControlChannel will surface a degraded state; also refresh health to update the menu text.
Task { await HealthStore.shared.refresh(onDemand: true) }
}
case .unconfigured:
await GatewayConnection.shared.shutdown()
await ControlChannel.shared.disconnect()

View File

@@ -63,11 +63,10 @@ final class DeepLinkHandler {
let explicitSessionKey = link.sessionKey?
.trimmingCharacters(in: .whitespacesAndNewlines)
.nonEmpty
let resolvedSessionKey: String
if let explicitSessionKey {
resolvedSessionKey = explicitSessionKey
let resolvedSessionKey: String = if let explicitSessionKey {
explicitSessionKey
} else {
resolvedSessionKey = await GatewayConnection.shared.mainSessionKey()
await GatewayConnection.shared.mainSessionKey()
}
let invocation = GatewayAgentInvocation(
message: messagePreview,

View File

@@ -9,7 +9,7 @@ final class DockIconManager: NSObject, @unchecked Sendable {
private var windowsObservation: NSKeyValueObservation?
private let logger = Logger(subsystem: "com.steipete.clawdis", category: "DockIconManager")
private override init() {
override private init() {
super.init()
self.setupObservers()
Task { @MainActor in

View File

@@ -111,4 +111,3 @@ enum GatewayLaunchAgentManager {
}.value
}
}

View File

@@ -111,11 +111,11 @@ struct MenuContent: View {
private var connectionLabel: String {
switch self.state.connectionMode {
case .unconfigured:
return "Clawdis Not Configured"
"Clawdis Not Configured"
case .remote:
return "Remote Clawdis Active"
"Remote Clawdis Active"
case .local:
return "Clawdis Active"
"Clawdis Active"
}
}

View File

@@ -323,7 +323,7 @@ actor MacNodeRuntime {
let params = try Self.decodeParams(ClawdisSystemNotifyParams.self, from: req.paramsJSON)
let title = params.title.trimmingCharacters(in: .whitespacesAndNewlines)
let body = params.body.trimmingCharacters(in: .whitespacesAndNewlines)
if title.isEmpty && body.isEmpty {
if title.isEmpty, body.isEmpty {
return Self.errorResponse(req, code: .invalidRequest, message: "INVALID_REQUEST: empty notification")
}

View File

@@ -93,11 +93,11 @@ struct OnboardingView: View {
case .remote:
// Remote setup doesn't need local gateway/CLI/workspace setup pages,
// and WhatsApp/Telegram setup is optional.
return [0, 1, 5, 9]
[0, 1, 5, 9]
case .unconfigured:
return [0, 1, 9]
[0, 1, 9]
case .local:
return [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
}
}

View File

@@ -157,20 +157,20 @@ actor PortGuardian {
let okPredicate: (Listener) -> Bool
let expectedCommands = ["node", "clawdis", "tsx", "pnpm", "bun"]
switch mode {
case .remote:
expectedDesc = "SSH tunnel to remote gateway"
okPredicate = { $0.command.lowercased().contains("ssh") }
case .local:
expectedDesc = "Gateway websocket (node/tsx)"
okPredicate = { listener in
let c = listener.command.lowercased()
return expectedCommands.contains { c.contains($0) }
switch mode {
case .remote:
expectedDesc = "SSH tunnel to remote gateway"
okPredicate = { $0.command.lowercased().contains("ssh") }
case .local:
expectedDesc = "Gateway websocket (node/tsx)"
okPredicate = { listener in
let c = listener.command.lowercased()
return expectedCommands.contains { c.contains($0) }
}
case .unconfigured:
expectedDesc = "Gateway not configured"
okPredicate = { _ in false }
}
case .unconfigured:
expectedDesc = "Gateway not configured"
okPredicate = { _ in false }
}
if listeners.isEmpty {
let text = "Nothing is listening on \(port) (\(expectedDesc))."