feat(creator-community): 커뮤니티 댓글 알림 딥링크에 게시글 식별자를 포함한다
This commit is contained in:
@@ -382,7 +382,9 @@ class CreatorCommunityService(
|
||||
val post = repository.findByIdOrNull(id = postId)
|
||||
?: throw SodaException(messageKey = "creator.community.invalid_post_retry")
|
||||
|
||||
if (isBlockedBetweenMembers(memberId = member.id!!, creatorId = post.member!!.id!!)) {
|
||||
val creatorId = post.member!!.id!!
|
||||
|
||||
if (isBlockedBetweenMembers(memberId = member.id!!, creatorId = creatorId)) {
|
||||
throw SodaException(messageKey = "creator.community.invalid_access_retry")
|
||||
}
|
||||
|
||||
@@ -407,6 +409,22 @@ class CreatorCommunityService(
|
||||
}
|
||||
|
||||
commentRepository.save(postComment)
|
||||
|
||||
if (member.id != creatorId) {
|
||||
applicationEventPublisher.publishEvent(
|
||||
FcmEvent(
|
||||
type = FcmEventType.INDIVIDUAL,
|
||||
category = PushNotificationCategory.COMMUNITY,
|
||||
title = member.nickname,
|
||||
messageKey = "creator.community.fcm.new_comment",
|
||||
senderMemberId = member.id,
|
||||
recipients = listOf(creatorId),
|
||||
deepLinkValue = FcmDeepLinkValue.COMMUNITY,
|
||||
deepLinkId = creatorId,
|
||||
deepLinkCommentPostId = postId
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
||||
@@ -49,6 +49,7 @@ class FcmEvent(
|
||||
val auditionId: Long? = null,
|
||||
val deepLinkValue: FcmDeepLinkValue? = null,
|
||||
val deepLinkId: Long? = null,
|
||||
val deepLinkCommentPostId: Long? = null,
|
||||
val commentParentId: Long? = null,
|
||||
val myMemberId: Long? = null,
|
||||
val isAvailableJoinCreator: Boolean? = null,
|
||||
@@ -193,7 +194,8 @@ class FcmSendListener(
|
||||
creatorId = creatorId ?: fcmEvent.creatorId,
|
||||
auditionId = auditionId ?: fcmEvent.auditionId,
|
||||
deepLinkValue = fcmEvent.deepLinkValue,
|
||||
deepLinkId = fcmEvent.deepLinkId
|
||||
deepLinkId = fcmEvent.deepLinkId,
|
||||
deepLinkCommentPostId = fcmEvent.deepLinkCommentPostId
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,8 @@ class FcmService(
|
||||
creatorId: Long? = null,
|
||||
auditionId: Long? = null,
|
||||
deepLinkValue: FcmDeepLinkValue? = null,
|
||||
deepLinkId: Long? = null
|
||||
deepLinkId: Long? = null,
|
||||
deepLinkCommentPostId: Long? = null
|
||||
) {
|
||||
if (tokens.isEmpty()) return
|
||||
logger.info("os: $container")
|
||||
@@ -89,7 +90,7 @@ class FcmService(
|
||||
multicastMessage.putData("audition_id", auditionId.toString())
|
||||
}
|
||||
|
||||
val deepLink = createDeepLink(deepLinkValue, deepLinkId)
|
||||
val deepLink = createDeepLink(deepLinkValue, deepLinkId, deepLinkCommentPostId)
|
||||
if (deepLink != null) {
|
||||
multicastMessage.putData("deep_link", deepLink)
|
||||
}
|
||||
@@ -127,8 +128,12 @@ class FcmService(
|
||||
}
|
||||
}
|
||||
|
||||
private fun createDeepLink(deepLinkValue: FcmDeepLinkValue?, deepLinkId: Long?): String? {
|
||||
return buildDeepLink(serverEnv, deepLinkValue, deepLinkId)
|
||||
private fun createDeepLink(
|
||||
deepLinkValue: FcmDeepLinkValue?,
|
||||
deepLinkId: Long?,
|
||||
deepLinkCommentPostId: Long?
|
||||
): String? {
|
||||
return buildDeepLink(serverEnv, deepLinkValue, deepLinkId, deepLinkCommentPostId)
|
||||
}
|
||||
|
||||
fun sendPointGranted(tokens: List<String>, point: Int) {
|
||||
@@ -201,7 +206,8 @@ class FcmService(
|
||||
fun buildDeepLink(
|
||||
serverEnv: String,
|
||||
deepLinkValue: FcmDeepLinkValue?,
|
||||
deepLinkId: Long?
|
||||
deepLinkId: Long?,
|
||||
deepLinkCommentPostId: Long? = null
|
||||
): String? {
|
||||
if (deepLinkValue == null || deepLinkId == null) {
|
||||
return null
|
||||
@@ -213,7 +219,12 @@ class FcmService(
|
||||
"voiceon-test"
|
||||
}
|
||||
|
||||
return "$uriScheme://${deepLinkValue.value}/$deepLinkId"
|
||||
val baseDeepLink = "$uriScheme://${deepLinkValue.value}/$deepLinkId"
|
||||
if (deepLinkValue == FcmDeepLinkValue.COMMUNITY && deepLinkCommentPostId != null) {
|
||||
return "$baseDeepLink?postId=$deepLinkCommentPostId"
|
||||
}
|
||||
|
||||
return baseDeepLink
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,12 @@ class PushNotificationService(
|
||||
|
||||
val category = resolveCategory(fcmEvent) ?: return
|
||||
val senderSnapshot = resolveSenderSnapshot(fcmEvent)
|
||||
val deepLink = FcmService.buildDeepLink(serverEnv, fcmEvent.deepLinkValue, fcmEvent.deepLinkId)
|
||||
val deepLink = FcmService.buildDeepLink(
|
||||
serverEnv = serverEnv,
|
||||
deepLinkValue = fcmEvent.deepLinkValue,
|
||||
deepLinkId = fcmEvent.deepLinkId,
|
||||
deepLinkCommentPostId = fcmEvent.deepLinkCommentPostId
|
||||
)
|
||||
|
||||
val notification = PushNotificationList(
|
||||
senderNicknameSnapshot = senderSnapshot.nickname,
|
||||
|
||||
@@ -2272,6 +2272,11 @@ class SodaMessageSource {
|
||||
Lang.EN to "A new post has been added.",
|
||||
Lang.JA to "新しい投稿が登録されました。"
|
||||
),
|
||||
"creator.community.fcm.new_comment" to mapOf(
|
||||
Lang.KO to "커뮤니티 게시글에 새 댓글이 등록되었습니다.",
|
||||
Lang.EN to "A new comment has been added to your community post.",
|
||||
Lang.JA to "コミュニティ投稿に新しいコメントが登録されました。"
|
||||
),
|
||||
"creator.community.invalid_request_retry" to mapOf(
|
||||
Lang.KO to "잘못된 요청입니다.\n다시 시도해 주세요.",
|
||||
Lang.EN to "Invalid request.\ntry again.",
|
||||
|
||||
Reference in New Issue
Block a user