leegeunhyeok/react-native-zendesk-messaging

iOS: Update Push Notification Token

Closed this issue · 2 comments

Describe the bug
I noticed that the updatePushNotificationToken method is a no-op for non-Android devices.

I'm curious why this us since I see the method defined in the ios/ZendeskNativeModule.swift.

updatePushNotificationToken method is for integrate with third-part push notification libraries (eg. @react-native-firebase/messaging). (currently, support Android only)

Zendesk messaging SDK uses FCM token on Android, APNs token on iOS for notifications
FCM token is string type, but APNs device token isn't (NSData).

In iOS React Native native bridge, NSData type is not supported (docs).
This means the serialization required(eg. NSData to NSString or reverse) before communicating with the native and JS sides.

This is why updatePushNotificationToken don't supported on iOS and need to setup in native.

In ZendeskNativeModule.swift, updatePushNotificationToken method already implemented but it is for use in native (AppDelegate)

In additional, there are a few ways to get the APNs token from JS via library,

These libraries also serialize token in native code.

Need to implement serialization for using updatePushNotificationToken in iOS, but is not planned yet.

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.