Skip to content
This repository was archived by the owner on Jul 28, 2022. It is now read-only.

Conversation

@tootsweet
Copy link

No description provided.

Copy link
Contributor

@Minishlink Minishlink left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution! :) Can you review my comments?

@@ -1,16 +1,16 @@
{
"name": "react-native-batch-push",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you revert this?

Copy link
Author

Choose a reason for hiding this comment

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

Sure


@ReactMethod
public void lastKnownPushToken(Promise promise) {
try{
Copy link
Contributor

Choose a reason for hiding this comment

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

Why catching an error on Android but not on iOS?

```

### Last known push token

Copy link
Contributor

@Minishlink Minishlink Feb 3, 2019

Choose a reason for hiding this comment

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

Please add a warning that this should only be used for debugging - the correct way in production would be to use a listener

Copy link
Author

Choose a reason for hiding this comment

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

It is my understanding that Batch already implements a listener and stores the push token when it changes. Why add one more listener on top of that?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm only referencing what states in the doc :) It looks like we shouldn't rely too much on this value.

This method will return null if no registration identifier has been fetched or if Batch isn't started, meaning that you have to call this method after Batch.onStart(). It is useful if you want to show the token in your UI, for example in a debug view.

Copy link
Contributor

Choose a reason for hiding this comment

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

This (annoying) limitation is exactly why we introduced the listener down the road: users had to work around the token not being available with something like setTimeout.

The listener also gives you the token provider (GCM/FCM, and possibly more in the future)

My 2cts is that both can be used: they're not meant for the same use cases.

@yleflour yleflour closed this Mar 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

4 participants