Skip to content

Commit

Permalink
Ignore the voice broadcast chunks at the notifications level (#7230)
Browse files Browse the repository at this point in the history
  • Loading branch information
yostyle committed Jan 10, 2023
1 parent 490c7bc commit 4cb21f7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Riot/Assets/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@
/* Sticker from a specific person, not referencing a room. */
"STICKER_FROM_USER" = "%@ sent a sticker";

/* New voice broadcast from a specific person, not referencing a room. */
"VOICE_BROADCAST_FROM_USER" = "%@ started a voice broadcast";

/** Notification messages **/

/* New message indicator on unknown room */
Expand Down
9 changes: 8 additions & 1 deletion RiotNSE/NotificationService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,14 @@ class NotificationService: UNNotificationServiceExtension {
notificationBody = NotificationService.localizedString(forKey: "VIDEO_FROM_USER", eventSenderName)
case kMXMessageTypeAudio:
if event.isVoiceMessage() {
notificationBody = NotificationService.localizedString(forKey: "VOICE_MESSAGE_FROM_USER", eventSenderName)
// Ignore voice broadcast chunk event except the first one.
if let chunkInfo = event.content[VoiceBroadcastSettings.voiceBroadcastContentKeyChunkType] as? [String: UInt] {
if chunkInfo[VoiceBroadcastSettings.voiceBroadcastContentKeyChunkSequence] == 1 {
notificationBody = NotificationService.localizedString(forKey: "VOICE_BROADCAST_FROM_USER", eventSenderName)
}
} else {
notificationBody = NotificationService.localizedString(forKey: "VOICE_MESSAGE_FROM_USER", eventSenderName)
}
} else {
notificationBody = NotificationService.localizedString(forKey: "AUDIO_FROM_USER", eventSenderName, messageContent)
}
Expand Down
1 change: 1 addition & 0 deletions changelog.d/pr-7230.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ignore the voice broadcast chunks at the notifications level

0 comments on commit 4cb21f7

Please sign in to comment.