Stop audio on redaction (#1893)

This commit is contained in:
Alfonso Grillo 2023-10-16 10:22:09 +02:00 committed by GitHub
parent 7f09c02298
commit 20143cb84e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -379,7 +379,16 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
if timelineItem is EncryptedHistoryRoomTimelineItem { if timelineItem is EncryptedHistoryRoomTimelineItem {
lastEncryptedHistoryItemIndex = newTimelineItems.endIndex lastEncryptedHistoryItemIndex = newTimelineItems.endIndex
} }
// Stops the audio player when a voice message is redacted.
if timelineItem is RedactedRoomTimelineItem {
guard let audioState = timelineAudioPlayerStates[timelineItem.id] else {
continue
}
audioState.detachAudioPlayer()
timelineAudioPlayerStates.removeValue(forKey: timelineItem.id)
}
newTimelineItems.append(timelineItem) newTimelineItems.append(timelineItem)
} else { } else {
newTimelineItems.append(CollapsibleTimelineItem(items: items)) newTimelineItems.append(CollapsibleTimelineItem(items: items))