diff --git a/NucleicRemote/NucleicRemote/Models/RemoteStore.swift b/NucleicRemote/NucleicRemote/Models/RemoteStore.swift index 9bd57b2..f7fe423 100644 --- a/NucleicRemote/NucleicRemote/Models/RemoteStore.swift +++ b/NucleicRemote/NucleicRemote/Models/RemoteStore.swift @@ -1297,7 +1297,13 @@ final class RemoteStore: ObservableObject { /// Host ids that already have the current push-to-start token (mirrors `liveActivitySentTo`). private var pushToStartSentTo: Set = [] + /// Guards `setupLiveActivityBridge` — it's called from both `onAppear` and the background adopt + /// wake, and installing the callbacks / observers once is enough. + private var liveActivityBridgeSetup = false + private func setupLiveActivityBridge() { + guard !liveActivityBridgeSetup else { return } + liveActivityBridgeSetup = true LiveActivityManager.shared.onPushToken = { [weak self] token, activityID in guard let self, self.liveActivityReg?.token != token else { return } self.liveActivityReg = (token, activityID)