Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] comment push alarm #29

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void postComment(Long memberId, Long contentId, CommentPostRequestDto com
//λ‹΅κΈ€ μž‘μ„± μ‹œ κ²Œμ‹œλ¬Ό μž‘μƒμžμ—κ²Œ μ•Œλ¦Ό λ°œμƒ
Member contentWritingMember = memberRepository.findMemberByIdOrThrow(content.getMember().getId());

if(usingMember != contentWritingMember){ ////μžμ‹  κ²Œμ‹œλ¬Όμ— λŒ€ν•œ μ’‹μ•„μš” λˆ„λ₯΄λ©΄ μ•Œλ¦Ό λ°œμƒ x
if(usingMember != contentWritingMember) { ////μžμ‹  κ²Œμ‹œλ¬Όμ— λŒ€ν•œ μ’‹μ•„μš” λˆ„λ₯΄λ©΄ μ•Œλ¦Ό λ°œμƒ x
//λ…Έν‹° 엔티티와 μ—°κ²°
Notification notification = Notification.builder()
.notificationTargetMember(contentWritingMember)
Expand All @@ -66,29 +66,29 @@ public void postComment(Long memberId, Long contentId, CommentPostRequestDto com
.notificationText(comment.getCommentText())
.build();
Notification savedNotification = notificationRepository.save(notification);
}

if (Boolean.TRUE.equals(contentWritingMember.getIsPushAlarmAllowed())) {
String FcmMessageTitle = usingMember.getNickname() + "λ‹˜μ΄ 닡글을 μž‘μ„±ν–ˆμŠ΅λ‹ˆλ‹€.";
contentWritingMember.increaseFcmBadge();
FcmMessageDto commentFcmMessage = FcmMessageDto.builder()
.validateOnly(false)
.message(FcmMessageDto.Message.builder()
.notificationDetails(FcmMessageDto.NotificationDetails.builder()
.title(FcmMessageTitle)
.body(commentPostRequestDto.commentText())
.build())
.token(contentWritingMember.getFcmToken())
.data(FcmMessageDto.Data.builder()
.name("comment")
.description("λ‹΅κΈ€ ν‘Έμ‹œ μ•Œλ¦Ό")
.relateContentId(String.valueOf(contentId))
.build())
.badge(contentWritingMember.getFcmBadge())
.build())
.build();
if (Boolean.TRUE.equals(contentWritingMember.getIsPushAlarmAllowed())) {
String FcmMessageTitle = usingMember.getNickname() + "λ‹˜μ΄ 닡글을 μž‘μ„±ν–ˆμŠ΅λ‹ˆλ‹€.";
contentWritingMember.increaseFcmBadge();
FcmMessageDto commentFcmMessage = FcmMessageDto.builder()
.validateOnly(false)
.message(FcmMessageDto.Message.builder()
.notificationDetails(FcmMessageDto.NotificationDetails.builder()
.title(FcmMessageTitle)
.body(commentPostRequestDto.commentText())
.build())
.token(contentWritingMember.getFcmToken())
.data(FcmMessageDto.Data.builder()
.name("comment")
.description("λ‹΅κΈ€ ν‘Έμ‹œ μ•Œλ¦Ό")
.relateContentId(String.valueOf(contentId))
.build())
.badge(contentWritingMember.getFcmBadge())
.build())
.build();

fcmService.sendMessage(commentFcmMessage);
fcmService.sendMessage(commentFcmMessage);
}
}
}

Expand Down Expand Up @@ -132,7 +132,6 @@ public void postCommentVer2(Long memberId, Long contentId, MultipartFile comment
.build();
Notification savedNotification = notificationRepository.save(notification);


if (Boolean.TRUE.equals(contentWritingMember.getIsPushAlarmAllowed())) {
String FcmMessageTitle = usingMember.getNickname() + "λ‹˜μ΄ 닡글을 μž‘μ„±ν–ˆμŠ΅λ‹ˆλ‹€.";
contentWritingMember.increaseFcmBadge();
Expand Down
Loading