Skip to content

Prove of concept to store the push notifications token #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2018

Conversation

mllocs
Copy link
Contributor

@mllocs mllocs commented Feb 20, 2018

Here there's a Proof of Concept of storing the Expo device token in our backend. For that, we execute the TimeOverflowRegisterExpoDeviceToken library in the WebView when the user is Logged In. For that we use the injectJavascript method which allows you to inject JS in the WebView.

Related:
coopdevs/timeoverflow#329
https://github.com/coopdevs/timeoverflow/pull/329/files#diff-c1bb3091d6fc642a5ea8502be0ef07feR1


// Get the token that uniquely identifies this device
let token = await Notifications.getExpoPushTokenAsync();

console.log('user token', token);
cb(token);

Choose a reason for hiding this comment

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

No need for callback, you can return the token and await registerForPushNotificationsAsync() when consuming this function.

@mllocs mllocs force-pushed the feature/push-token-storing branch from e803d29 to 03e3a7c Compare February 23, 2018 23:02
this.runRemoteTokenStoring(token);
}

onNavigationStateChange({ url }) {

Choose a reason for hiding this comment

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

You can do the following, to avoid binding to this on the render method. It's magic.

-  onNavigationStateChange({ url }) { 
+ onNavigationStateChange = ({url}) => {
+ ...
+ }

Copy link
Collaborator

Choose a reason for hiding this comment

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

wat?! can you explain that? I'm just a poor rubyist trying to understand this...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

haha, maybe the current syntax is more accessible then :P

Copy link
Collaborator

Choose a reason for hiding this comment

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

I shouldn't be the one taken as example :trollface:

@mllocs mllocs merged commit f130804 into master Mar 9, 2018
@mllocs mllocs deleted the feature/push-token-storing branch March 9, 2018 16:30
sauloperez added a commit to sauloperez/my-app that referenced this pull request Aug 28, 2022
sauloperez added a commit that referenced this pull request Oct 1, 2022
Note this also stores the device token in the backend. This ports
#1.
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.

4 participants