Skip to content

Commit fa3bf03

Browse files
committed
백그라운드에서 푸시 알림 클릭 시 딥링크 이동이 되지 않는 이슈 수정
1 parent 6d3c144 commit fa3bf03

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

core/push/src/main/java/com/plottwist/core/push/TukFirebaseMessagingService.kt

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.plottwist.core.push
22

33
import android.app.PendingIntent
44
import android.content.Intent
5+
import com.google.firebase.messaging.Constants
56
import com.google.firebase.messaging.FirebaseMessagingService
67
import com.google.firebase.messaging.RemoteMessage
78
import 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

Comments
 (0)