Skip to content

Commit 81166aa

Browse files
committed
feat: enhance notification payload handling in NotificationService
- Added functionality to encode and store the full payload from the server in the userInfo dictionary under the key "ejson" for improved navigation.
1 parent 8af4d01 commit 81166aa

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ios/NotificationService/NotificationService.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ class NotificationService: UNNotificationServiceExtension {
4747
if let notification = notification {
4848
self.bestAttemptContent?.title = notification.title
4949
self.bestAttemptContent?.body = notification.text
50+
51+
// Update ejson with full payload from server for correct navigation
52+
if let payloadData = try? JSONEncoder().encode(notification.payload),
53+
let payloadString = String(data: payloadData, encoding: .utf8) {
54+
self.bestAttemptContent?.userInfo["ejson"] = payloadString
55+
}
56+
5057
self.processPayload(payload: notification.payload)
5158
} else {
5259
// Server returned no notification, deliver as-is

0 commit comments

Comments
 (0)