-
Notifications
You must be signed in to change notification settings - Fork 749
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
Use firebaseReceiver with FCM #7068
Conversation
ATM, it uses the default fallback if cancelled
The forced unregistration always happens in register function
Signed-off-by: sim <git@sgougeon.fr>
Signed-off-by: sim <git@sgougeon.fr>
Should we disable Instantiatable Lint check for vector-app module to fix the workflows ?
|
THX for your work :) I will test your changes like your Camera PR, what works amazing here ! |
Use VectorMessagingHelper to directly call onMessage
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 not really see why avoiding using android-embedded_fcm_distributor
will help to fix the issue with Push arriving to the app but not handled. Can you explain please?
Thanks
vector/src/main/java/im/vector/app/core/pushers/VectorMessagingReceiver.kt
Outdated
Show resolved
Hide resolved
vector/src/main/java/im/vector/app/core/pushers/VectorMessagingReceiver.kt
Outdated
Show resolved
Hide resolved
vector/src/gplay/java/im/vector/app/push/fcm/FirebaseReceiver.kt
Outdated
Show resolved
Hide resolved
Now FCM totally bypass UnifiedPush. There were some error with the gateway too. Also, it now always ensure FCM is retrieved (done with a merge of #6936 to add simplicity) |
Now, as soon as FirebaseReceiver.onMessageReceived is called, vectorMessagingHelper.onMessage will handle that message like it did before unifiedpush was merged |
I am testing the code and it's working fine so far. I will wait to see if I got some issue after a while. I have found a bug, this is maybe not new, but if I select NTFY several times, I can see several token on the NTFY app. I think some unregistration is missing. |
Good news, I hope no issue will pop :)
I'll check that, I think it is better to handle this in another PR later |
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.
Some remarks. The code readability could be improved by doing some renaming.
Still testing it on my side. Thanks!
import javax.inject.Inject | ||
|
||
@AndroidEntryPoint | ||
class FirebaseReceiver : FirebaseMessagingService() { |
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.
Maybe rename to VectorFirebaseMessagingService
.
private val loggerTag = LoggerTag("Push", LoggerTag.SYNC) | ||
|
||
/** | ||
* Hilt injection happen at super.onReceive(). |
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.
This comment has to be updated.
* Hilt injection happen at super.onReceive(). | ||
*/ | ||
|
||
class VectorMessagingHelper @Inject constructor( |
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.
This class will take care of Push received by one of our Push receivers. Maybe rename to VectorPushHandler
?
* | ||
* @param message the message | ||
*/ | ||
fun onMessage(message: String) { |
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.
This could be defined in an interface with this single method.
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 am not sure how to handle the injections with the interface.
} | ||
|
||
val pushData = pushParser.parseData(message, unifiedPushHelper.isEmbeddedDistributor()) | ||
?: return Unit.also { Timber.tag(loggerTag.value).w("Invalid received data Json format") } |
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 would move the parsing of the data to the Push receiver, since the model is different depending on the Push solution. So the the parsing can take place in FirebaseReceiver
and VectorMessagingReceiver
. So onMessage
argument can be of type PushData
, and the fun onMessage
could be rename to handle
@@ -57,27 +39,16 @@ private val loggerTag = LoggerTag("Push", LoggerTag.SYNC) | |||
*/ | |||
@AndroidEntryPoint | |||
class VectorMessagingReceiver : MessagingReceiver() { |
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.
Maybe for code clarity rename to VectorUnifiedPushMessagingReceiver
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 the update.
My test is still running, I have in parallel the nightly build and the build from this PR, using the same big account, and for now I get Push working on both app.
For the DI of VectorPushHandler
I can handle it later.
vector/src/main/java/im/vector/app/core/pushers/VectorUnifiedPushMessagingReceiver.kt
Show resolved
Hide resolved
vector/src/gplay/java/im/vector/app/push/fcm/VectorFirebaseMessagingService.kt
Show resolved
Hide resolved
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 the update with Logs.
After a night, I can see that the nightly build are not receiving push (or they have no effect), and the version from this PR is still receiving it, notification are showing up.
I am going to merge the PR for the coming release.
(I will merge on a branch I own to do some cleanup) |
Just made a symbolic donation on liberapay for your work on unified push :) |
We do not use `android-embedded_fcm_distributor` anymore (since #7068). The code was compiling this `android-embedded_fcm_distributor` has a dependency on `firebase-messaging`.
We do not use `android-embedded_fcm_distributor` anymore (since #7068). The code was compiling because `android-embedded_fcm_distributor` has a dependency on `firebase-messaging`.
Type of change
Content
Use Firebase-Messaging instead of embedded_fcm_distributor hen using FCM.
Motivation and context
There are issues with notifications with FCM
Screenshots / GIFs
Tests
Tested devices
Checklist