Clean and add towncrier file

This commit is contained in:
ganfra 2021-06-17 12:09:30 +02:00
parent 1d8b9f879b
commit 4a8a6d170b
5 changed files with 15 additions and 7 deletions

1
newsfragment/3520.misc Normal file
View File

@ -0,0 +1 @@
VoIP: Merge virtual room timeline in corresponding native room (call events only).

View File

@ -27,14 +27,14 @@ import org.matrix.android.sdk.api.session.room.model.create.CreateRoomParams
class CallUserMapper(private val session: Session, private val protocolsChecker: CallProtocolsChecker) { class CallUserMapper(private val session: Session, private val protocolsChecker: CallProtocolsChecker) {
fun nativeRoomForVirtualRoom(roomId: String): String? { fun nativeRoomForVirtualRoom(roomId: String): String? {
if(!protocolsChecker.supportVirtualRooms) return null if (!protocolsChecker.supportVirtualRooms) return null
val virtualRoom = session.getRoom(roomId) ?: return null val virtualRoom = session.getRoom(roomId) ?: return null
val virtualRoomEvent = virtualRoom.getAccountDataEvent(RoomAccountDataTypes.EVENT_TYPE_VIRTUAL_ROOM) val virtualRoomEvent = virtualRoom.getAccountDataEvent(RoomAccountDataTypes.EVENT_TYPE_VIRTUAL_ROOM)
return virtualRoomEvent?.content?.toModel<RoomVirtualContent>()?.nativeRoomId return virtualRoomEvent?.content?.toModel<RoomVirtualContent>()?.nativeRoomId
} }
fun virtualRoomForNativeRoom(roomId: String): String? { fun virtualRoomForNativeRoom(roomId: String): String? {
if(!protocolsChecker.supportVirtualRooms) return null if (!protocolsChecker.supportVirtualRooms) return null
val virtualRoomEvents = session.accountDataService().getRoomAccountDataEvents(setOf(RoomAccountDataTypes.EVENT_TYPE_VIRTUAL_ROOM)) val virtualRoomEvents = session.accountDataService().getRoomAccountDataEvents(setOf(RoomAccountDataTypes.EVENT_TYPE_VIRTUAL_ROOM))
return virtualRoomEvents.firstOrNull { return virtualRoomEvents.firstOrNull {
val virtualRoomContent = it.content.toModel<RoomVirtualContent>() val virtualRoomContent = it.content.toModel<RoomVirtualContent>()

View File

@ -50,7 +50,6 @@ import im.vector.app.features.home.room.detail.composer.rainbow.RainbowGenerator
import im.vector.app.features.home.room.detail.sticker.StickerPickerActionHandler import im.vector.app.features.home.room.detail.sticker.StickerPickerActionHandler
import im.vector.app.features.home.room.detail.timeline.factory.TimelineFactory import im.vector.app.features.home.room.detail.timeline.factory.TimelineFactory
import im.vector.app.features.home.room.detail.timeline.helper.RoomSummariesHolder import im.vector.app.features.home.room.detail.timeline.helper.RoomSummariesHolder
import im.vector.app.features.home.room.detail.timeline.helper.TimelineSettingsFactory
import im.vector.app.features.home.room.detail.timeline.url.PreviewUrlRetriever import im.vector.app.features.home.room.detail.timeline.url.PreviewUrlRetriever
import im.vector.app.features.home.room.typing.TypingHelper import im.vector.app.features.home.room.typing.TypingHelper
import im.vector.app.features.powerlevel.PowerLevelsObservableFactory import im.vector.app.features.powerlevel.PowerLevelsObservableFactory
@ -119,7 +118,7 @@ class RoomDetailViewModel @AssistedInject constructor(
private val chatEffectManager: ChatEffectManager, private val chatEffectManager: ChatEffectManager,
private val directRoomHelper: DirectRoomHelper, private val directRoomHelper: DirectRoomHelper,
private val jitsiService: JitsiService, private val jitsiService: JitsiService,
private val timelineFactory: TimelineFactory, timelineFactory: TimelineFactory
) : VectorViewModel<RoomDetailViewState, RoomDetailAction, RoomDetailViewEvents>(initialState), ) : VectorViewModel<RoomDetailViewState, RoomDetailAction, RoomDetailViewEvents>(initialState),
Timeline.Listener, ChatEffectManager.Delegate, CallProtocolsChecker.Listener { Timeline.Listener, ChatEffectManager.Delegate, CallProtocolsChecker.Listener {

View File

@ -135,7 +135,7 @@ class CallItemFactory @Inject constructor(
isStillActive: Boolean, isStillActive: Boolean,
callback: TimelineEventController.Callback? callback: TimelineEventController.Callback?
): CallTileTimelineItem? { ): CallTileTimelineItem? {
val correctedRoomId = session.vectorCallService.userMapper.nativeRoomForVirtualRoom(roomId) ?:roomId val correctedRoomId = session.vectorCallService.userMapper.nativeRoomForVirtualRoom(roomId) ?: roomId
val userOfInterest = roomSummariesHolder.get(correctedRoomId)?.toMatrixItem() ?: return null val userOfInterest = roomSummariesHolder.get(correctedRoomId)?.toMatrixItem() ?: return null
val attributes = messageItemAttributesFactory.create(null, informationData, callback).let { val attributes = messageItemAttributesFactory.create(null, informationData, callback).let {
CallTileTimelineItem.Attributes( CallTileTimelineItem.Attributes(

View File

@ -77,10 +77,18 @@ class MergedTimelines(
} }
override fun addListener(listener: Timeline.Listener): Boolean { override fun addListener(listener: Timeline.Listener): Boolean {
val mainTimelineListener = ListenerInterceptor(mainTimeline, listener, false, emptyList()) { val mainTimelineListener = ListenerInterceptor(
timeline = mainTimeline,
wrappedListener = listener,
shouldFilterTypes = false,
allowedTypes = emptyList()) {
processTimelineUpdates(::mainIsInit, mainTimelineEvents, it) processTimelineUpdates(::mainIsInit, mainTimelineEvents, it)
} }
val secondaryTimelineListener = ListenerInterceptor(secondaryTimeline, listener, secondaryTimelineParams.shouldFilterTypes, secondaryTimelineParams.allowedTypes) { val secondaryTimelineListener = ListenerInterceptor(
timeline = secondaryTimeline,
wrappedListener = listener,
shouldFilterTypes = secondaryTimelineParams.shouldFilterTypes,
allowedTypes = secondaryTimelineParams.allowedTypes) {
processTimelineUpdates(::secondaryIsInit, secondaryTimelineEvents, it) processTimelineUpdates(::secondaryIsInit, secondaryTimelineEvents, it)
} }
listenersMapping[listener] = listOf(mainTimelineListener, secondaryTimelineListener) listenersMapping[listener] = listOf(mainTimelineListener, secondaryTimelineListener)