From ce3c7ed89f055091b23e89363663f8d453ca5b35 Mon Sep 17 00:00:00 2001 From: psyeon1120 Date: Wed, 30 Aug 2023 22:33:02 +0900 Subject: [PATCH] =?UTF-8?q?#156=20feat:=20=EC=B1=84=ED=8C=85=20=EC=95=8C?= =?UTF-8?q?=EB=A6=BC=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notification/service/NotificationService.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/kotlin/com/psr/psr/notification/service/NotificationService.kt b/src/main/kotlin/com/psr/psr/notification/service/NotificationService.kt index 2c8d291..364392c 100644 --- a/src/main/kotlin/com/psr/psr/notification/service/NotificationService.kt +++ b/src/main/kotlin/com/psr/psr/notification/service/NotificationService.kt @@ -102,6 +102,20 @@ class NotificationService( } } + // 채팅 알림 + fun sendChatNoti(chatReceiver: User, senderNickname: String, chatMessage: String, chatRoomId: Long) { + if (isPushNotiAvailable(chatReceiver)) { + val message: FcmMessage = notiAssembler.makeMessage( + chatReceiver.deviceToken!!, + senderNickname, + chatMessage, + chatRoomId, + NotificationType.CHAT.name + ) + sendMessage(objectMapper.writeValueAsString(message)) + } + } + // 알림 수신 상태 체크 fun isPushNotiAvailable(user: User): Boolean { return user.deviceToken != null && user.notification