| @@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.fcm | ||||
|  | ||||
| import org.springframework.context.ApplicationEventPublisher | ||||
| import org.springframework.security.access.prepost.PreAuthorize | ||||
| import org.springframework.transaction.annotation.Transactional | ||||
| import org.springframework.web.bind.annotation.PostMapping | ||||
| import org.springframework.web.bind.annotation.RequestBody | ||||
| import org.springframework.web.bind.annotation.RequestMapping | ||||
| @@ -12,6 +13,7 @@ import org.springframework.web.bind.annotation.RestController | ||||
| @PreAuthorize("hasRole('ADMIN')") | ||||
| class FcmController(private val applicationEventPublisher: ApplicationEventPublisher) { | ||||
|     @PostMapping | ||||
|     @Transactional(readOnly = true) | ||||
|     fun send( | ||||
|         @RequestBody request: PushRequest | ||||
|     ) = run { | ||||
|   | ||||
| @@ -1,5 +1,8 @@ | ||||
| package kr.co.vividnext.sodalive.fcm | ||||
|  | ||||
| import com.google.firebase.messaging.AndroidConfig | ||||
| import com.google.firebase.messaging.ApnsConfig | ||||
| import com.google.firebase.messaging.Aps | ||||
| import com.google.firebase.messaging.FirebaseMessaging | ||||
| import com.google.firebase.messaging.MulticastMessage | ||||
| import com.google.firebase.messaging.Notification | ||||
| @@ -27,6 +30,22 @@ class FcmService { | ||||
|             val multicastMessage = MulticastMessage.builder() | ||||
|                 .addAllTokens(tokens) | ||||
|  | ||||
|             multicastMessage.setAndroidConfig( | ||||
|                 AndroidConfig.builder() | ||||
|                     .setPriority(AndroidConfig.Priority.HIGH) | ||||
|                     .build() | ||||
|             ) | ||||
|  | ||||
|             multicastMessage.setApnsConfig( | ||||
|                 ApnsConfig.builder() | ||||
|                     .setAps( | ||||
|                         Aps.builder() | ||||
|                             .setSound("default") | ||||
|                             .build() | ||||
|                     ) | ||||
|                     .build() | ||||
|             ) | ||||
|  | ||||
|             if (container == "ios") { | ||||
|                 multicastMessage | ||||
|                     .setNotification( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user