diff --git a/adapter/firebase/src/main/kotlin/com/xorker/draw/firebase/FcmService.kt b/adapter/firebase/src/main/kotlin/com/xorker/draw/firebase/FcmService.kt index 370d407d..cf4f2700 100644 --- a/adapter/firebase/src/main/kotlin/com/xorker/draw/firebase/FcmService.kt +++ b/adapter/firebase/src/main/kotlin/com/xorker/draw/firebase/FcmService.kt @@ -3,6 +3,7 @@ package com.xorker.draw.firebase import com.google.firebase.messaging.FirebaseMessaging import com.google.firebase.messaging.Message import com.google.firebase.messaging.Notification +import com.xorker.draw.notification.PushMessageUseCase import com.xorker.draw.websocket.WaitingQueueSession import java.util.Locale import org.springframework.context.MessageSource @@ -11,9 +12,9 @@ import org.springframework.stereotype.Service @Service class FcmService( private val messageSource: MessageSource, -) { +) : PushMessageUseCase { - fun quickStart(session: WaitingQueueSession) { + override fun quickStart(session: WaitingQueueSession) { quickStart(session.locale, session.user.name) } diff --git a/adapter/memory/src/main/kotlin/com/xorker/draw/mafia/MafiaGameWaitingQueueAdapter.kt b/adapter/memory/src/main/kotlin/com/xorker/draw/mafia/MafiaGameWaitingQueueAdapter.kt index eb70b63d..c2748aaf 100644 --- a/adapter/memory/src/main/kotlin/com/xorker/draw/mafia/MafiaGameWaitingQueueAdapter.kt +++ b/adapter/memory/src/main/kotlin/com/xorker/draw/mafia/MafiaGameWaitingQueueAdapter.kt @@ -1,8 +1,8 @@ package com.xorker.draw.mafia import com.xorker.draw.exception.UnSupportedException -import com.xorker.draw.firebase.FcmService import com.xorker.draw.mafia.event.MafiaGameRandomMatchingEvent +import com.xorker.draw.notification.PushMessageUseCase import com.xorker.draw.websocket.WaitingQueueSession import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ConcurrentLinkedQueue @@ -12,7 +12,7 @@ import org.springframework.stereotype.Component @Component internal class MafiaGameWaitingQueueAdapter( private val eventPublisher: ApplicationEventPublisher, - private val fcmService: FcmService, + private val pushMessageUseCase: PushMessageUseCase, ) : MafiaGameWaitingQueueRepository { private val waitingQueue: ConcurrentHashMap> = ConcurrentHashMap() @@ -35,7 +35,7 @@ internal class MafiaGameWaitingQueueAdapter( eventPublisher.publishEvent(event) } else { - fcmService.quickStart(session) + pushMessageUseCase.quickStart(session) } } } diff --git a/domain/src/main/kotlin/com/xorker/draw/notification/PushMessageUseCase.kt b/domain/src/main/kotlin/com/xorker/draw/notification/PushMessageUseCase.kt new file mode 100644 index 00000000..04ec870b --- /dev/null +++ b/domain/src/main/kotlin/com/xorker/draw/notification/PushMessageUseCase.kt @@ -0,0 +1,7 @@ +package com.xorker.draw.notification + +import com.xorker.draw.websocket.WaitingQueueSession + +interface PushMessageUseCase { + fun quickStart(session: WaitingQueueSession) +}