Skip to content

Commit

Permalink
!hotfix: 알림 전송 실패 시 로그 추가 및 이미지 null 처리 문제 해결 (#384)
Browse files Browse the repository at this point in the history
* feat: 알림 전송 실패 시 로그 추가

* fix: 이미지 null 처리 문제 해결
  • Loading branch information
kwonyj1022 authored and apptie committed Oct 7, 2023
1 parent 571a90a commit 1b3f97d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ public Long create(final CreateMessageDto dto, final String baseUrl) {

private void sendNotification(final Message message, final String baseUrl) {
final Long profileImageId = ImageIdProcessor.process(message.getWriter().getProfileImage());
final String profileImageUrl = baseUrl.concat(String.valueOf(profileImageId));

// TODO: 2023/09/15 5차데모데이 이후 수정 예정
String profileImageUrl = null;
if (profileImageId != null) {
profileImageUrl = baseUrl.concat(String.valueOf(profileImageId));
}

final CreateNotificationDto dto = new CreateNotificationDto(
NotificationType.MESSAGE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.google.firebase.messaging.FirebaseMessagingException;
import com.google.firebase.messaging.Message;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

Expand All @@ -20,6 +21,7 @@
@Service
@Transactional(readOnly = true)
@RequiredArgsConstructor
@Slf4j
public class FcmNotificationService implements NotificationService {

private static final String NOTIFICATION_SEND_SUCCESS = "알림 전송 성공";
Expand Down Expand Up @@ -55,6 +57,7 @@ private String makeAndSendMessage(
firebaseMessaging.send(message);
return NOTIFICATION_SEND_SUCCESS;
} catch (FirebaseMessagingException ex) {
log.error("exception type : {}, ", ex.getClass().getSimpleName(), ex);
return NOTIFICATION_SEND_FAIL;
}
}
Expand Down

0 comments on commit 1b3f97d

Please sign in to comment.