Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class NotificationService {
private static final String EXPO_PUSH_URL = "https://exp.host/--/api/v2/push/send";
private static final Pattern EXPO_PUSH_TOKEN_PATTERN =
Pattern.compile("^(ExponentPushToken|ExpoPushToken)\\[[^\\]]+\\]$");
private static final String DEFAULT_NOTIFICATION_CHANNEL_ID = "default_notifications";
private static final int CHAT_MESSAGE_PREVIEW_MAX_LENGTH = 30;
private static final String CHAT_MESSAGE_PREVIEW_SUFFIX = "...";

Expand Down Expand Up @@ -118,7 +119,7 @@ public void sendChatNotification(Integer receiverId, Integer roomId, String send
data.put("path", "chats/" + roomId);

List<ExpoPushMessage> messages = tokens.stream()
.map(token -> new ExpoPushMessage(token, senderName, truncatedBody, data))
.map(token -> new ExpoPushMessage(token, senderName, truncatedBody, data, DEFAULT_NOTIFICATION_CHANNEL_ID))
.toList();

HttpHeaders headers = new HttpHeaders();
Expand Down Expand Up @@ -238,7 +239,7 @@ public void sendGroupChatNotification(
}

List<ExpoPushMessage> messages = tokens.stream()
.map(token -> new ExpoPushMessage(token, clubName, previewBody, data))
.map(token -> new ExpoPushMessage(token, clubName, previewBody, data, DEFAULT_NOTIFICATION_CHANNEL_ID))
.toList();

HttpHeaders headers = new HttpHeaders();
Expand Down Expand Up @@ -344,7 +345,7 @@ private void sendNotification(Integer receiverId, String title, String body, Str
Map<String, Object> data = buildData(null, path);

List<ExpoPushMessage> messages = tokens.stream()
.map(token -> new ExpoPushMessage(token, title, body, data))
.map(token -> new ExpoPushMessage(token, title, body, data, DEFAULT_NOTIFICATION_CHANNEL_ID))
.toList();

HttpHeaders headers = new HttpHeaders();
Expand Down Expand Up @@ -421,7 +422,7 @@ private String buildPreview(String messageContent) {
return messageContent.substring(0, endIndex) + CHAT_MESSAGE_PREVIEW_SUFFIX;
}

private record ExpoPushMessage(String to, String title, String body, Map<String, Object> data) {
private record ExpoPushMessage(String to, String title, String body, Map<String, Object> data, String channelId) {
}

private record ExpoPushResponse(List<ExpoPushTicket> data) {
Expand Down
Loading