Skip to content

Commit 5ea05e2

Browse files
committed
watch: fix compilation errors — body naming conflict, WKApplication, accessibility traits, nonisolated key, remove unused dep
1 parent e71fcd4 commit 5ea05e2

File tree

9 files changed

+27
-14
lines changed

9 files changed

+27
-14
lines changed

apps/ios/WatchApp/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
<string>2026.2.27</string>
2121
<key>CFBundleVersion</key>
2222
<string>20260227</string>
23+
<key>WKApplication</key>
24+
<true/>
2325
<key>WKCompanionAppBundleIdentifier</key>
2426
<string>$(OPENCLAW_APP_BUNDLE_ID)</string>
2527
</dict>

apps/ios/WatchApp/Sources/OpenClawWatchApp.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ struct OpenClawWatchApp: App {
1919
}
2020
.navigationTitle("OpenClaw")
2121
}
22-
.toolbarStyle(.glass)
2322
.onOpenURL { _ in
2423
// Widget taps open openclaw://watch/inbox — the app already shows the
2524
// inbox as the root view, so no navigation is needed.

apps/ios/WatchApp/Sources/WatchConnectionBanner.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct WatchConnectionBanner: View {
3737
.transition(.opacity)
3838
.accessibilityElement(children: .combine)
3939
.accessibilityLabel(label)
40-
.accessibilityAddTraits(.isStatusElement)
40+
.accessibilityAddTraits(.updatesFrequently)
4141
}
4242
}
4343
.onChange(of: isConnected) { _, connected in

apps/ios/WatchApp/Sources/WatchHomeView.swift

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ struct WatchHomeView: View {
5252
private var messageContent: some View {
5353
WatchMessageCard(
5454
title: store.title,
55-
body: store.body,
55+
message: store.body,
5656
details: store.details,
5757
risk: store.risk,
5858
isExpired: store.isExpired)
@@ -78,7 +78,20 @@ struct WatchHomeView: View {
7878

7979
@ViewBuilder
8080
private var actionButtons: some View {
81-
ForEach(Array(store.actions.enumerated()), id: \.element.id) { index, action in
81+
// First action gets Double Tap gesture shortcut
82+
if let first = store.actions.first {
83+
WatchActionButton(
84+
label: first.label,
85+
role: role(for: first),
86+
isLoading: store.isReplySending,
87+
isDisabled: store.isExpired)
88+
{
89+
onAction?(first)
90+
}
91+
.handGestureShortcut(.primaryAction)
92+
}
93+
94+
ForEach(store.actions.dropFirst()) { action in
8295
WatchActionButton(
8396
label: action.label,
8497
role: role(for: action),
@@ -87,8 +100,6 @@ struct WatchHomeView: View {
87100
{
88101
onAction?(action)
89102
}
90-
// Double Tap gesture triggers the first action button
91-
.handGestureShortcut(index == 0 ? .primaryAction : .never)
92103
}
93104
}
94105
}

apps/ios/WatchApp/Sources/WatchInboxStore.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct WatchNotifyMessage: Sendable {
4141
var replyStatusAt: Date?
4242
}
4343

44-
static let persistedStateKey = "watch.inbox.state.v1"
44+
nonisolated static let persistedStateKey = "watch.inbox.state.v1"
4545
private let defaults: UserDefaults
4646

4747
var title = "OpenClaw"

apps/ios/WatchApp/Sources/WatchMessageCard.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import SwiftUI
22

33
struct WatchMessageCard: View {
44
let title: String
5-
let body: String
5+
let message: String
66
var details: String?
77
var risk: String?
88
var isExpired: Bool = false
@@ -15,7 +15,7 @@ struct WatchMessageCard: View {
1515
parts.append("\(risk) risk")
1616
}
1717
parts.append(title)
18-
parts.append(body)
18+
parts.append(message)
1919
if let details, !details.isEmpty {
2020
parts.append(details)
2121
}
@@ -35,7 +35,7 @@ struct WatchMessageCard: View {
3535
.font(WatchDesignTokens.fontTitle)
3636
.lineLimit(2)
3737

38-
Text(self.body)
38+
Text(message)
3939
.font(WatchDesignTokens.fontBody)
4040
.fixedSize(horizontal: false, vertical: true)
4141

apps/ios/WatchApp/Sources/WatchPreviews.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,20 @@ import SwiftUI
3333
#Preview("Card: Normal") {
3434
WatchMessageCard(
3535
title: "Daily Summary",
36-
body: "3 tasks completed, 1 pending review.")
36+
message: "3 tasks completed, 1 pending review.")
3737
}
3838

3939
#Preview("Card: High Risk") {
4040
WatchMessageCard(
4141
title: "Deploy to Production",
42-
body: "Merge main into release branch and trigger CI pipeline.",
42+
message: "Merge main into release branch and trigger CI pipeline.",
4343
risk: "high")
4444
}
4545

4646
#Preview("Card: Expired") {
4747
WatchMessageCard(
4848
title: "Session Token Refresh",
49-
body: "Token expired 5 minutes ago.",
49+
message: "Token expired 5 minutes ago.",
5050
details: "Session: abc-123",
5151
isExpired: true)
5252
}

apps/ios/WatchApp/Tests/WatchConnectivityReceiverTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Foundation
12
import Testing
23

34
@testable import OpenClawWatch

apps/ios/project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ targets:
177177
excludes:
178178
- Tests/**
179179
dependencies:
180-
- package: OpenClawKit
181180
- sdk: WatchConnectivity.framework
182181
- sdk: UserNotifications.framework
183182
- sdk: WidgetKit.framework
@@ -204,6 +203,7 @@ targets:
204203
CFBundleDisplayName: OpenClaw
205204
CFBundleShortVersionString: "2026.2.27"
206205
CFBundleVersion: "20260227"
206+
WKApplication: true
207207
WKCompanionAppBundleIdentifier: "$(OPENCLAW_APP_BUNDLE_ID)"
208208

209209
OpenClawTests:

0 commit comments

Comments
 (0)