-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
lib/pushNotifications.js
Outdated
|
||
// Get the token that uniquely identifies this device | ||
let token = await Notifications.getExpoPushTokenAsync(); | ||
|
||
console.log('user token', token); | ||
cb(token); |
There was a problem hiding this comment.
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.
e803d29
to
03e3a7c
Compare
this.runRemoteTokenStoring(token); | ||
} | ||
|
||
onNavigationStateChange({ url }) { |
There was a problem hiding this comment.
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}) => {
+ ...
+ }
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
Note this also stores the device token in the backend. This ports #1.
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 theinjectJavascript
method which allows you to inject JS in the WebView.Related:
coopdevs/timeoverflow#329
https://github.com/coopdevs/timeoverflow/pull/329/files#diff-c1bb3091d6fc642a5ea8502be0ef07feR1