style(swift): fix lint

This commit is contained in:
Peter Steinberger
2025-12-17 21:50:54 +01:00
parent 51bdf01e2e
commit 2b2376d4c0
5 changed files with 23 additions and 13 deletions

View File

@@ -140,7 +140,7 @@ final class BridgeConnectionController {
} }
private func currentCaps() -> [String] { private func currentCaps() -> [String] {
var caps: [String] = ["canvas"] var caps = ["canvas"]
// Default-on: if the key doesn't exist yet, treat it as enabled. // Default-on: if the key doesn't exist yet, treat it as enabled.
let cameraEnabled = let cameraEnabled =
@@ -154,14 +154,13 @@ final class BridgeConnectionController {
private func platformString() -> String { private func platformString() -> String {
let v = ProcessInfo.processInfo.operatingSystemVersion let v = ProcessInfo.processInfo.operatingSystemVersion
let name: String let name = switch UIDevice.current.userInterfaceIdiom {
switch UIDevice.current.userInterfaceIdiom {
case .pad: case .pad:
name = "iPadOS" "iPadOS"
case .phone: case .phone:
name = "iOS" "iOS"
default: default:
name = "iOS" "iOS"
} }
return "\(name) \(v.majorVersion).\(v.minorVersion).\(v.patchVersion)" return "\(name) \(v.majorVersion).\(v.minorVersion).\(v.patchVersion)"
} }
@@ -169,11 +168,11 @@ final class BridgeConnectionController {
private func deviceFamily() -> String { private func deviceFamily() -> String {
switch UIDevice.current.userInterfaceIdiom { switch UIDevice.current.userInterfaceIdiom {
case .pad: case .pad:
return "iPad" "iPad"
case .phone: case .phone:
return "iPhone" "iPhone"
default: default:
return "iOS" "iOS"
} }
} }

View File

@@ -648,7 +648,16 @@ private final class CanvasA2UIActionMessageHandler: NSObject, WKScriptMessageHan
// Token-efficient and unambiguous. The agent should treat this as a UI event and (by default) update Canvas. // Token-efficient and unambiguous. The agent should treat this as a UI event and (by default) update Canvas.
let text = let text =
"CANVAS_A2UI action=\(Self.sanitizeTagValue(name)) session=\(Self.sanitizeTagValue(self.sessionKey)) surface=\(Self.sanitizeTagValue(surfaceId)) component=\(Self.sanitizeTagValue(sourceComponentId)) host=\(host) instance=\(instanceId)\(contextSuffix) default=update_canvas" [
"CANVAS_A2UI",
"action=\(Self.sanitizeTagValue(name))",
"session=\(Self.sanitizeTagValue(self.sessionKey))",
"surface=\(Self.sanitizeTagValue(surfaceId))",
"component=\(Self.sanitizeTagValue(sourceComponentId))",
"host=\(host)",
"instance=\(instanceId)\(contextSuffix)",
"default=update_canvas",
].joined(separator: " ")
Task { [weak webView] in Task { [weak webView] in
if AppStateStore.shared.connectionMode == .local { if AppStateStore.shared.connectionMode == .local {

View File

@@ -66,4 +66,3 @@ public struct ClawdisChatSessionsListResponse: Codable, Sendable {
public let defaults: ClawdisChatSessionsDefaults? public let defaults: ClawdisChatSessionsDefaults?
public let sessions: [ClawdisChatSessionEntry] public let sessions: [ClawdisChatSessionEntry]
} }

View File

@@ -18,7 +18,9 @@ struct ChatSessionsSheet: View {
.font(.system(.body, design: .monospaced)) .font(.system(.body, design: .monospaced))
.lineLimit(1) .lineLimit(1)
if let updatedAt = session.updatedAt, updatedAt > 0 { if let updatedAt = session.updatedAt, updatedAt > 0 {
Text(Date(timeIntervalSince1970: updatedAt / 1000).formatted(date: .abbreviated, time: .shortened)) Text(Date(timeIntervalSince1970: updatedAt / 1000).formatted(
date: .abbreviated,
time: .shortened))
.font(.caption) .font(.caption)
.foregroundStyle(.secondary) .foregroundStyle(.secondary)
} }

View File

@@ -45,7 +45,8 @@ public final class ClawdisChatViewModel {
private var pendingToolCallsById: [String: ClawdisChatPendingToolCall] = [:] { private var pendingToolCallsById: [String: ClawdisChatPendingToolCall] = [:] {
didSet { didSet {
self.pendingToolCalls = self.pendingToolCallsById.values.sorted { ($0.startedAt ?? 0) < ($1.startedAt ?? 0) } self.pendingToolCalls = self.pendingToolCallsById.values
.sorted { ($0.startedAt ?? 0) < ($1.startedAt ?? 0) }
} }
} }