Skip to content

Commit

Permalink
feat: #126 앱 내의 특정뷰로 이동을 위한 원격알림 데이터 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
jaewonLeeKOR committed Sep 12, 2024
1 parent d87a6c4 commit 9a48f05
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ public class ApnsClientRequest {
@ToString
public static class SimplePushBody {
private Aps aps;
private String boardId;
private String boardCommentId;
@Builder
public SimplePushBody(String title, String subTitle, String body, Integer badge, String sound, String threadId, String targetContentId) {
public SimplePushBody(String title, String subTitle, String body, Integer badge, String sound, String threadId, String targetContentId, String boardId, String boardCommentId) {
this.aps = new Aps(new Aps.Alert(title, subTitle, body), badge, sound, threadId, targetContentId);
this.boardId = boardId;
this.boardCommentId = boardCommentId;
}

@ToString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public void sendBoardHeartNotification(Long actorId, Board board) {
.body(board.getContent())
.threadId("board-" + board.getId())
.sound("default")
.boardId(board.getId().toString())
.build(), board.getWriter().getId());
// TODO 알림 데이터베이스 저장
}
Expand All @@ -46,6 +47,8 @@ public void sendBoardCommentNotification(Long actorId, Board board, BoardComment
.body(board.getContent())
.threadId("board-" + board.getId())
.sound("default")
.boardId(board.getId().toString())
.boardCommentId(boardComment.getId().toString())
.build(), subscriberId);
}
})
Expand All @@ -57,6 +60,8 @@ public void sendBoardCommentNotification(Long actorId, Board board, BoardComment
.body(board.getContent())
.threadId("board-" + board.getId())
.sound("default")
.boardId(board.getId().toString())
.boardCommentId(boardComment.getId().toString())
.build();
apnsService.sendApnsToMembers(simplePushBody, subscriberIds);
// TODO 알림 데이터베이스 저장
Expand All @@ -70,6 +75,8 @@ public void sendBoardCommentHeartNotification(Long actorId, Board board, BoardCo
.body(board.getContent())
.threadId("board-" + board.getId())
.sound("default")
.boardId(board.getId().toString())
.boardCommentId(boardComment.getId().toString())
.build(), boardComment.getMember().getId());
// TODO 알림 데이터베이스 저장
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void sendApns() {
String targetContentId = "targetContentId";

//when
Boolean result = apnsService.sendApns(new SimplePushBody(title, subTitle, body, null, "default", threadId, targetContentId), List.of(simulatorDeviceToken));
Boolean result = apnsService.sendApns(SimplePushBody.builder().title(title).subTitle(subTitle).body(body).sound("default").threadId(threadId).targetContentId(targetContentId).build(), List.of(simulatorDeviceToken));

//then
assertTrue(result);
Expand All @@ -55,7 +55,7 @@ void sendApnsMessages() {
for (int i = 0; i < 100; i++) deviceTokens.add(simulatorDeviceToken);

//when
Boolean result = apnsService.sendApns(new SimplePushBody(title, subTitle, body, null, "default", threadId, targetContentId), deviceTokens);
Boolean result = apnsService.sendApns(SimplePushBody.builder().title(title).subTitle(subTitle).body(body).sound("default").threadId(threadId).targetContentId(targetContentId).build(), deviceTokens);

//then
assertTrue(result);
Expand Down

0 comments on commit 9a48f05

Please sign in to comment.