b8ne / react-native-pusher-push-notifications

Manage pusher interest subscriptions and notification events in Javascript.
MIT License
97 stars 85 forks source link

Adds support for personal push notifications to Authenticated Users #44

Closed giaset closed 4 years ago

giaset commented 5 years ago

As of February 2019, Pusher Beams supports delivering personal push notifications to authenticated users (announcement here: https://blog.pusher.com/authenticated-users-pusher-beams/).

To do so, you need to identify users using the setUserId method on the PushNotification singleton -- we've gone ahead and implemented this call for both Android and iOS.

RCT_EXPORT_METHOD doesn't support passing a TokenProvider object from JS to native code, so we fetch the Beams token (string) in our React code and pass it to the native method. The native method then creates a LocalTokenProvider that implements Pusher's TokenProvider protocol and simply returns the stored token.

enterteg commented 4 years ago

Is there any chance it will be merged in near future?

EDIT: One thing I noticed that this PR does not include clearAllState method which is being used when user logs out - https://pusher.com/docs/beams/guides/publish-to-specific-user#deauthenticating-when-a-user-logs-out

Any chance it will be added here as well?

stephenkiers commented 4 years ago

I have integrated this one into #48; added clearAllState as well. :)

b8ne commented 4 years ago

Appreciate everyones work here and apologies again for not being able to reasonably maintain this repo. @stephenkiers now that #48 is merged can you confirm that this PR is not needed?

stephenkiers commented 4 years ago

Yes, it has been a while, but I am very sure that this functionality is in master already now. @adelowo do you want to confirm? I'd say close this PR and re-open if @adelowo says I implemented incorrectly.

thanks

arochedy commented 3 years ago

Hi,

Thank you for this PR. I have a question : Is it any way of generate a beams token in the app ? We juste need instance Id et private key. I tried to install the node library but it look it doesn't work.

Thank you