Remove voice broadcast chunks from the room attachments list

This commit is contained in:
Florian Renaud 2022-11-29 01:41:31 +01:00
parent 7b4c165033
commit 471bf853c8
2 changed files with 5 additions and 2 deletions

View File

@ -22,7 +22,6 @@ import im.vector.app.features.voicebroadcast.VoiceBroadcastConstants
import im.vector.app.features.voicebroadcast.isVoiceBroadcast
import im.vector.app.features.voicebroadcast.model.VoiceBroadcastState
import im.vector.app.features.voicebroadcast.model.asVoiceBroadcastEvent
import org.matrix.android.sdk.api.extensions.orFalse
import org.matrix.android.sdk.api.session.events.model.Event
import org.matrix.android.sdk.api.session.events.model.EventType
import org.matrix.android.sdk.api.session.events.model.RelationType
@ -257,7 +256,7 @@ class TimelineEventVisibilityHelper @Inject constructor(
return true
}
if (root.asMessageAudioEvent()?.isVoiceBroadcast().orFalse()) {
if (root.asMessageAudioEvent().isVoiceBroadcast()) {
return true
}

View File

@ -26,10 +26,12 @@ import dagger.assisted.AssistedInject
import im.vector.app.core.di.MavericksAssistedViewModelFactory
import im.vector.app.core.di.hiltMavericksViewModelFactory
import im.vector.app.core.platform.VectorViewModel
import im.vector.app.features.voicebroadcast.isVoiceBroadcast
import kotlinx.coroutines.launch
import org.matrix.android.sdk.api.session.Session
import org.matrix.android.sdk.api.session.getRoom
import org.matrix.android.sdk.api.session.room.model.message.MessageType
import org.matrix.android.sdk.api.session.room.model.message.asMessageAudioEvent
import org.matrix.android.sdk.flow.flow
import org.matrix.android.sdk.flow.unwrap
@ -78,6 +80,8 @@ class RoomUploadsViewModel @AssistedInject constructor(
token = result.nextToken
val groupedUploadEvents = result.uploadEvents
// Remove voice broadcast chunks from the attachments
.filterNot { it.root.asMessageAudioEvent().isVoiceBroadcast() }
.groupBy {
it.contentWithAttachmentContent.msgType == MessageType.MSGTYPE_IMAGE ||
it.contentWithAttachmentContent.msgType == MessageType.MSGTYPE_VIDEO