fcm - ios 일 경우 notification 추가
This commit is contained in:
parent
3ad2256a66
commit
1d217b9f75
|
@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.fcm
|
|||
|
||||
import com.google.firebase.messaging.FirebaseMessaging
|
||||
import com.google.firebase.messaging.MulticastMessage
|
||||
import com.google.firebase.messaging.Notification
|
||||
import org.springframework.scheduling.annotation.Async
|
||||
import org.springframework.stereotype.Service
|
||||
|
||||
|
@ -18,10 +19,22 @@ class FcmService {
|
|||
contentId: Long? = null
|
||||
) {
|
||||
val multicastMessage = MulticastMessage.builder()
|
||||
.putData("title", title)
|
||||
.putData("message", message)
|
||||
.addAllTokens(tokens)
|
||||
|
||||
if (container == "ios") {
|
||||
multicastMessage
|
||||
.setNotification(
|
||||
Notification.builder()
|
||||
.setTitle(title)
|
||||
.setBody(message)
|
||||
.build()
|
||||
)
|
||||
} else {
|
||||
multicastMessage
|
||||
.putData("title", title)
|
||||
.putData("message", message)
|
||||
}
|
||||
|
||||
if (roomId != null) {
|
||||
multicastMessage.putData("room_id", roomId.toString())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue