푸시 발송 이벤트 - container가 필요한 부분에 container 추가

This commit is contained in:
Klaus 2023-08-09 10:36:40 +09:00
parent 2548c92aa1
commit ccb32a73dd
3 changed files with 52 additions and 13 deletions

View File

@ -272,7 +272,20 @@ class AudioContentService(
message = "콘텐츠를 업로드 하였습니다. - ${audioContent.title}",
isAuth = audioContent.isAdult,
contentId = contentId,
creatorId = audioContent.member!!.id
creatorId = audioContent.member!!.id,
container = "ios"
)
)
applicationEventPublisher.publishEvent(
FcmEvent(
type = FcmEventType.UPLOAD_CONTENT,
title = audioContent.member!!.nickname,
message = "콘텐츠를 업로드 하였습니다. - ${audioContent.title}",
isAuth = audioContent.isAdult,
contentId = contentId,
creatorId = audioContent.member!!.id,
container = "aos"
)
)
}

View File

@ -35,14 +35,13 @@ class FcmSendListener(
fun send(fcmEvent: FcmEvent) {
when (fcmEvent.type) {
FcmEventType.ALL -> {
logger.info("ALL")
if (fcmEvent.container.isNotBlank()) {
val pushTokens = memberRepository.getAllRecipientPushTokens(
fcmEvent.isAuth,
fcmEvent.container
)
logger.info("tokens::: $pushTokens")
for (tokens in pushTokens) {
pushService.send(
tokens = tokens,
@ -55,14 +54,13 @@ class FcmSendListener(
}
FcmEventType.INDIVIDUAL -> {
logger.info("INDIVIDUAL")
if (fcmEvent.recipients.isNotEmpty()) {
val pushTokens = memberRepository.getIndividualRecipientPushTokens(
recipients = fcmEvent.recipients,
isAuth = fcmEvent.isAuth
)
logger.info("tokens::: $pushTokens")
val iosPushTokens = pushTokens["ios"]
val aosPushToken = pushTokens["aos"]
@ -91,6 +89,8 @@ class FcmSendListener(
}
FcmEventType.CREATE_LIVE, FcmEventType.START_LIVE -> {
logger.info("CREATE_LIVE")
logger.info("START_LIVE")
if (fcmEvent.container.isNotBlank()) {
val pushTokens = memberRepository.getCreateLiveRoomNotificationRecipientPushTokens(
creatorId = fcmEvent.creatorId!!,
@ -98,8 +98,6 @@ class FcmSendListener(
container = fcmEvent.container
)
logger.info("tokens::: $pushTokens")
for (tokens in pushTokens) {
pushService.send(
tokens = tokens,
@ -113,6 +111,7 @@ class FcmSendListener(
}
FcmEventType.UPLOAD_CONTENT -> {
logger.info("UPLOAD_CONTENT")
if (fcmEvent.container.isNotBlank()) {
val pushTokens = memberRepository.getUploadContentNotificationRecipientPushTokens(
creatorId = fcmEvent.creatorId!!,
@ -120,8 +119,6 @@ class FcmSendListener(
container = fcmEvent.container
)
logger.info("tokens::: $pushTokens")
for (tokens in pushTokens) {
pushService.send(
tokens = tokens,
@ -135,10 +132,9 @@ class FcmSendListener(
}
FcmEventType.SEND_MESSAGE -> {
logger.info("SEND_MESSAGE")
val response = memberRepository.getMessageRecipientPushToken(messageId = fcmEvent.messageId!!)
logger.info("tokens::: ${response.pushToken}")
pushService.send(
tokens = listOf(response.pushToken),
title = fcmEvent.title,

View File

@ -254,7 +254,24 @@ class LiveRoomService(
},
isAuth = createdRoom.isAdult,
roomId = createdRoom.id,
creatorId = createdRoom.member!!.id
creatorId = createdRoom.member!!.id,
container = "ios"
)
)
applicationEventPublisher.publishEvent(
FcmEvent(
type = FcmEventType.CREATE_LIVE,
title = createdRoom.member!!.nickname,
message = if (createdRoom.channelName != null) {
"라이브를 시작했습니다. - ${createdRoom.title}"
} else {
"라이브를 개설했습니다. - ${createdRoom.title}"
},
isAuth = createdRoom.isAdult,
roomId = createdRoom.id,
creatorId = createdRoom.member!!.id,
container = "aos"
)
)
@ -386,7 +403,20 @@ class LiveRoomService(
message = "라이브를 시작했습니다 - ${room.title}",
isAuth = room.isAdult,
roomId = room.id,
creatorId = room.member!!.id
creatorId = room.member!!.id,
container = "ios"
)
)
applicationEventPublisher.publishEvent(
FcmEvent(
type = FcmEventType.START_LIVE,
title = room.member!!.nickname,
message = "라이브를 시작했습니다 - ${room.title}",
isAuth = room.isAdult,
roomId = room.id,
creatorId = room.member!!.id,
container = "aos"
)
)
}