Skip to content

Commit

Permalink
Merge pull request #195 from kookmin-sw/#194-fcm
Browse files Browse the repository at this point in the history
[feat] 푸시 알림 백그라운드 활성화를 위한 Notification 추가
  • Loading branch information
tmdtmdqorekf authored May 8, 2024
2 parents 6e2df4a + f75b623 commit a1d787d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class FcmPushMessageDto {
@RequiredArgsConstructor
public static class Message {
private Data data;
private Notification notification;
private String token;
}

Expand All @@ -26,4 +27,12 @@ public static class Data {
private String title;
private String body;
}

@Getter
@Setter
@RequiredArgsConstructor
public static class Notification {
private String title;
private String body;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.coffee.backend.domain.fcm.dto.FcmPushMessageDto;
import com.coffee.backend.domain.fcm.dto.FcmPushMessageDto.Data;
import com.coffee.backend.domain.fcm.dto.FcmPushMessageDto.Message;
import com.coffee.backend.domain.fcm.dto.FcmPushMessageDto.Notification;
import com.coffee.backend.exception.CustomException;
import com.coffee.backend.exception.ErrorCode;
import com.fasterxml.jackson.core.JsonProcessingException;
Expand Down Expand Up @@ -70,8 +71,13 @@ private String makePushMessage(String targetToken, String title, String body) th
data.setTitle(title);
data.setBody(body);

Notification notification = new Notification();
data.setTitle(title);
data.setBody(body);

Message message = new Message();
message.setData(data);
message.setNotification(notification);
message.setToken(targetToken);

FcmPushMessageDto fcmPushMessageDto = new FcmPushMessageDto(false, message);
Expand Down

0 comments on commit a1d787d

Please sign in to comment.