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) + } + } }