From 4a8a6d170b601c06909dc2e5172c10dbc1c4a3d0 Mon Sep 17 00:00:00 2001 From: ganfra Date: Thu, 17 Jun 2021 12:09:30 +0200 Subject: [PATCH] Clean and add towncrier file --- newsfragment/3520.misc | 1 + .../app/features/call/lookup/CallUserMapper.kt | 4 ++-- .../features/home/room/detail/RoomDetailViewModel.kt | 3 +-- .../room/detail/timeline/factory/CallItemFactory.kt | 2 +- .../room/detail/timeline/merged/MergedTimelines.kt | 12 ++++++++++-- 5 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 newsfragment/3520.misc diff --git a/newsfragment/3520.misc b/newsfragment/3520.misc new file mode 100644 index 0000000000..d015c3e03d --- /dev/null +++ b/newsfragment/3520.misc @@ -0,0 +1 @@ +VoIP: Merge virtual room timeline in corresponding native room (call events only). \ No newline at end of file diff --git a/vector/src/main/java/im/vector/app/features/call/lookup/CallUserMapper.kt b/vector/src/main/java/im/vector/app/features/call/lookup/CallUserMapper.kt index 161b6d59c8..aa7654c405 100644 --- a/vector/src/main/java/im/vector/app/features/call/lookup/CallUserMapper.kt +++ b/vector/src/main/java/im/vector/app/features/call/lookup/CallUserMapper.kt @@ -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) { fun nativeRoomForVirtualRoom(roomId: String): String? { - if(!protocolsChecker.supportVirtualRooms) return null + if (!protocolsChecker.supportVirtualRooms) return null val virtualRoom = session.getRoom(roomId) ?: return null val virtualRoomEvent = virtualRoom.getAccountDataEvent(RoomAccountDataTypes.EVENT_TYPE_VIRTUAL_ROOM) return virtualRoomEvent?.content?.toModel()?.nativeRoomId } 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)) return virtualRoomEvents.firstOrNull { val virtualRoomContent = it.content.toModel() diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt index 29a206eadd..69aa1e83d3 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt @@ -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.timeline.factory.TimelineFactory 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.typing.TypingHelper import im.vector.app.features.powerlevel.PowerLevelsObservableFactory @@ -119,7 +118,7 @@ class RoomDetailViewModel @AssistedInject constructor( private val chatEffectManager: ChatEffectManager, private val directRoomHelper: DirectRoomHelper, private val jitsiService: JitsiService, - private val timelineFactory: TimelineFactory, + timelineFactory: TimelineFactory ) : VectorViewModel(initialState), Timeline.Listener, ChatEffectManager.Delegate, CallProtocolsChecker.Listener { diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/CallItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/CallItemFactory.kt index bb6b61e8e9..9697fb6672 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/CallItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/CallItemFactory.kt @@ -135,7 +135,7 @@ class CallItemFactory @Inject constructor( isStillActive: Boolean, callback: TimelineEventController.Callback? ): 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 attributes = messageItemAttributesFactory.create(null, informationData, callback).let { CallTileTimelineItem.Attributes( diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/merged/MergedTimelines.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/merged/MergedTimelines.kt index 480fd43037..0d5dbc5a8e 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/merged/MergedTimelines.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/merged/MergedTimelines.kt @@ -77,10 +77,18 @@ class MergedTimelines( } 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) } - 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) } listenersMapping[listener] = listOf(mainTimelineListener, secondaryTimelineListener)