feat(ios): write notification payload to UserDefaults on tap
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user