-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Add IOSMessaging module for APNS specific methods #1626
Conversation
I will add the doc if this passed the initial review. |
Codecov Report
@@ Coverage Diff @@
## master #1626 +/- ##
=======================================
Coverage 70.99% 70.99%
=======================================
Files 71 71
Lines 1834 1834
=======================================
Hits 1302 1302
Misses 532 532 |
@@ -64,6 +64,11 @@ public void requestPermission(Promise promise) { | |||
promise.resolve(null); | |||
} | |||
|
|||
@ReactMethod | |||
public void registerForRemoteNotifications(Promise promise) { |
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.
We can remove this and add an if (isAndroid) return;
line in the JS method, native code changes not required then 👍
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.
Thanks for sending this over, just a couple of small things on the review, thanks
src/modules/messaging/index.js
Outdated
@@ -137,6 +137,10 @@ export default class Messaging extends ModuleBase { | |||
return getNativeModule(this).hasPermission(); | |||
} | |||
|
|||
registerForRemoteNotifications(): Promise<void> { |
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.
Could we namespace this under ios? It's good to keep platform-specific methods outside of the main cross-platform methods.
e.g. this becomes firebase.messaging().ios.registerForRemoteNotifications()
@timwangdev this is great, thanks for updating. Would you be able to send a docs PR over also (on master branch) please; You can add a properties and iOS section on here: https://github.com/invertase/react-native-firebase-docs/blob/master/docs/messaging/reference/Messaging.md You can add a new IOSMessaging.md file here: https://github.com/invertase/react-native-firebase-docs/tree/master/docs/messaging/reference and then add it to the menu here after this line: https://github.com/invertase/react-native-firebase-docs/blob/master/docs/_sidebar.yaml#L203 You have collab rights on the docs repo so you can create a branch and do it on the online GH editor if you wish, see https://github.com/invertase/react-native-firebase/blob/master/CONTRIBUTING.md#our-expectations-on-you-as-a-contributor You can change swap out the version in the URL for the docs site to your branch name to preview, e.g. |
Added doc at invertase/react-native-firebase-docs#137 |
@timwangdev thanks for sorting the docs, and this PR, nice 👍 will merge now 🎉 |
Summary
Fixes #1511
The user should have the freedom when to call the registerForRemoteNotifications from application instance as described in firebase doc https://firebase.google.com/docs/cloud-messaging/ios/client#register_for_remote_notifications
And expose APNS token is very handy for debugging device token sync issue in iOS. This is not a standard firebase method.
Checklist
Android
iOS
e2e
tests added or updated in /tests/e2e/*Test Plan
N/A
Release Plan
[IOS] [FEATURE] [MESSAGING] - Add IOSMessaging module for APNS specific methods.
Think
react-native-firebase
is great? Please consider supporting the project with any of the below:React Native Firebase
andInvertase
on Twitter