Watch: treat an empty threadId in a push as no thread

The gateway sends threadId "" on host notifications; tapping one now opens
the feed instead of a thread that does not exist.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
gibandClaude Opus 5.5 committed 2026-11-01 02:35:58 -05:00
1 parent 9731fd621f
commit 7ad1045be4
2 files changed
+9 -3

No files matched your search

@@ -20,9 +20,13 @@ enum NotificationCommand: Equatable, Sendable {
/// `userInfo` holds the custom keys `hostId`, `threadId` and, for approvals, `requestId`.
init(actionIdentifier: String, userInfo: [AnyHashable: Any], text: String?) {
let hostId = userInfo["hostId"] as? String
let threadId = userInfo["threadId"] as? String
let requestId = userInfo["requestId"] as? String
// The gateway sends `threadId: ""` on host notifications, so empty means absent.
func value(_ key: String) -> String? {
(userInfo[key] as? String).flatMap { $0.isEmpty ? nil : $0 }
}
let hostId = value("hostId")
let threadId = value("threadId")
let requestId = value("requestId")
let thread: Route? = if let hostId, let threadId { .thread(hostId: hostId, threadId: threadId) } else { nil }
switch actionIdentifier {