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.FirebaseMessaging
|
||||||
import com.google.firebase.messaging.MulticastMessage
|
import com.google.firebase.messaging.MulticastMessage
|
||||||
|
import com.google.firebase.messaging.Notification
|
||||||
import org.springframework.scheduling.annotation.Async
|
import org.springframework.scheduling.annotation.Async
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@ -18,9 +19,21 @@ class FcmService {
|
||||||
contentId: Long? = null
|
contentId: Long? = null
|
||||||
) {
|
) {
|
||||||
val multicastMessage = MulticastMessage.builder()
|
val multicastMessage = MulticastMessage.builder()
|
||||||
|
.addAllTokens(tokens)
|
||||||
|
|
||||||
|
if (container == "ios") {
|
||||||
|
multicastMessage
|
||||||
|
.setNotification(
|
||||||
|
Notification.builder()
|
||||||
|
.setTitle(title)
|
||||||
|
.setBody(message)
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
multicastMessage
|
||||||
.putData("title", title)
|
.putData("title", title)
|
||||||
.putData("message", message)
|
.putData("message", message)
|
||||||
.addAllTokens(tokens)
|
}
|
||||||
|
|
||||||
if (roomId != null) {
|
if (roomId != null) {
|
||||||
multicastMessage.putData("room_id", roomId.toString())
|
multicastMessage.putData("room_id", roomId.toString())
|
||||||
|
|
Loading…
Reference in New Issue