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 }