Add voice message notification body.

This commit is contained in:
Doug
2021-08-04 16:14:02 +01:00
parent 62861ac1a2
commit a4e018f083
2 changed files with 8 additions and 1 deletions

View File

@@ -65,6 +65,9 @@
/* New audio message from a specific person, not referencing a room. */
"AUDIO_FROM_USER" = "%@ sent an audio file %@";
/* New voice message from a specific person, not referencing a room. */
"VOICE_MESSAGE_FROM_USER" = "%@ sent a voice message";
/* New file message from a specific person, not referencing a room. */
"FILE_FROM_USER" = "%@ sent a file %@";

View File

@@ -383,7 +383,11 @@ class NotificationService: UNNotificationServiceExtension {
case kMXMessageTypeVideo:
notificationBody = NSString.localizedUserNotificationString(forKey: "VIDEO_FROM_USER", arguments: [eventSenderName, messageContent as Any])
case kMXMessageTypeAudio:
notificationBody = NSString.localizedUserNotificationString(forKey: "AUDIO_FROM_USER", arguments: [eventSenderName, messageContent as Any])
if event.isVoiceMessage() {
notificationBody = NSString.localizedUserNotificationString(forKey: "VOICE_MESSAGE_FROM_USER", arguments: [eventSenderName])
} else {
notificationBody = NSString.localizedUserNotificationString(forKey: "AUDIO_FROM_USER", arguments: [eventSenderName, messageContent as Any])
}
case kMXMessageTypeFile:
notificationBody = NSString.localizedUserNotificationString(forKey: "FILE_FROM_USER", arguments: [eventSenderName, messageContent as Any])