knocklabs / javascript

Official JavaScript packages for interacting with Knock
https://knock.app/
MIT License
16 stars 3 forks source link

feat(kno-6559): add KnockPushNotificationProvider #252

Closed mattmikolay closed 1 month ago

mattmikolay commented 1 month ago

Now that #243 moved KnockExpoPushNotificationProvider to the new @knocklabs/expo package, we need to provide a way for non-Expo React Native applications to register push tokens to a channel for the current user.

This PR adds a new context provider KnockPushNotificationProvider to @knocklabs/react-native. This context provider exposes two functions, registerPushTokenToChannel and unregisterPushTokenFromChannel. These can be used to manually register/unregister push tokens retrieved from a provider such as Firebase Cloud Messaging.

Additionally, KnockExpoPushNotificationProvider has been refactored to use this new KnockPushNotificationProvider.

I tested these changes on an Android device and confirmed push notifications can still be received using the Expo sample app.

linear[bot] commented 1 month ago

KNO-6559 [React Native SDK] Ensure Expo is not a required dependency

changeset-bot[bot] commented 1 month ago

🦋 Changeset detected

Latest commit: 24eccfb249fd416cdb9782dba750fb58ac38c4d6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages | Name | Type | | ------------------------------- | ----- | | @knocklabs/react-native | Minor | | @knocklabs/expo | Minor | | @knocklabs/react-native-example | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
javascript-nextjs-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 15, 2024 9:49pm
javascript-slack-connect-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 15, 2024 9:49pm
javascript-slack-kit-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 15, 2024 9:49pm