Push Notification Live Activity Redundancy

Nucleic-Session: 73687ED9-C11C-438C-832B-979332B73893
Co-authored-by: Nucleic <[email protected]>
This commit is contained in:
2026-07-06 21:34:20 -07:00
co-authored by Nucleic
parent 890399e486
commit 5535152810
@@ -698,9 +698,16 @@ final class RemoteStore: ObservableObject {
!self.openApprovals.contains(where: { $0.id == req.id }) {
self.openApprovals.append(req)
}
// Post for any host; the router suppresses the banner if the user is on this session.
// Prefer the Live Activity: when backgrounded with a glance on screen, the glance itself
// carries the approval (its inline Allow/Deny) and alerts (sound/haptic) via the local
// update path — so don't also post a banner. In-app the glance isn't the surface (it
// doesn't show over the app that controls it), so the banner is; and if there's no glance
// at all (Live Activities off) the banner is the only surface, so keep it as the fallback.
// willPresent still suppresses the banner when the user is already on this session.
if isForeground || !LiveActivityManager.shared.hasLiveActivity {
NotificationRouter.shared.postApproval(req, sessionTitle: title)
}
}
cb.approvalResolved = { [weak self] resolved in
guard let self else { return }
self.openApprovals.removeAll { $0.id == resolved.id }