fix: suppress stale push notifications for active chats
fix: clear existing chat notifications when FCM arrives for an already open conversation
This commit is contained in:
@@ -23,6 +23,7 @@ class MessengerFirebaseMessagingService : FirebaseMessagingService() {
|
|||||||
override fun onMessageReceived(message: RemoteMessage) {
|
override fun onMessageReceived(message: RemoteMessage) {
|
||||||
val payload = PushPayloadParser.parse(message) ?: return
|
val payload = PushPayloadParser.parse(message) ?: return
|
||||||
if (activeChatTracker.activeChatId.value == payload.chatId) {
|
if (activeChatTracker.activeChatId.value == payload.chatId) {
|
||||||
|
notificationDispatcher.clearChatNotifications(payload.chatId)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
notificationDispatcher.showChatMessage(payload)
|
notificationDispatcher.showChatMessage(payload)
|
||||||
|
|||||||
Reference in New Issue
Block a user