Skip to content

Commit

Permalink
add: (#261) SendPushMessagePort
Browse files Browse the repository at this point in the history
  • Loading branch information
softpeanut committed Dec 30, 2022
1 parent 0550c90 commit b018415
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package team.comit.simtong.domain.notification.spi

import java.util.UUID

/**
*
* 푸시 알림 전송을 요청하는 SendPushMessagePort
*
* @author kimbeomjin
* @date 2022/12/30
* @version 1.1.0
**/
interface SendPushMessagePort {

fun sendMessage(tokens: List<String>, title: String, content: String, identify: UUID?)

fun sendMessage(token: String, title: String, content: String, identify: UUID?)

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.google.firebase.messaging.Message
import com.google.firebase.messaging.MulticastMessage
import com.google.firebase.messaging.Notification
import org.springframework.stereotype.Component
import team.comit.simtong.domain.notification.spi.SendPushMessagePort
import java.util.UUID

/**
Expand All @@ -18,9 +19,9 @@ import java.util.UUID
* @version 1.1.0
**/
@Component
class FcmAdapter {
class FcmAdapter : SendPushMessagePort {

fun sendMessage(tokens: List<String>, title: String, content: String, identify: UUID) {
override fun sendMessage(tokens: List<String>, title: String, content: String, identify: UUID?) {
val multicastMessage = MulticastMessage.builder()
.addAllTokens(tokens)
.putData("identify", identify.toString())
Expand All @@ -40,7 +41,7 @@ class FcmAdapter {
FirebaseMessaging.getInstance().sendMulticastAsync(multicastMessage)
}

fun sendMessage(token: String, title: String, content: String, identify: UUID) {
override fun sendMessage(token: String, title: String, content: String, identify: UUID?) {
val message = Message.builder()
.setToken(token)
.putData("identify", identify.toString())
Expand Down

0 comments on commit b018415

Please sign in to comment.