-
-
Notifications
You must be signed in to change notification settings - Fork 735
Push handling cleanup #732
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
Codecov Report
@@ Coverage Diff @@
## master #732 +/- ##
============================================
+ Coverage 52.98% 53.42% +0.43%
- Complexity 1730 1745 +15
============================================
Files 132 131 -1
Lines 10261 10258 -3
Branches 1433 1435 +2
============================================
+ Hits 5437 5480 +43
+ Misses 4375 4325 -50
- Partials 449 453 +4
Continue to review full report at Codecov.
|
@@ -173,14 +167,14 @@ private static boolean usesPushBroadcastReceivers() { | |||
intentsRegistered++; | |||
} | |||
|
|||
if (intentsRegistered != 0 && intentsRegistered != NUMBER_OF_PUSH_INTENTS) { | |||
if (intentsRegistered != 0 && intentsRegistered != 3) { |
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.
why delete this constant?
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 had my brain in cleanup mode :) and this looked already clear from the method implementation to me. I can add again.
I can also add some tests to the patch but first wanted to know if there's consensus over this being merged
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.
PR works for me. It looks like you removed PPNS while also refactoring to a PushHandler interface with an eye towards allowing the FCM handler? The only thing is that FCM/GCM shouldn't co-exist so we may need to move hasAnyGcmSpecificDeclaration() out too as part of the interface? (canHandlePush?)
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.
That sounds good! I will do it. In the future we might even make the handler public so people can provide their adapters like parse server.
By the way, is parse-server ready to send FCM-like messages? AFAIK currently the handlers here need to update the ParseInstallation pushType
to tell parse server adapter how to send the push. What happens when we start setting pushType = 'fcm'
?
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.
Yeah parse server may need to be upgraded. But the push tokens should be interoperable so hopefully the changes are minimal.
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.
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 do think that the deviceType (
String deviceType = "android"; |
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.
The actual send implementation is still GCM based though? https://github.com/parse-server-modules/parse-server-push-adapter/blob/master/src/GCM.js I don't know if that's a problem and how we should manage
This got bigger than I expected but seems solid to me. Makes it easy to fix #729 (I hope), and to add FCM (I hope). I was very tempted to rip out PushRouter and PushHistory but resisted, though I'm not 100% sure they are still useful. I hope this can be done in the future. I also think we could add I also think we could add |
Thanks for doing this! |
Following #729 , this does not solve the issue but makes it easier to think of a fix, and also introduce FCM in the future.
To fix 729 I would probably act on ServiceUtils to launch PushService either as a Service or as a job depending on API level