Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Voice Broadcast] Remove chunks from the room attachments #7656

Merged
merged 2 commits into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/7656.wip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Voice Broadcast - Remove voice messages related to a VB from the room attachments
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -257,7 +256,7 @@ class TimelineEventVisibilityHelper @Inject constructor(
return true
}

if (root.asMessageAudioEvent()?.isVoiceBroadcast().orFalse()) {
if (root.asMessageAudioEvent().isVoiceBroadcast()) {
return true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down