Skip to content

Commit

Permalink
[HOTFIX] add apns config
Browse files Browse the repository at this point in the history
  • Loading branch information
ohksj77 committed Jan 4, 2024
1 parent 3feee6d commit 7554e3a
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.twtw.backend.domain.notification.dto;

import com.google.firebase.messaging.ApnsConfig;
import com.google.firebase.messaging.Aps;
import com.google.firebase.messaging.Message;
import com.google.firebase.messaging.Notification;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
Expand All @@ -14,12 +15,22 @@
@AllArgsConstructor
public class NotificationRequest {

private static final ApnsConfig APNS_CONFIG = ApnsConfig.builder()
.putHeader("apns-priority", "10")
.setAps(Aps.builder()
.setBadge(1)
.build()).build();

private String deviceToken;
private String title;
private String body;

public Message toMessage() {
return Message.builder().setToken(deviceToken).setNotification(toNotification()).build();
return Message.builder()
.setApnsConfig(APNS_CONFIG)
.setToken(deviceToken)
.setNotification(toNotification())
.build();
}

private Notification toNotification() {
Expand Down

0 comments on commit 7554e3a

Please sign in to comment.