From 923b0806b7105baa50d5f29408babeeac377d540 Mon Sep 17 00:00:00 2001 From: hocaron Date: Thu, 19 Sep 2024 22:38:41 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20fcm=20deprecated=20api=20=EB=8C=80?= =?UTF-8?q?=EC=9D=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/pushnoti/PushNotiEventListener.java | 2 +- mashup-domain/build.gradle | 2 +- .../pushnoti/FcmPushNotiService.java | 14 ++++++-------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/mashup-admin/src/main/java/kr/mashup/branding/ui/pushnoti/PushNotiEventListener.java b/mashup-admin/src/main/java/kr/mashup/branding/ui/pushnoti/PushNotiEventListener.java index 5ca326eaa..7730d2b50 100644 --- a/mashup-admin/src/main/java/kr/mashup/branding/ui/pushnoti/PushNotiEventListener.java +++ b/mashup-admin/src/main/java/kr/mashup/branding/ui/pushnoti/PushNotiEventListener.java @@ -39,7 +39,7 @@ public void handleSendPushNotiEvent(PushNotiSendVo event) { pushNotiService.sendPushNotification(event); }catch (Exception ignored){ log.error("[SEND_PUSH_FAIL] failed to send push memberIds {} , title {} , body {}", - extractMemberIds(event), event.getTitle(), event.getBody()); + extractMemberIds(event), event.getTitle(), event.getBody(), ignored); } } diff --git a/mashup-domain/build.gradle b/mashup-domain/build.gradle index 3d26378c3..705529260 100644 --- a/mashup-domain/build.gradle +++ b/mashup-domain/build.gradle @@ -22,7 +22,7 @@ dependencies{ implementation "com.github.ulisesbocchio:jasypt-spring-boot-starter:$jasyptVersion" implementation 'com.querydsl:querydsl-jpa' implementation 'com.querydsl:querydsl-apt' - implementation 'com.google.firebase:firebase-admin:7.1.0' + implementation 'com.google.firebase:firebase-admin:9.3.0' annotationProcessor "com.querydsl:querydsl-apt:${dependencyManagement.importedProperties['querydsl.version']}:jpa" annotationProcessor 'jakarta.persistence:jakarta.persistence-api' annotationProcessor 'jakarta.annotation:jakarta.annotation-api' diff --git a/mashup-domain/src/main/java/kr/mashup/branding/infrastructure/pushnoti/FcmPushNotiService.java b/mashup-domain/src/main/java/kr/mashup/branding/infrastructure/pushnoti/FcmPushNotiService.java index e7f83fa05..3a7ebb1d0 100644 --- a/mashup-domain/src/main/java/kr/mashup/branding/infrastructure/pushnoti/FcmPushNotiService.java +++ b/mashup-domain/src/main/java/kr/mashup/branding/infrastructure/pushnoti/FcmPushNotiService.java @@ -1,22 +1,20 @@ package kr.mashup.branding.infrastructure.pushnoti; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -import org.springframework.stereotype.Service; - import com.google.firebase.FirebaseApp; import com.google.firebase.messaging.FirebaseMessaging; import com.google.firebase.messaging.FirebaseMessagingException; import com.google.firebase.messaging.MulticastMessage; import com.google.firebase.messaging.Notification; - import kr.mashup.branding.domain.member.Member; import kr.mashup.branding.domain.pushnoti.exception.PushNotiException; import kr.mashup.branding.domain.pushnoti.vo.PushNotiSendVo; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; @Slf4j @Service @@ -34,7 +32,7 @@ public void sendPushNotification(PushNotiSendVo pushNotiSendVo) { .addAllTokens(getAgreedFcmTokens(pushNotiSendVo.getMembers())) .build(); try { - FirebaseMessaging.getInstance(firebaseApp).sendMulticast(multicastMessage); + FirebaseMessaging.getInstance(firebaseApp).sendEachForMulticast(multicastMessage); } catch (FirebaseMessagingException e) { throw new PushNotiException(); }