From 334db7b0895556ffd6b3a25542ed7f764bc50b62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=BBerko?= Date: Tue, 19 Mar 2024 08:30:51 +0100 Subject: [PATCH] fix: stay in call screen after back button from fullscreen [WPB-640] (#2795) --- .../android/ui/calling/ongoing/OngoingCallScreen.kt | 12 ++++++++---- .../ui/calling/ongoing/fullscreen/FullScreenTile.kt | 13 ++++++++++--- 2 files changed, 18 insertions(+), 7 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 85bf0c51f04..08fee2ef0e0 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 @@ -271,10 +271,14 @@ private fun OngoingCallContent( hideDoubleTapToast() FullScreenTile( selectedParticipant = selectedParticipantForFullScreen, - height = this@BoxWithConstraints.maxHeight - dimensions().spacing4x - ) { - shouldOpenFullScreen = !shouldOpenFullScreen - } + height = this@BoxWithConstraints.maxHeight - dimensions().spacing4x, + closeFullScreen = { + shouldOpenFullScreen = !shouldOpenFullScreen + }, + onBackButtonClicked = { + shouldOpenFullScreen = !shouldOpenFullScreen + } + ) } else { VerticalCallingPager( participants = participants, 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 f372fff0a49..1caadcf8213 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 @@ -17,6 +17,7 @@ */ package com.wire.android.ui.calling.ongoing.fullscreen +import androidx.activity.compose.BackHandler import androidx.compose.foundation.gestures.detectTapGestures import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxWidth @@ -50,10 +51,15 @@ fun FullScreenTile( sharedCallingViewModel: SharedCallingViewModel = hiltViewModel(), selectedParticipant: SelectedParticipant, height: Dp, - onDoubleTap: (offset: Offset) -> Unit + closeFullScreen: (offset: Offset) -> Unit, + onBackButtonClicked: () -> Unit ) { var shouldShowDoubleTapToast by remember { mutableStateOf(false) } + BackHandler { + onBackButtonClicked() + } + sharedCallingViewModel.callState.participants.find { it.id == selectedParticipant.userId && it.clientId == selectedParticipant.clientId }?.let { @@ -64,7 +70,7 @@ fun FullScreenTile( .clipToBounds() .pointerInput(Unit) { detectTapGestures( - onDoubleTap = onDoubleTap + onDoubleTap = closeFullScreen ) } .height(height) @@ -114,6 +120,7 @@ fun PreviewFullScreenVideoCall() { FullScreenTile( selectedParticipant = SelectedParticipant(), height = 100.dp, - onDoubleTap = { } + closeFullScreen = {}, + onBackButtonClicked = {} ) }