From 5d818f061f1152800476ed3e533c211332736925 Mon Sep 17 00:00:00 2001 From: Andrew Blakeslee Moore Date: Mon, 6 Jul 2026 13:44:49 -0700 Subject: [PATCH] Launch Activity Logic Nucleic-Session: EBB24271-3AB2-4CBD-A47A-59FC73500371 Co-authored-by: Nucleic --- .../NucleicRemote/Models/RemoteStore.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/NucleicRemote/NucleicRemote/Models/RemoteStore.swift b/NucleicRemote/NucleicRemote/Models/RemoteStore.swift index aa0093b..50f56b4 100644 --- a/NucleicRemote/NucleicRemote/Models/RemoteStore.swift +++ b/NucleicRemote/NucleicRemote/Models/RemoteStore.swift @@ -1251,6 +1251,21 @@ final class RemoteStore: ObservableObject { } } + /// Send the current push-to-start token to every live, capable host that hasn't got it yet — the + /// mirror of `syncLiveActivityRegistration` for the device-scoped token that lets a host create + /// the glance over APNs when work starts before the app is opened (iOS 17.2+). + private func syncPushToStartRegistration() { + guard let token = pushToStartToken else { return } + // A host that dropped should re-register when it returns. + pushToStartSentTo = pushToStartSentTo.filter { connections[$0]?.connectivity.isLive == true } + for (id, conn) in connections { + guard conn.connectivity.isLive, conn.capabilities.canPushLiveActivity, + !pushToStartSentTo.contains(id) else { continue } + conn.send(.registerPushToStartToken(token)) + pushToStartSentTo.insert(id) + } + } + // MARK: - Demo simulator (offline, interactive) // // In demo mode there's no host, so writes can't go over the wire. Instead they mutate the