test #6
| @@ -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,10 +19,22 @@ class FcmService { | |||||||
|         contentId: Long? = null |         contentId: Long? = null | ||||||
|     ) { |     ) { | ||||||
|         val multicastMessage = MulticastMessage.builder() |         val multicastMessage = MulticastMessage.builder() | ||||||
|             .putData("title", title) |  | ||||||
|             .putData("message", message) |  | ||||||
|             .addAllTokens(tokens) |             .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) { |         if (roomId != null) { | ||||||
|             multicastMessage.putData("room_id", roomId.toString()) |             multicastMessage.putData("room_id", roomId.toString()) | ||||||
|         } |         } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user