From 93003404759aab0cb41e8c9e64ee355829596ef6 Mon Sep 17 00:00:00 2001 From: Andrew Blakeslee Moore Date: Mon, 6 Jul 2026 21:33:38 -0700 Subject: [PATCH] Push Notification Live Activity Redundancy Nucleic-Session: 73687ED9-C11C-438C-832B-979332B73893 Co-authored-by: Nucleic --- NucleicRemote/NucleicRemote/LiveActivityManager.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/NucleicRemote/NucleicRemote/LiveActivityManager.swift b/NucleicRemote/NucleicRemote/LiveActivityManager.swift index 194eacf..224257e 100644 --- a/NucleicRemote/NucleicRemote/LiveActivityManager.swift +++ b/NucleicRemote/NucleicRemote/LiveActivityManager.swift @@ -293,14 +293,20 @@ final class LiveActivityManager { } /// Hand the newest state to the serial drainer (starting it if idle). - private func enqueue(_ state: NucleicSessionAttributes.ContentState) { + private func enqueue( + _ state: NucleicSessionAttributes.ContentState, alert: AlertConfiguration? = nil + ) { pendingState = state + if let alert { pendingAlert = alert } // latch — a coalesced-away update must not drop it guard updateTask == nil else { return } // the running drainer will pick this up updateTask = Task { @MainActor [weak self] in guard let self else { return } while let next = self.pendingState { self.pendingState = nil - await self.activity?.update(ActivityContent(state: next, staleDate: nil)) + let alert = self.pendingAlert + self.pendingAlert = nil + await self.activity?.update( + ActivityContent(state: next, staleDate: nil), alertConfiguration: alert) } self.updateTask = nil }