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

refact : 알림 서버 사용하지 않는 클래스, 의존 제거 #617 #619

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package site.timecapsulearchive.notification.infra.fcm;

public enum FcmMessageData {
public enum FCMMessageData {
TOPIC("topic"),
STATUS("status"),

Expand All @@ -11,7 +11,7 @@ public enum FcmMessageData {

private final String data;

FcmMessageData(String data) {
FCMMessageData(String data) {
this.data = data;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@
import site.timecapsulearchive.notification.data.dto.CapsuleSkinNotificationSendDto;
import site.timecapsulearchive.notification.entity.CategoryName;
import site.timecapsulearchive.notification.infra.exception.MessageNotSendAbleException;
import site.timecapsulearchive.notification.infra.fcm.FCMManager;
import site.timecapsulearchive.notification.infra.fcm.FcmMessageData;
import site.timecapsulearchive.notification.infra.fcm.FCMMessageData;
import site.timecapsulearchive.notification.infra.s3.S3PreSignedUrlManager;

@Component
@RequiredArgsConstructor
public class CapsuleSkinFcmManagerImpl implements CapsuleSkinFcmManager {

private final FCMManager fcmManager;
private final S3PreSignedUrlManager s3PreSignedUrlManager;

public void sendCapsuleSkinNotification(
Expand All @@ -28,12 +26,12 @@ public void sendCapsuleSkinNotification(
FirebaseMessaging.getInstance()
.send(
Message.builder()
.putData(FcmMessageData.TOPIC.getData(), String.valueOf(categoryName))
.putData(FcmMessageData.STATUS.getData(), String.valueOf(dto.status()))
.putData(FcmMessageData.TITLE.getData(), dto.title())
.putData(FcmMessageData.TEXT.getData(), dto.text())
.putData(FCMMessageData.TOPIC.getData(), String.valueOf(categoryName))
.putData(FCMMessageData.STATUS.getData(), String.valueOf(dto.status()))
.putData(FCMMessageData.TITLE.getData(), dto.title())
.putData(FCMMessageData.TEXT.getData(), dto.text())
.setToken(fcmToken)
.putData(FcmMessageData.IMAGE.getData(),
.putData(FCMMessageData.IMAGE.getData(),
s3PreSignedUrlManager.createS3PreSignedUrlForGet(dto.skinUrl()))
.build()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@
import site.timecapsulearchive.notification.data.dto.FriendNotificationsDto;
import site.timecapsulearchive.notification.entity.CategoryName;
import site.timecapsulearchive.notification.infra.exception.MessageNotSendAbleException;
import site.timecapsulearchive.notification.infra.fcm.FCMManager;
import site.timecapsulearchive.notification.infra.fcm.FcmMessageData;
import site.timecapsulearchive.notification.infra.fcm.FCMMessageData;

@Component
@RequiredArgsConstructor
public class FriendFcmManagerImpl implements FriendFcmManager {

private final FCMManager fcmManager;

public void sendFriendNotification(
final FriendNotificationDto dto,
final CategoryName categoryName,
Expand All @@ -29,11 +26,11 @@ public void sendFriendNotification(
FirebaseMessaging.getInstance()
.send(
Message.builder()
.putData(FcmMessageData.TOPIC.getData(), String.valueOf(categoryName))
.putData(FcmMessageData.STATUS.getData(),
.putData(FCMMessageData.TOPIC.getData(), String.valueOf(categoryName))
.putData(FCMMessageData.STATUS.getData(),
String.valueOf(dto.notificationStatus()))
.putData(FcmMessageData.TITLE.getData(), dto.title())
.putData(FcmMessageData.TEXT.getData(), dto.text())
.putData(FCMMessageData.TITLE.getData(), dto.title())
.putData(FCMMessageData.TEXT.getData(), dto.text())
.setToken(fcmToken)
.build()
);
Expand All @@ -52,11 +49,11 @@ public void sendFriendNotifications(
.sendEachForMulticast(
MulticastMessage.builder()
.addAllTokens(fcmTokens)
.putData(FcmMessageData.TOPIC.getData(), String.valueOf(categoryName))
.putData(FcmMessageData.STATUS.getData(),
.putData(FCMMessageData.TOPIC.getData(), String.valueOf(categoryName))
.putData(FCMMessageData.STATUS.getData(),
String.valueOf(dto.notificationStatus()))
.putData(FcmMessageData.TITLE.getData(), dto.title())
.putData(FcmMessageData.TEXT.getData(), dto.text())
.putData(FCMMessageData.TITLE.getData(), dto.title())
.putData(FCMMessageData.TEXT.getData(), dto.text())
.build()
);
} catch (FirebaseMessagingException exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@
import site.timecapsulearchive.notification.data.dto.GroupInviteNotificationDto;
import site.timecapsulearchive.notification.entity.CategoryName;
import site.timecapsulearchive.notification.infra.exception.MessageNotSendAbleException;
import site.timecapsulearchive.notification.infra.fcm.FCMManager;
import site.timecapsulearchive.notification.infra.fcm.FcmMessageData;
import site.timecapsulearchive.notification.infra.fcm.FCMMessageData;
import site.timecapsulearchive.notification.infra.s3.S3PreSignedUrlManager;

@Component
@RequiredArgsConstructor
public class GroupFcmManagerImpl implements GroupFcmManager {

private final FCMManager fcmManager;
private final S3PreSignedUrlManager s3PreSignedUrlManager;

public void sendGroupInviteNotifications(
Expand All @@ -32,12 +30,12 @@ public void sendGroupInviteNotifications(
.sendEachForMulticast(
MulticastMessage.builder()
.addAllTokens(fcmTokens)
.putData(FcmMessageData.TOPIC.getData(), String.valueOf(categoryName))
.putData(FcmMessageData.STATUS.getData(),
.putData(FCMMessageData.TOPIC.getData(), String.valueOf(categoryName))
.putData(FCMMessageData.STATUS.getData(),
String.valueOf(dto.notificationStatus()))
.putData(FcmMessageData.TITLE.getData(), dto.title())
.putData(FcmMessageData.TEXT.getData(), dto.text())
.putData(FcmMessageData.IMAGE.getData(),
.putData(FCMMessageData.TITLE.getData(), dto.title())
.putData(FCMMessageData.TEXT.getData(), dto.text())
.putData(FCMMessageData.IMAGE.getData(),
s3PreSignedUrlManager.createS3PreSignedUrlForGet(dto.groupProfileUrl()))
.build()
);
Expand All @@ -55,11 +53,11 @@ public void sendGroupAcceptNotification(
FirebaseMessaging.getInstance()
.send(
Message.builder()
.putData(FcmMessageData.TOPIC.getData(), String.valueOf(categoryName))
.putData(FcmMessageData.STATUS.getData(),
.putData(FCMMessageData.TOPIC.getData(), String.valueOf(categoryName))
.putData(FCMMessageData.STATUS.getData(),
String.valueOf(dto.notificationStatus()))
.putData(FcmMessageData.TITLE.getData(), dto.title())
.putData(FcmMessageData.TEXT.getData(), dto.text())
.putData(FCMMessageData.TITLE.getData(), dto.title())
.putData(FCMMessageData.TEXT.getData(), dto.text())
.setToken(fcmToken)
.build()
);
Expand Down
Loading