From 06026530dddd71459273e419e56c20cd989330ce Mon Sep 17 00:00:00 2001 From: qzl Date: Fri, 20 Mar 2026 18:43:53 +0800 Subject: [PATCH] feat(ios): store notification payload in UserDefaults on tap --- apps/ios/Runner/AppDelegate.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apps/ios/Runner/AppDelegate.swift b/apps/ios/Runner/AppDelegate.swift index 1e8d67e..c4bd777 100644 --- a/apps/ios/Runner/AppDelegate.swift +++ b/apps/ios/Runner/AppDelegate.swift @@ -18,4 +18,18 @@ import UserNotifications } return super.application(application, didFinishLaunchingWithOptions: launchOptions) } + + @available(iOS 10.0, *) + 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() + } }