Skip to content

Commit

Permalink
revert: conference simulcast support (WPB-11480) (#3717)
Browse files Browse the repository at this point in the history
  • Loading branch information
yamilmedina authored Dec 7, 2024
1 parent 885ec53 commit 7c5299e
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -291,8 +289,6 @@ private fun OngoingCallContent(
hideDoubleTapToast: () -> Unit,
onCameraPermissionPermanentlyDenied: () -> Unit,
requestVideoStreams: (participants: List<UICallParticipant>) -> Unit,
onSelectedParticipant: (selectedParticipant: SelectedParticipant) -> Unit,
selectedParticipantForFullScreen: SelectedParticipant,
participants: PersistentList<UICallParticipant>,
inPictureInPictureMode: Boolean,
currentUserId: UserId,
Expand All @@ -307,6 +303,7 @@ private fun OngoingCallContent(
)

var shouldOpenFullScreen by remember { mutableStateOf(false) }
var selectedParticipantForFullScreen by remember { mutableStateOf(SelectedParticipant()) }

WireBottomSheetScaffold(
sheetDragHandle = null,
Expand Down Expand Up @@ -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
Expand All @@ -418,7 +412,7 @@ private fun OngoingCallContent(
requestVideoStreams = requestVideoStreams,
currentUserId = currentUserId,
onDoubleTap = { selectedParticipant ->
onSelectedParticipant(selectedParticipant)
selectedParticipantForFullScreen = selectedParticipant
shouldOpenFullScreen = !shouldOpenFullScreen
},
)
Expand Down Expand Up @@ -586,8 +580,6 @@ fun PreviewOngoingCallContent(participants: PersistentList<UICallParticipant>) {
participants = participants,
inPictureInPictureMode = false,
currentUserId = UserId("userId", "domain"),
onSelectedParticipant = {},
selectedParticipantForFullScreen = SelectedParticipant(),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -128,32 +124,20 @@ class OngoingCallViewModel @AssistedInject constructor(
.also {
if (it.isNotEmpty()) {
val clients: List<CallClient> = it.map { uiParticipant ->
CallClient(
userId = uiParticipant.id.toString(),
clientId = uiParticipant.clientId,
quality = mapQualityStream(uiParticipant)
)
CallClient(uiParticipant.id.toString(), uiParticipant.clientId)
}
requestVideoStreams(conversationId, clients)
}
}
}
}

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() {
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ fun FullScreenTile(
closeFullScreen: (offset: Offset) -> Unit,
onBackButtonClicked: () -> Unit,
setVideoPreview: (View) -> Unit,
requestVideoStreams: (participants: List<UICallParticipant>) -> Unit,
clearVideoPreview: () -> Unit,
modifier: Modifier = Modifier,
contentPadding: Dp = dimensions().spacing4x,
Expand Down Expand Up @@ -120,10 +119,6 @@ fun FullScreenTile(
}
)
}

LaunchedEffect(selectedParticipant.userId) {
requestVideoStreams(listOf(it))
}
}
}

Expand All @@ -144,7 +139,6 @@ fun PreviewFullScreenTile() = WireTheme {
closeFullScreen = {},
onBackButtonClicked = {},
setVideoPreview = {},
requestVideoStreams = {},
clearVideoPreview = {},
participants = participants,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
}
}
)
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion kalium
Submodule kalium updated 31 files
+19 βˆ’0 cryptography/src/commonJvmAndroid/kotlin/com.wire.kalium.cryptography/CoreCryptoCentral.kt
+28 βˆ’9 cryptography/src/commonJvmAndroid/kotlin/com.wire.kalium.cryptography/ProteusClientCoreCryptoImpl.kt
+12 βˆ’6 cryptography/src/commonMain/kotlin/com/wire/kalium/cryptography/exceptions/ProteusException.kt
+4 βˆ’38 data/src/commonMain/kotlin/com/wire/kalium/logic/data/call/CallClient.kt
+10 βˆ’10 gradle/libs.versions.toml
+12 βˆ’13 logic/src/commonJvmAndroid/kotlin/com/wire/kalium/logic/CoreCryptoExceptionMapper.kt
+3 βˆ’8 logic/src/commonJvmAndroid/kotlin/com/wire/kalium/logic/feature/call/CallManagerImpl.kt
+5 βˆ’1 logic/src/commonMain/kotlin/com/wire/kalium/logic/configuration/server/CustomServerConfigRepository.kt
+17 βˆ’5 logic/src/commonMain/kotlin/com/wire/kalium/logic/configuration/server/ServerConfigRepository.kt
+1 βˆ’2 logic/src/commonMain/kotlin/com/wire/kalium/logic/data/sync/SlowSyncStatus.kt
+1 βˆ’7 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/UserSessionScope.kt
+18 βˆ’4 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/conversation/folder/GetFavoriteFolderUseCase.kt
+0 βˆ’36 ...c/src/commonMain/kotlin/com/wire/kalium/logic/feature/conversation/folder/SyncConversationFoldersUseCase.kt
+1 βˆ’1 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/server/UpdateApiVersionsUseCase.kt
+2 βˆ’1 logic/src/commonMain/kotlin/com/wire/kalium/logic/sync/slow/SlowSyncManager.kt
+0 βˆ’3 logic/src/commonMain/kotlin/com/wire/kalium/logic/sync/slow/SlowSyncWorker.kt
+3 βˆ’3 logic/src/commonTest/kotlin/com/wire/kalium/logic/configuration/CustomServerConfigRepositoryTest.kt
+2 βˆ’2 logic/src/commonTest/kotlin/com/wire/kalium/logic/configuration/ServerConfigRepositoryTest.kt
+28 βˆ’1 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/conversation/folder/GetFavoriteFolderUseCaseTest.kt
+13 βˆ’13 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/server/UpdateApiVersionUseCaseTest.kt
+1 βˆ’14 logic/src/commonTest/kotlin/com/wire/kalium/logic/sync/slow/SlowSyncWorkerTest.kt
+1 βˆ’1 network/src/commonMain/kotlin/com/wire/kalium/network/api/v0/authenticated/ConversationApiV0.kt
+21 βˆ’0 network/src/commonMain/kotlin/com/wire/kalium/network/api/v7/authenticated/ConversationApiV7.kt
+1 βˆ’0 persistence/src/androidUnitTest/kotlin/com/wire/kalium/persistence/GlobalDBBaseTest.kt
+2 βˆ’2 persistence/src/commonMain/db_global/com/wire/kalium/persistence/ServerConfiguration.sq
+3 βˆ’0 persistence/src/commonMain/db_user/com/wire/kalium/persistence/ConversationFolders.sq
+1 βˆ’0 ...ence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/conversation/folder/ConversationFolderDAOImpl.kt
+5 βˆ’3 persistence/src/commonMain/kotlin/com/wire/kalium/persistence/daokaliumdb/ServerConfigurationDAO.kt
+34 βˆ’7 persistence/src/commonTest/kotlin/com/wire/kalium/persistence/daokaliumdb/ServerConfigurationDAOTest.kt
+7 βˆ’0 persistence/src/commonTest/kotlin/com/wire/kalium/persistence/globalDB/AccountsDAOTest.kt
+0 βˆ’32 util/src/commonMain/kotlin/com.wire.kalium.util/serialization/LenientJsonSerializer.kt

0 comments on commit 7c5299e

Please sign in to comment.