Skip to content

feat(kno-6559): add KnockPushNotificationProvider - #252

Merged
mattmikolay merged 32 commits into
mainfrom
mattmik-generic-rn-push-provider
Oct 16, 2024
Merged

mattmikolay merged 32 commits into
mainfrom
mattmik-generic-rn-push-provider

Conversation

@mattmikolay

@mattmikolay mattmikolay commented Oct 15, 2024 •

Copy link
Copy Markdown
Contributor

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

linear Bot commented Oct 15, 2024

Copy link
Copy Markdown

@changeset-bot

changeset-bot Bot commented Oct 15, 2024 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 24eccfb

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

vercel Bot commented Oct 15, 2024 •

Copy link
Copy Markdown

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

children?: React.ReactElement;
}

export const KnockPushNotificationProvider: React.FC<

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what it’s worth, this KnockPushNotificationProvider does not use any APIs specific to React Native. Alternatively, we could add this to @knocklabs/react-core.

@knocklabs/react-native already re-exports everything from @knocklabs/react-core, so it would still be available for use via our React Native SDK:

export * from "@knocklabs/react-core";

@cjbell cjbell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@mattmikolay
mattmikolay merged commit 4ac1e67 into main Oct 16, 2024
@mattmikolay
mattmikolay deleted the mattmik-generic-rn-push-provider branch October 16, 2024 13:37

This branch was successfully deployed

3 active deployments
Preview – javascript-slack-connect-example — 24eccfb2 Deployed Oct 15, 2024 by vercel[bot]
Preview – javascript-slack-kit-example — 24eccfb2 Deployed Oct 15, 2024 by vercel[bot]
Preview – javascript-nextjs-example — 24eccfb2 Deployed Oct 15, 2024 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants