fix(dm): FCM deep_link payload 알림 생성을 보정한다

This commit is contained in:
2026-06-19 05:03:14 +09:00
parent 8b515bba97
commit 9c642fb3b7
2 changed files with 27 additions and 6 deletions

View File

@@ -31,6 +31,8 @@ class SodaFirebaseMessagingService : FirebaseMessagingService() {
remoteMessage.notification != null
) {
sendNotification(remoteMessage.data, remoteMessage.notification)
} else if (hasDeepLink(remoteMessage.data)) {
sendNotification(remoteMessage.data, remoteMessage.notification)
} else if (remoteMessage.data["message"]?.isNotBlank() == true) {
sendNotification(remoteMessage.data, remoteMessage.notification)
}
@@ -43,6 +45,11 @@ class SodaFirebaseMessagingService : FirebaseMessagingService() {
SharedPreferenceManager.pushToken = token
}
private fun hasDeepLink(messageData: Map<String, String>): Boolean {
return messageData["deepLink"]?.isNotBlank() == true ||
messageData["deep_link"]?.isNotBlank() == true
}
private fun sendNotification(
messageData: Map<String, String>,
notification: RemoteMessage.Notification?
@@ -78,13 +85,11 @@ class SodaFirebaseMessagingService : FirebaseMessagingService() {
val deepLinkExtras = if (!deepLinkUrl.isNullOrBlank()) {
android.os.Bundle().apply {
putString("deep_link", deepLinkUrl)
messageData["chat_type"]?.let { putString("chat_type", it) }
messageData["room_id"]?.let { putString("room_id", it) }
}
} else {
android.os.Bundle().apply {
messageData["room_id"]?.let { putString("room_id", it) }
messageData["chat_type"]?.let { putString("chat_type", it) }
messageData["message_id"]?.let { putString("message_id", it) }
messageData["content_id"]?.let { putString("content_id", it) }
messageData["channel_id"]?.let { putString("channel_id", it) }