@@ -2,6 +2,7 @@ package com.plottwist.core.push
22
33import android.app.PendingIntent
44import android.content.Intent
5+ import com.google.firebase.messaging.Constants
56import com.google.firebase.messaging.FirebaseMessagingService
67import com.google.firebase.messaging.RemoteMessage
78import com.plottwist.core.notification.TukNotificationManager
@@ -15,20 +16,16 @@ class TukFirebaseMessagingService : FirebaseMessagingService() {
1516 @Inject
1617 lateinit var tukNotificationManager: TukNotificationManager
1718
18-
1919 override fun onNewToken (token : String ) {
2020 super .onNewToken(token)
2121 }
2222
2323 override fun onMessageReceived (message : RemoteMessage ) {
2424 super .onMessageReceived(message)
25-
26- message.notification?.let { notificationMessage ->
27- val title = notificationMessage.title ? : TukNotificationManager .DEFAULT_TITLE
28- val description = notificationMessage.body ? : TukNotificationManager .DEFAULT_DESCRIPTION
29- val deeplink = message.data.get(" deepLink" ) ? : " "
30- sendNotification(title, description, deeplink)
31- }
25+ val title = message.data.get(" title" ) ? : " "
26+ val description = message.data.get(" body" ) ? : " "
27+ val deeplink = message.data.get(" deepLink" ) ? : " "
28+ sendNotification(title, description, deeplink)
3229 }
3330
3431 private fun sendNotification (title : String , description : String , deeplink : String ) {
@@ -52,4 +49,17 @@ class TukFirebaseMessagingService : FirebaseMessagingService() {
5249 )
5350 )
5451 }
52+
53+
54+ override fun handleIntent (intent : Intent ? ) {
55+ val newIntent = intent?.apply {
56+ val newExtras = extras?.apply {
57+ remove(Constants .MessageNotificationKeys .ENABLE_NOTIFICATION )
58+ remove(" gcm.notification.e" )
59+ }
60+ replaceExtras(newExtras)
61+ }
62+ super .handleIntent(newIntent)
63+
64+ }
5565}
0 commit comments