Skip to content
Merged
Show file tree
Hide file tree
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 @@ -224,7 +224,7 @@ private void applyMessageStyle(@NonNull Context context, NotificationCompat.Buil

// Use the formatted alert message from the backend. Otherwise fallback on the message in the Onyx data.
String message = alert != null ? alert : messageData.get("message").getList().get(0).getMap().get("text").getString();
String roomName = payload.get("roomName") == null ? "" : payload.get("roomName").getString("");
String subtitle = payload.get("subtitle") == null ? "" : payload.get("subtitle").getString("");

// Create the Person object who sent the latest report comment
Bitmap personIcon = fetchIcon(context, avatar);
Expand Down Expand Up @@ -257,11 +257,11 @@ private void applyMessageStyle(@NonNull Context context, NotificationCompat.Buil
}

// Conversational styling should be applied to groups chats, rooms, and any 1:1 chats with more than one notification (ensuring the large profile image is always shown)
if (!roomName.isEmpty()) {
if (!subtitle.isEmpty()) {
// Create the messaging style notification builder for this notification, associating it with the person who sent the report comment
messagingStyle
.setGroupConversation(true)
.setConversationTitle(roomName);
.setConversationTitle(subtitle);
}
builder.setStyle(messagingStyle);
builder.setShortcutId(accountID);
Expand Down
12 changes: 6 additions & 6 deletions ios/NotificationServiceExtension/NotificationService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class NotificationService: UANotificationServiceExtension {
userName: userName,
title: notificationContent.title,
messageText: notificationContent.body,
roomName: payload["roomName"] as? String
subtitle: payload["subtitle"] as? String
)
}

Expand All @@ -199,8 +199,8 @@ class NotificationService: UANotificationServiceExtension {
// Configure the group/room name if there is one
var speakableGroupName: INSpeakableString? = nil
var recipients: [INPerson]? = nil
if (notificationData.roomName != nil) {
speakableGroupName = INSpeakableString(spokenPhrase: notificationData.roomName ?? "")
if (notificationData.subtitle != nil) {
speakableGroupName = INSpeakableString(spokenPhrase: notificationData.subtitle ?? "")

// To add the group name subtitle there must be multiple recipients set. However, we do not have
// data on the participatns in the room/group chat so we just add a placeholder here. This shouldn't
Expand Down Expand Up @@ -262,16 +262,16 @@ class NotificationData {
public var userName: String
public var title: String
public var messageText: String
public var roomName: String?
public var subtitle: String?

public init (reportID: Int64, reportActionID: String, avatarURL: String, accountID: Int, userName: String, title: String, messageText: String, roomName: String?) {
public init (reportID: Int64, reportActionID: String, avatarURL: String, accountID: Int, userName: String, title: String, messageText: String, subtitle: String?) {
self.reportID = reportID
self.reportActionID = reportActionID
self.avatarURL = avatarURL
self.accountID = accountID
self.userName = userName
self.title = title
self.messageText = messageText
self.roomName = roomName
self.subtitle = subtitle
}
}
5 changes: 2 additions & 3 deletions src/libs/Notification/PushNotification/NotificationType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type PushNotificationData = ReportActionPushNotificationData | TransactionPushNo

type BasePushNotificationData = {
title: string;
subtitle: string;
type: ValueOf<typeof NotificationType>;
onyxData?: OnyxServerUpdate[];
lastUpdateID?: number;
Expand All @@ -29,13 +30,11 @@ type BasePushNotificationData = {
type ReportActionPushNotificationData = BasePushNotificationData & {
reportID: number;
reportActionID: string;
roomName?: string;
};

type TransactionPushNotificationData = BasePushNotificationData & {
transactionID: number;
reportID: number;
roomName?: string;
transactionID: number;
};

/**
Expand Down