From 7c5299eb267d4d3c39142f4b2b6784537eb53150 Mon Sep 17 00:00:00 2001 From: Yamil Medina Date: Fri, 6 Dec 2024 21:22:18 -0300 Subject: [PATCH] revert: conference simulcast support (WPB-11480) (#3717) --- .../ui/calling/ongoing/OngoingCallScreen.kt | 12 +--- .../calling/ongoing/OngoingCallViewModel.kt | 26 +------ .../ongoing/fullscreen/FullScreenTile.kt | 6 -- .../ongoing/fullscreen/SelectedParticipant.kt | 8 +-- .../ui/calling/OngoingCallViewModelTest.kt | 69 ------------------- gradle/libs.versions.toml | 2 +- kalium | 2 +- 7 files changed, 7 insertions(+), 118 deletions(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/OngoingCallScreen.kt b/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/OngoingCallScreen.kt index ec577f2c221..f9877a1fa6d 100644 --- a/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/OngoingCallScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/OngoingCallScreen.kt @@ -177,8 +177,6 @@ fun OngoingCallScreen( clearVideoPreview = sharedCallingViewModel::clearVideoPreview, onCollapse = onCollapse, requestVideoStreams = ongoingCallViewModel::requestVideoStreams, - onSelectedParticipant = ongoingCallViewModel::onSelectedParticipant, - selectedParticipantForFullScreen = ongoingCallViewModel.selectedParticipant, hideDoubleTapToast = ongoingCallViewModel::hideDoubleTapToast, onCameraPermissionPermanentlyDenied = onCameraPermissionPermanentlyDenied, participants = sharedCallingViewModel.participantsState, @@ -291,8 +289,6 @@ private fun OngoingCallContent( hideDoubleTapToast: () -> Unit, onCameraPermissionPermanentlyDenied: () -> Unit, requestVideoStreams: (participants: List) -> Unit, - onSelectedParticipant: (selectedParticipant: SelectedParticipant) -> Unit, - selectedParticipantForFullScreen: SelectedParticipant, participants: PersistentList, inPictureInPictureMode: Boolean, currentUserId: UserId, @@ -307,6 +303,7 @@ private fun OngoingCallContent( ) var shouldOpenFullScreen by remember { mutableStateOf(false) } + var selectedParticipantForFullScreen by remember { mutableStateOf(SelectedParticipant()) } WireBottomSheetScaffold( sheetDragHandle = null, @@ -394,14 +391,11 @@ private fun OngoingCallContent( selectedParticipant = selectedParticipantForFullScreen, height = this@BoxWithConstraints.maxHeight - dimensions().spacing4x, closeFullScreen = { - onSelectedParticipant(SelectedParticipant()) shouldOpenFullScreen = !shouldOpenFullScreen }, onBackButtonClicked = { - onSelectedParticipant(SelectedParticipant()) shouldOpenFullScreen = !shouldOpenFullScreen }, - requestVideoStreams = requestVideoStreams, setVideoPreview = setVideoPreview, clearVideoPreview = clearVideoPreview, participants = participants @@ -418,7 +412,7 @@ private fun OngoingCallContent( requestVideoStreams = requestVideoStreams, currentUserId = currentUserId, onDoubleTap = { selectedParticipant -> - onSelectedParticipant(selectedParticipant) + selectedParticipantForFullScreen = selectedParticipant shouldOpenFullScreen = !shouldOpenFullScreen }, ) @@ -586,8 +580,6 @@ fun PreviewOngoingCallContent(participants: PersistentList) { participants = participants, inPictureInPictureMode = false, currentUserId = UserId("userId", "domain"), - onSelectedParticipant = {}, - selectedParticipantForFullScreen = SelectedParticipant(), ) } diff --git a/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/OngoingCallViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/OngoingCallViewModel.kt index 84c6e1a57d1..8e07e40bc1b 100644 --- a/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/OngoingCallViewModel.kt +++ b/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/OngoingCallViewModel.kt @@ -28,10 +28,8 @@ import com.wire.android.appLogger import com.wire.android.datastore.GlobalDataStore import com.wire.android.di.CurrentAccount import com.wire.android.ui.calling.model.UICallParticipant -import com.wire.android.ui.calling.ongoing.fullscreen.SelectedParticipant import com.wire.kalium.logic.data.call.Call import com.wire.kalium.logic.data.call.CallClient -import com.wire.kalium.logic.data.call.CallQuality import com.wire.kalium.logic.data.call.VideoState import com.wire.kalium.logic.data.id.ConversationId import com.wire.kalium.logic.data.user.UserId @@ -65,8 +63,6 @@ class OngoingCallViewModel @AssistedInject constructor( var state by mutableStateOf(OngoingCallState()) private set - var selectedParticipant by mutableStateOf(SelectedParticipant()) - private set init { viewModelScope.launch { @@ -128,11 +124,7 @@ class OngoingCallViewModel @AssistedInject constructor( .also { if (it.isNotEmpty()) { val clients: List = it.map { uiParticipant -> - CallClient( - userId = uiParticipant.id.toString(), - clientId = uiParticipant.clientId, - quality = mapQualityStream(uiParticipant) - ) + CallClient(uiParticipant.id.toString(), uiParticipant.clientId) } requestVideoStreams(conversationId, clients) } @@ -140,20 +132,12 @@ class OngoingCallViewModel @AssistedInject constructor( } } - private fun mapQualityStream(uiParticipant: UICallParticipant): CallQuality { - return if (uiParticipant.clientId == selectedParticipant.clientId) { - CallQuality.HIGH - } else { - CallQuality.LOW - } - } - private fun startDoubleTapToastDisplayCountDown() { doubleTapIndicatorCountDownTimer?.cancel() doubleTapIndicatorCountDownTimer = object : CountDownTimer(DOUBLE_TAP_TOAST_DISPLAY_TIME, COUNT_DOWN_INTERVAL) { override fun onTick(p0: Long) { - appLogger.d("$TAG - startDoubleTapToastDisplayCountDown: $p0") + appLogger.i("startDoubleTapToastDisplayCountDown: $p0") } override fun onFinish() { @@ -187,16 +171,10 @@ class OngoingCallViewModel @AssistedInject constructor( } } - fun onSelectedParticipant(selectedParticipant: SelectedParticipant) { - appLogger.d("$TAG - Selected participant: ${selectedParticipant.toLogString()}") - this.selectedParticipant = selectedParticipant - } - companion object { const val DOUBLE_TAP_TOAST_DISPLAY_TIME = 7000L const val COUNT_DOWN_INTERVAL = 1000L const val DELAY_TO_SHOW_DOUBLE_TAP_TOAST = 500L - const val TAG = "OngoingCallViewModel" } @AssistedFactory diff --git a/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/fullscreen/FullScreenTile.kt b/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/fullscreen/FullScreenTile.kt index cee64f83032..7edbd0d7ba3 100644 --- a/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/fullscreen/FullScreenTile.kt +++ b/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/fullscreen/FullScreenTile.kt @@ -60,7 +60,6 @@ fun FullScreenTile( closeFullScreen: (offset: Offset) -> Unit, onBackButtonClicked: () -> Unit, setVideoPreview: (View) -> Unit, - requestVideoStreams: (participants: List) -> Unit, clearVideoPreview: () -> Unit, modifier: Modifier = Modifier, contentPadding: Dp = dimensions().spacing4x, @@ -120,10 +119,6 @@ fun FullScreenTile( } ) } - - LaunchedEffect(selectedParticipant.userId) { - requestVideoStreams(listOf(it)) - } } } @@ -144,7 +139,6 @@ fun PreviewFullScreenTile() = WireTheme { closeFullScreen = {}, onBackButtonClicked = {}, setVideoPreview = {}, - requestVideoStreams = {}, clearVideoPreview = {}, participants = participants, ) diff --git a/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/fullscreen/SelectedParticipant.kt b/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/fullscreen/SelectedParticipant.kt index af1a1d87f45..95238a33c27 100644 --- a/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/fullscreen/SelectedParticipant.kt +++ b/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/fullscreen/SelectedParticipant.kt @@ -17,16 +17,10 @@ */ package com.wire.android.ui.calling.ongoing.fullscreen -import com.wire.kalium.logger.obfuscateId import com.wire.kalium.logic.data.user.UserId data class SelectedParticipant( val userId: UserId = UserId("", ""), val clientId: String = "", val isSelfUser: Boolean = false -) { - - fun toLogString(): String { - return "SelectedParticipant(userId=${userId.toLogString()}, clientId=${clientId.obfuscateId()}, isSelfUser=$isSelfUser)" - } -} +) diff --git a/app/src/test/kotlin/com/wire/android/ui/calling/OngoingCallViewModelTest.kt b/app/src/test/kotlin/com/wire/android/ui/calling/OngoingCallViewModelTest.kt index 92937700fdb..79e3abce3cb 100644 --- a/app/src/test/kotlin/com/wire/android/ui/calling/OngoingCallViewModelTest.kt +++ b/app/src/test/kotlin/com/wire/android/ui/calling/OngoingCallViewModelTest.kt @@ -23,11 +23,9 @@ import com.wire.android.config.NavigationTestExtension import com.wire.android.datastore.GlobalDataStore import com.wire.android.ui.calling.model.UICallParticipant import com.wire.android.ui.calling.ongoing.OngoingCallViewModel -import com.wire.android.ui.calling.ongoing.fullscreen.SelectedParticipant import com.wire.android.ui.home.conversationslist.model.Membership import com.wire.kalium.logic.data.call.Call import com.wire.kalium.logic.data.call.CallClient -import com.wire.kalium.logic.data.call.CallQuality import com.wire.kalium.logic.data.call.CallStatus import com.wire.kalium.logic.data.call.VideoState import com.wire.kalium.logic.data.conversation.Conversation @@ -172,72 +170,6 @@ class OngoingCallViewModelTest { } } - @Test - fun givenAUserIsSelected_whenRequestedFullScreen_thenSetTheUserAsSelected() = - runTest { - val (_, ongoingCallViewModel) = Arrangement() - .withCall(provideCall().copy(isCameraOn = true)) - .withShouldShowDoubleTapToastReturning(false) - .withSetVideoSendState() - .arrange() - - ongoingCallViewModel.onSelectedParticipant(selectedParticipant3) - - assertEquals(selectedParticipant3, ongoingCallViewModel.selectedParticipant) - } - - @Test - fun givenParticipantsList_WhenRequestingVideoStreamForFullScreenParticipant_ThenRequestItInHighQuality() = - runTest { - val expectedClients = listOf( - CallClient(participant1.id.toString(), participant1.clientId, false, CallQuality.LOW), - CallClient(participant3.id.toString(), participant3.clientId, false, CallQuality.HIGH) - ) - - val (arrangement, ongoingCallViewModel) = Arrangement() - .withCall(provideCall()) - .withShouldShowDoubleTapToastReturning(false) - .withSetVideoSendState() - .withRequestVideoStreams(conversationId, expectedClients) - .arrange() - - ongoingCallViewModel.onSelectedParticipant(selectedParticipant3) - ongoingCallViewModel.requestVideoStreams(participants) - - coVerify(exactly = 1) { - arrangement.requestVideoStreams( - conversationId, - expectedClients - ) - } - } - - @Test - fun givenParticipantsList_WhenRequestingVideoStreamForAllParticipant_ThenRequestItInLowQuality() = - runTest { - val expectedClients = listOf( - CallClient(participant1.id.toString(), participant1.clientId, false, CallQuality.LOW), - CallClient(participant3.id.toString(), participant3.clientId, false, CallQuality.LOW) - ) - - val (arrangement, ongoingCallViewModel) = Arrangement() - .withCall(provideCall()) - .withShouldShowDoubleTapToastReturning(false) - .withSetVideoSendState() - .withRequestVideoStreams(conversationId, expectedClients) - .arrange() - - ongoingCallViewModel.onSelectedParticipant(SelectedParticipant()) - ongoingCallViewModel.requestVideoStreams(participants) - - coVerify(exactly = 1) { - arrangement.requestVideoStreams( - conversationId, - expectedClients - ) - } - } - private class Arrangement { @MockK @@ -336,7 +268,6 @@ class OngoingCallViewModelTest { accentId = -1 ) val participants = listOf(participant1, participant2, participant3) - val selectedParticipant3 = SelectedParticipant(participant3.id, participant3.clientId, false) } private fun provideCall( diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6dbdf6c2991..557c6558a97 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -67,7 +67,7 @@ coil = "2.7.0" commonmark = "0.24.0" # Countly -countly = "24.7.7" +countly = "24.4.0" # RSS rss-parser = "6.0.7" diff --git a/kalium b/kalium index 06c284a4df3..d8b69f1202e 160000 --- a/kalium +++ b/kalium @@ -1 +1 @@ -Subproject commit 06c284a4df3d5024f634a960978ac3f61367d98e +Subproject commit d8b69f1202e0ea88889c98bf1e2f9cd5016d197c