diff --git a/apps/ios/Runner/AppDelegate.swift b/apps/ios/Runner/AppDelegate.swift index 1e8d67e..5c3053e 100644 --- a/apps/ios/Runner/AppDelegate.swift +++ b/apps/ios/Runner/AppDelegate.swift @@ -18,4 +18,17 @@ import UserNotifications } return super.application(application, didFinishLaunchingWithOptions: launchOptions) } + + override func userNotificationCenter( + _ center: UNUserNotificationCenter, + didReceive response: UNNotificationResponse, + withCompletionHandler completionHandler: @escaping () -> Void + ) { + let userInfo = response.notification.request.content.userInfo + if let jsonData = try? JSONSerialization.data(withJSONObject: userInfo, options: []), + let jsonString = String(data: jsonData, encoding: .utf8) { + UserDefaults.standard.set(jsonString, forKey: "pending_notification_payload") + } + completionHandler() + } }