Skip to content

Commit

Permalink
Merge pull request #157 from PSR-Co/feat/#156-chat-noti
Browse files Browse the repository at this point in the history
[feat] 채팅 알림 구현
  • Loading branch information
psyeon1120 authored Aug 30, 2023
2 parents be1d734 + ce3c7ed commit 4257178
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4257178

Please sign in to comment.