From 0f9fb0a6fa6e2065e2ddcffa4e9cdef578cb871e Mon Sep 17 00:00:00 2001 From: Oussama Hassine Date: Tue, 30 Apr 2024 16:31:55 +0200 Subject: [PATCH] fix: start CallActivity in a new task --- app/src/main/AndroidManifest.xml | 1 + .../com/wire/android/ui/calling/CallActivity.kt | 3 +++ .../ui/calling/SharedCallingViewModel.kt | 15 --------------- .../ui/calling/ongoing/OngoingCallScreen.kt | 17 +++++++++++------ .../ui/calling/SharedCallingViewModelTest.kt | 10 ---------- 5 files changed, 15 insertions(+), 31 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7433527e789..524bc3b8e5a 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -95,6 +95,7 @@ android:launchMode="singleTop" android:hardwareAccelerated="true" android:screenOrientation="portrait" + android:taskAffinity="wire.call" android:theme="@style/AppTheme" /> Unit, - pauseSendingVideoFeed: () -> Unit + pauseSendingVideoFeed: () -> Unit, + onClearVideoPreview: () -> Unit ) { val lifecycleOwner: LifecycleOwner = LocalLifecycleOwner.current DisposableEffect(lifecycleOwner, isCameraOn, callStatus) { @@ -198,6 +200,9 @@ private fun handleVideoPreviewOnLifecycleChange( if (event == Lifecycle.Event.ON_RESUME && callStatus == CallStatus.ESTABLISHED && isCameraOn) { startSendingVideoFeed() } + if (event == Lifecycle.Event.ON_DESTROY) { + onClearVideoPreview() + } } lifecycleOwner.lifecycle.addObserver(observer) @@ -230,7 +235,7 @@ private fun OngoingCallContent( flipCamera: () -> Unit, setVideoPreview: (view: View) -> Unit, clearVideoPreview: () -> Unit, - navigateBack: () -> Unit, + onCollapse: () -> Unit, hideDoubleTapToast: () -> Unit, onPermissionPermanentlyDenied: (type: PermissionDenialType) -> Unit, requestVideoStreams: (participants: List) -> Unit @@ -258,7 +263,7 @@ private fun OngoingCallContent( else -> "" }, isCbrEnabled = isCbrEnabled, - onCollapse = navigateBack, + onCollapse = onCollapse, protocolInfo = protocolInfo, mlsVerificationStatus = mlsVerificationStatus, proteusVerificationStatus = proteusVerificationStatus diff --git a/app/src/test/kotlin/com/wire/android/ui/calling/SharedCallingViewModelTest.kt b/app/src/test/kotlin/com/wire/android/ui/calling/SharedCallingViewModelTest.kt index e1fa9e5325d..dfd44100f6c 100644 --- a/app/src/test/kotlin/com/wire/android/ui/calling/SharedCallingViewModelTest.kt +++ b/app/src/test/kotlin/com/wire/android/ui/calling/SharedCallingViewModelTest.kt @@ -25,8 +25,6 @@ import com.wire.android.config.TestDispatcherProvider import com.wire.android.mapper.UICallParticipantMapper import com.wire.android.mapper.UserTypeMapper import com.wire.android.media.CallRinger -import com.wire.android.util.CurrentScreen -import com.wire.android.util.CurrentScreenManager import com.wire.android.util.ui.WireSessionImageLoader import com.wire.kalium.logic.data.call.VideoState import com.wire.kalium.logic.data.id.ConversationId @@ -48,7 +46,6 @@ import io.mockk.coVerify import io.mockk.every import io.mockk.impl.annotations.MockK import io.mockk.verify -import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.runTest @@ -109,9 +106,6 @@ class SharedCallingViewModelTest { @MockK private lateinit var userTypeMapper: UserTypeMapper - @MockK - private lateinit var currentScreenManager: CurrentScreenManager - @MockK(relaxed = true) private lateinit var onCompleted: () -> Unit @@ -130,9 +124,6 @@ class SharedCallingViewModelTest { coEvery { allCalls.invoke() } returns emptyFlow() coEvery { observeConversationDetails.invoke(any()) } returns emptyFlow() coEvery { observeSpeaker.invoke() } returns emptyFlow() - coEvery { currentScreenManager.observeCurrentScreen(any()) } returns MutableStateFlow( - CurrentScreen.SomeOther - ) sharedCallingViewModel = SharedCallingViewModel( conversationId = conversationId, @@ -152,7 +143,6 @@ class SharedCallingViewModelTest { uiCallParticipantMapper = uiCallParticipantMapper, wireSessionImageLoader = wireSessionImageLoader, userTypeMapper = userTypeMapper, - currentScreenManager = currentScreenManager, dispatchers = TestDispatcherProvider() ) }