mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-17 15:09:31 +02:00
Add reaction content to notifications when available.
This commit is contained in:
@@ -119,8 +119,11 @@
|
||||
|
||||
/** Reactions **/
|
||||
|
||||
/* A user has reacted to a message */
|
||||
"REACTION_FROM_USER" = "%@ sent a reaction";
|
||||
/* A user has reacted to a message, including the reaction e.g. "Alice reacted 👍". */
|
||||
"REACTION_FROM_USER" = "%@ reacted %@";
|
||||
|
||||
/* A user has reacted to a message, but the reaction content is unknown */
|
||||
"GENERIC_REACTION_FROM_USER" = "%@ sent a reaction";
|
||||
|
||||
/** Invites **/
|
||||
|
||||
|
||||
@@ -439,7 +439,13 @@ class NotificationService: UNNotificationServiceExtension {
|
||||
notificationBody = NSString.localizedUserNotificationString(forKey: "STICKER_FROM_USER", arguments: [eventSenderName as Any])
|
||||
case .reaction:
|
||||
notificationTitle = self.messageTitle(for: eventSenderName, in: roomDisplayName)
|
||||
notificationBody = NSString.localizedUserNotificationString(forKey: "REACTION_FROM_USER", arguments: [eventSenderName])
|
||||
if let reactionKey = event.relatesTo?.key {
|
||||
// Try to show the reaction key in the notification.
|
||||
notificationBody = NSString.localizedUserNotificationString(forKey: "REACTION_FROM_USER", arguments: [eventSenderName, reactionKey])
|
||||
} else {
|
||||
// Otherwise show a generic reaction.
|
||||
notificationBody = NSString.localizedUserNotificationString(forKey: "GENERIC_REACTION_FROM_USER", arguments: [eventSenderName])
|
||||
}
|
||||
case .custom:
|
||||
if (event.type == kWidgetMatrixEventTypeString || event.type == kWidgetModularEventTypeString),
|
||||
let type = event.content?["type"] as? String,
|
||||
|
||||
Reference in New Issue
Block a user