feat(ios): store notification payload in UserDefaults on tap
This commit is contained in:
@@ -18,4 +18,18 @@ import UserNotifications
|
|||||||
}
|
}
|
||||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user