라이브 취소 푸시 발송 로직 추가

This commit is contained in:
2023-09-01 16:46:43 +09:00
parent 8f50d05906
commit d6dfa63bea
3 changed files with 76 additions and 1 deletions

View File

@@ -9,7 +9,8 @@ import org.springframework.transaction.annotation.Transactional
import org.springframework.transaction.event.TransactionalEventListener
enum class FcmEventType {
ALL, INDIVIDUAL, CREATE_LIVE, START_LIVE, UPLOAD_CONTENT, SEND_MESSAGE, CHANGE_NOTICE, CREATE_CONTENT_COMMENT
ALL, INDIVIDUAL, CREATE_LIVE, START_LIVE, CANCEL_LIVE, UPLOAD_CONTENT, SEND_MESSAGE, CHANGE_NOTICE,
CREATE_CONTENT_COMMENT
}
class FcmEvent(
@@ -131,6 +132,37 @@ class FcmSendListener(
}
}
FcmEventType.CANCEL_LIVE -> {
if (fcmEvent.roomId != null) {
val pushTokenList = memberRepository.getPushTokenFromReservationList(fcmEvent.roomId)
val iosPushTokens = pushTokenList["ios"]
val aosPushToken = pushTokenList["aos"]
if (iosPushTokens != null) {
for (tokens in iosPushTokens) {
pushService.send(
tokens = tokens,
title = fcmEvent.title,
message = fcmEvent.message,
container = "ios"
)
}
}
if (aosPushToken != null) {
for (tokens in aosPushToken) {
pushService.send(
tokens = tokens,
title = fcmEvent.title,
message = fcmEvent.message,
container = "aos"
)
}
}
}
}
FcmEventType.UPLOAD_CONTENT -> {
if (fcmEvent.container.isNotBlank()) {
val pushTokens = memberRepository.getUploadContentNotificationRecipientPushTokens(