Skip to content

Commit 98162b2

Browse files
authored
Merge pull request #137 from Team-Nuvibe/dev
dev to main
2 parents ccc79b3 + d54f15e commit 98162b2

6 files changed

Lines changed: 13 additions & 17 deletions

File tree

src/main/java/com/umc/nuvibe/domain/notification/scheduler/NotificationScheduler.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ public void sendDropReminder() {
102102
NotificationType.NOTI_06,
103103
null,
104104
null,
105-
null,
106105
null
107106
);
108107
} catch (Exception e) {
@@ -138,7 +137,7 @@ public void sendTagRecommendation() {
138137
for (User user : inactiveUsers) {
139138
try {
140139
ImageTag randomTag = allTags[random.nextInt(allTags.length)];
141-
fcmService.sendNotification(user, NotificationType.NOTI_07, randomTag.name(), null, null,null);
140+
fcmService.sendNotification(user, NotificationType.NOTI_07, randomTag.name(), null, null);
142141
} catch (Exception e) {
143142
log.error("NOTI-07 발송 실패. userId={}", user.getId(), e);
144143
}
@@ -169,7 +168,7 @@ public void sendWeeklyRecap() {
169168

170169
for (User user : usersWithWeeklyDrop) {
171170
try {
172-
fcmService.sendNotification(user, NotificationType.NOTI_08, null, null, null,null);
171+
fcmService.sendNotification(user, NotificationType.NOTI_08, null, null, null);
173172
} catch (Exception e) {
174173
log.error("NOTI-08 발송 실패. userId={}", user.getId(), e);
175174
}
@@ -200,7 +199,7 @@ public void sendMonthlyRecap() {
200199

201200
for (User user : usersWithMonthlyDrop) {
202201
try {
203-
fcmService.sendNotification(user, NotificationType.NOTI_09, null, null, null,null);
202+
fcmService.sendNotification(user, NotificationType.NOTI_09, null, null, null);
204203
} catch (Exception e) {
205204
log.error("NOTI-09 발송 실패. userId={}", user.getId(), e);
206205
}

src/main/java/com/umc/nuvibe/domain/notification/service/FcmAsyncService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class FcmAsyncService {
2929
private final UserRepository userRepository;
3030

3131
@Async
32-
public void sendNotification(User user, NotificationType type, String tag, String nickname, Long relatedId, Long tribeId) {
32+
public void sendNotification(User user, NotificationType type, String tag, Long relatedId, Long tribeId) {
3333
// 1. 알림 설정 체크
3434
User managedUser = userRepository.findById(user.getId()).orElse(null);
3535
if (managedUser == null || !isNotificationEnabled(managedUser, type)) {
@@ -49,7 +49,7 @@ public void sendNotification(User user, NotificationType type, String tag, Strin
4949
}
5050

5151
// 4. FCM 푸시 발송
52-
String pushMessage = type.formatPushMessage(tag, nickname);
52+
String pushMessage = type.formatPushMessage(tag);
5353
List<Fcm> tokens = fcmRepository.findByUserAndIsActiveTrue(managedUser);
5454
for (Fcm fcm : tokens) {
5555
sendPushMessage(fcm.getToken(), pushMessage);

src/main/java/com/umc/nuvibe/domain/notification/service/FcmService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ public void registerToken(Long userId, String token) {
4949
}
5050

5151
// 단일 사용자 알림 - 위임
52-
public void sendNotification(User user, NotificationType type, String tag, String nickname, Long relatedId, Long tribeId) {
53-
fcmAsyncService.sendNotification(user, type, tag, nickname, relatedId, tribeId);
52+
public void sendNotification(User user, NotificationType type, String tag, Long relatedId, Long tribeId) {
53+
fcmAsyncService.sendNotification(user, type, tag, relatedId, tribeId);
5454
}
5555

5656
// 여러 사용자 알림 - 각각 비동기로 호출
5757
public void sendNotificationToUsers(List<User> users, NotificationType type, String tag, Long relatedId, Long tribeId) {
5858
for (User user : users) {
59-
fcmAsyncService.sendNotification(user, type, tag, null, relatedId, tribeId);
59+
fcmAsyncService.sendNotification(user, type, tag, relatedId, tribeId);
6060
}
6161
}
6262
}

src/main/java/com/umc/nuvibe/domain/notification/vo/NotificationType.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
public enum NotificationType {
99
NOTI_01("NOTI-01","TRIBE_CHAT_JOINED","기다리던 {{tag}} 트라이브 챗이 열렸어요. 지금 들어가볼까요?", "채팅", "기다리던 트라이브 챗이 열렸어요", "{{tag}} 트라이브 챗에 지금 들어가 볼까요?"),
1010
NOTI_02("NOTI-02","TRIBE_CHAT_IMAGE_UPLOADED","{{tag}} 트라이브 챗에 새로운 바이브가 올라왔어요.", "채팅", "트라이브 챗에 새 바이브가 올라왔어요", "{{tag}} 트라이브 챗을 지금 확인해 보세요!"),
11-
NOTI_03("NOTI-03","IMAGE_REACTION","{{nickname}}의 바이브에 반응이 남겨졌어요.", "채팅", "사람들이 내 바이브에 반응했어요", "{{tag}} 트라이브 챗 속 반응을 확인해 보세요!"),
11+
NOTI_03("NOTI-03","IMAGE_REACTION","내가 올린 바이브에 반응이 남겨졌어요.", "채팅", "사람들이 내 바이브에 반응했어요", "{{tag}} 트라이브 챗 속 반응을 확인해 보세요!"),
1212
NOTI_04("NOTI-04","TRIBE_CHAT_CLOSING","{{tag}} 트라이브 챗이 하루 뒤 닫혀요.", "알림", "트라이브 챗이 곧 닫혀요", "{{tag}} 트라이브 챗에 마지막으로 참여해 볼까요?"),
1313
NOTI_05("NOTI-05","TRIBE_CHAT_CLOSED","{{tag}} 트라이브 챗이 종료되었어요.", "알림", "트라이브 챗이 종료되었어요", "또 다른 트라이브를 찾으러 갈까요? "),
1414
NOTI_06("NOTI-06","MISSION_REMINDER","오늘의 드랍이 아직 비어 있어요. 지금의 무드를 남겨볼까요?", "미션", "오늘의 드랍이 아직 비어 있어요", "지금의 무드를 남겨볼까요?"),
@@ -25,12 +25,11 @@ public enum NotificationType {
2525
private final String mainMessage;
2626
private final String actionMessage;
2727

28-
public String formatPushMessage(String tag, String nickname) {
28+
public String formatPushMessage(String tag) {
2929
String formattedTag = (tag != null && !tag.isBlank()) ? "#" + tag + " " : "";
3030
return pushMessage
3131
.replace("{{tag}} ", formattedTag)
32-
.replace("{{tag}}", formattedTag.trim())
33-
.replace("{{nickname}}", nickname != null ? nickname : "");
32+
.replace("{{tag}}", formattedTag.trim());
3433
}
3534

3635
public String formatMainMessage(String tag) {

src/main/java/com/umc/nuvibe/domain/tribe/service/emoji/EmojiServiceImpl.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ public void emojiReact(Long userId, Long chatId, EmojiType type) {
9393
imageOwner,
9494
NotificationType.NOTI_03,
9595
chat.getTribe().getImageTag().name(),
96-
nickname,
9796
chatId,
9897
tribeId
9998
);
@@ -128,7 +127,6 @@ public void emojiReact(Long userId, Long chatId, EmojiType type) {
128127
imageOwner,
129128
NotificationType.NOTI_03,
130129
chat.getTribe().getImageTag().name(),
131-
nickname,
132130
chatId,
133131
tribeId
134132
);

src/main/java/com/umc/nuvibe/domain/user/service/UserServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public UserNicknameUpdateRes updateUserNickname(Long userId, String nickname) {
8282
@Override
8383
public void afterCommit() {
8484
try {
85-
fcmService.sendNotification(user, NotificationType.NOTI_11, null, null, null, null);
85+
fcmService.sendNotification(user, NotificationType.NOTI_11, null, null, null);
8686
} catch (Exception ex) {
8787
log.warn("FCM 알림 전송 실패: NOTI_11", ex);
8888
}
@@ -145,7 +145,7 @@ public void reissuePassword(Long userId, ReissuePasswordReq request) {
145145
@Override
146146
public void afterCommit() {
147147
try {
148-
fcmService.sendNotification(user, NotificationType.NOTI_10, null, null, null, null);
148+
fcmService.sendNotification(user, NotificationType.NOTI_10, null, null, null);
149149
} catch (Exception ex) {
150150
log.warn("FCM 알림 전송 실패: NOTI_10", ex);
151151
}

0 commit comments

Comments
 (0)