diff --git a/NucleicRemote/NucleicRemote/LiveActivityManager.swift b/NucleicRemote/NucleicRemote/LiveActivityManager.swift index c9bde83..e34e18b 100644 --- a/NucleicRemote/NucleicRemote/LiveActivityManager.swift +++ b/NucleicRemote/NucleicRemote/LiveActivityManager.swift @@ -49,8 +49,20 @@ final class LiveActivityManager { /// is backgrounded and its sync socket is suspended (UX_IOS §5.3). var onPushToken: ((_ token: String, _ activityID: String) -> Void)? var onActivityEnded: ((_ activityID: String) -> Void)? + /// Set by `RemoteStore` to ship this device's **push-to-start** token to the paired Macs. Unlike + /// `onPushToken` (a per-activity update token that exists only once an Activity does), this token + /// is device-scoped and exists before any Activity — it's what lets a Mac *create* the glance + /// over APNs when work starts while the app is closed, so it appears without the user opening the + /// app first (iOS 17.2+, UX_IOS §5.3). + var onPushToStartToken: ((_ token: String) -> Void)? /// Streams the activity's per-activity APNS update token (it can rotate); cancelled on end. private var tokenObservation: Task? + /// Streams this device's push-to-start token (it can rotate). Device-scoped, so — unlike + /// `tokenObservation` — it lives for the whole process and is never cancelled on `end()`. + private var pushToStartObservation: Task? + /// Observes Activities that appear without us creating them — i.e. ones a Mac push-started while + /// the app was closed — so we adopt them and forward their update token. Also process-lived. + private var activityAdoptionObservation: Task? /// Reconcile the Activity with the current session set. func sync(hostName: String, sessions: [WireSessionSummary]) {