From 3dfd28b28dbd6cf3e006dfb0275a0d11864d9f64 Mon Sep 17 00:00:00 2001 From: Andrew Blakeslee Moore Date: Mon, 6 Jul 2026 12:53:32 -0700 Subject: [PATCH] Adjust Push Notification Logic Nucleic-Session: 0F065CD6-20FE-4941-ACF5-C57A4572A5A3 Co-authored-by: Nucleic --- NucleicRemote/NucleicRemote/PushRegistrar.swift | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/NucleicRemote/NucleicRemote/PushRegistrar.swift b/NucleicRemote/NucleicRemote/PushRegistrar.swift index e2b1b32..ceb5a73 100644 --- a/NucleicRemote/NucleicRemote/PushRegistrar.swift +++ b/NucleicRemote/NucleicRemote/PushRegistrar.swift @@ -45,4 +45,20 @@ final class PushAppDelegate: NSObject, UIApplicationDelegate { ) { // Best-effort: no token → the phone still works on LAN, just no remote wake. } + + /// Silent pushes. The relay sends a content-free `clear` (content-available) to recall the + /// "waiting for your approval" tickle once the approval is resolved on another device — we + /// wake in the background just long enough to withdraw the stale notification. Other silent + /// pushes (e.g. the wake tickle itself, which is an alert) don't route here. + func application( + _ application: UIApplication, + didReceiveRemoteNotification userInfo: [AnyHashable: Any], + fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void + ) { + guard userInfo["clear"] != nil else { completionHandler(.noData); return } + Task { @MainActor in + NotificationRouter.shared.withdrawApprovalAttention() + completionHandler(.noData) + } + } }