From 8501ad1df59a3e5e7c8a22ce225eea09dc21eec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Zag=C3=B3rski?= Date: Wed, 6 Nov 2024 14:01:37 +0100 Subject: [PATCH 1/3] feat: Remove mls enabled build config field #WPB-10119 (#3591) --- .../wire/android/di/KaliumConfigsModule.kt | 1 - .../options/GroupConversationOptions.kt | 28 +++++++++---------- .../ConversationParticipantItem.kt | 2 +- .../GroupConversationParticipants.kt | 2 +- .../kotlin/customization/FeatureConfigs.kt | 1 - default.json | 4 --- 6 files changed, 15 insertions(+), 23 deletions(-) diff --git a/app/src/main/kotlin/com/wire/android/di/KaliumConfigsModule.kt b/app/src/main/kotlin/com/wire/android/di/KaliumConfigsModule.kt index b6b2dc73003..9be6af3cae7 100644 --- a/app/src/main/kotlin/com/wire/android/di/KaliumConfigsModule.kt +++ b/app/src/main/kotlin/com/wire/android/di/KaliumConfigsModule.kt @@ -53,7 +53,6 @@ class KaliumConfigsModule { shouldEncryptData = !BuildConfig.DEBUG || Build.VERSION.SDK_INT < Build.VERSION_CODES.R, lowerKeyPackageLimits = BuildConfig.LOWER_KEYPACKAGE_LIMIT, lowerKeyingMaterialsUpdateThreshold = BuildConfig.PRIVATE_BUILD, - isMLSSupportEnabled = BuildConfig.MLS_SUPPORT_ENABLED, developmentApiEnabled = BuildConfig.DEVELOPMENT_API_ENABLED, ignoreSSLCertificatesForUnboundCalls = BuildConfig.IGNORE_SSL_CERTIFICATES, encryptProteusStorage = runBlocking { globalDataStore.isEncryptedProteusStorageEnabled().first() }, diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/details/options/GroupConversationOptions.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/details/options/GroupConversationOptions.kt index d6364f9bc65..1e2eddbf039 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/details/options/GroupConversationOptions.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/details/options/GroupConversationOptions.kt @@ -186,29 +186,27 @@ fun ConversationProtocolDetails( ) { Column(modifier = modifier) { FolderHeader(name = stringResource(R.string.folder_label_protocol_details)) - if (protocolInfo is Conversation.ProtocolInfo.MLS || BuildConfig.MLS_SUPPORT_ENABLED) { + if (protocolInfo is Conversation.ProtocolInfo.MLS) { ProtocolDetails( label = UIText.StringResource(R.string.protocol), text = UIText.DynamicString(protocolInfo.name()) ) - if (protocolInfo is Conversation.ProtocolInfo.MLS) { + ProtocolDetails( + label = UIText.StringResource(R.string.cipher_suite), + text = UIText.DynamicString(protocolInfo.cipherSuite.toString()) + ) + + if (BuildConfig.PRIVATE_BUILD) { ProtocolDetails( - label = UIText.StringResource(R.string.cipher_suite), - text = UIText.DynamicString(protocolInfo.cipherSuite.toString()) + label = UIText.StringResource(R.string.last_key_material_update_label), + text = UIText.DynamicString(protocolInfo.keyingMaterialLastUpdate.toString()) ) - if (BuildConfig.PRIVATE_BUILD) { - ProtocolDetails( - label = UIText.StringResource(R.string.last_key_material_update_label), - text = UIText.DynamicString(protocolInfo.keyingMaterialLastUpdate.toString()) - ) - - ProtocolDetails( - label = UIText.StringResource(R.string.group_state_label), - text = UIText.DynamicString(protocolInfo.groupState.name) - ) - } + ProtocolDetails( + label = UIText.StringResource(R.string.group_state_label), + text = UIText.DynamicString(protocolInfo.groupState.name) + ) } } } diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/details/participants/ConversationParticipantItem.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/details/participants/ConversationParticipantItem.kt index 7a7fe1eb452..6f865c57870 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/details/participants/ConversationParticipantItem.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/details/participants/ConversationParticipantItem.kt @@ -110,7 +110,7 @@ fun ConversationParticipantItem( if (uiParticipant.isMLSVerified) MLSVerifiedIcon() if (uiParticipant.isProteusVerified) ProteusVerifiedIcon() - if (BuildConfig.MLS_SUPPORT_ENABLED && BuildConfig.DEVELOPER_FEATURES_ENABLED) { + if (BuildConfig.DEVELOPER_FEATURES_ENABLED) { uiParticipant.supportedProtocolList.map { ProtocolLabel( protocolName = it.name, diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/details/participants/GroupConversationParticipants.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/details/participants/GroupConversationParticipants.kt index ac5f136e732..38aa1085b9c 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/details/participants/GroupConversationParticipants.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/details/participants/GroupConversationParticipants.kt @@ -64,7 +64,7 @@ fun GroupConversationParticipants( state = lazyListState, modifier = Modifier.fillMaxSize() ) { - if (BuildConfig.MLS_SUPPORT_ENABLED && BuildConfig.DEVELOPER_FEATURES_ENABLED) { + if (BuildConfig.DEVELOPER_FEATURES_ENABLED) { item(key = "participants_list_header") { Column( modifier = Modifier diff --git a/buildSrc/src/main/kotlin/customization/FeatureConfigs.kt b/buildSrc/src/main/kotlin/customization/FeatureConfigs.kt index f0fb0698f51..0ad0c989d77 100644 --- a/buildSrc/src/main/kotlin/customization/FeatureConfigs.kt +++ b/buildSrc/src/main/kotlin/customization/FeatureConfigs.kt @@ -53,7 +53,6 @@ enum class FeatureConfigs(val value: String, val configType: ConfigType) { /** * Security/Cryptography stuff */ - MLS_SUPPORT_ENABLED("mls_support_enabled", ConfigType.BOOLEAN), LOWER_KEYPACKAGE_LIMIT("lower_keypackage_limit", ConfigType.BOOLEAN), ENCRYPT_PROTEUS_STORAGE("encrypt_proteus_storage", ConfigType.BOOLEAN), WIPE_ON_COOKIE_INVALID("wipe_on_cookie_invalid", ConfigType.BOOLEAN), diff --git a/default.json b/default.json index 6feb9d4faa7..49d0bc23cc0 100644 --- a/default.json +++ b/default.json @@ -6,7 +6,6 @@ "logging_enabled": false, "application_is_private_build": false, "development_api_enabled": false, - "mls_support_enabled": false, "analytics_enabled": false, "analytics_app_key": "4483f7a58ae3e70b3780319c4ccb5c88a037be49", "analytics_server_url": "https://countly.wire.com/" @@ -64,7 +63,6 @@ "logging_enabled": true, "application_is_private_build": true, "development_api_enabled": false, - "mls_support_enabled": false, "encrypt_proteus_storage": true, "analytics_enabled": true, "analytics_app_key": "8ffae535f1836ed5f58fd5c8a11c00eca07c5438", @@ -88,7 +86,6 @@ "logging_enabled": false, "application_is_private_build": false, "development_api_enabled": false, - "mls_support_enabled": false, "analytics_enabled": false, "analytics_app_key": "", "analytics_server_url": "" @@ -106,7 +103,6 @@ "file_restriction_list": "3gpp, aac, amr, avi, bmp, css, csv, dib, doc, docx, eml, flac, gif, html, ico, jfif, jpeg, jpg, jpg-large, key, m4a, m4v, md, midi, mkv, mov, mp3, mp4, mpeg, mpeg3, mpg, msg, ods, odt, ogg, pdf, pjp, pjpeg, png, pps, ppt, pptx, psd, pst, rtf, sql, svg, tex, tiff, txt, vcf, vid, wav, webm, webp, wmv, xls, xlsx, xml", "force_constant_bitrate_calls": false, "ignore_ssl_certificates": false, - "mls_support_enabled": true, "lower_keypackage_limit": false, "encrypt_proteus_storage": false, "self_deleting_messages": true, From 3682dd516bf0c89cdfbf018f7343ebfae6dc565d Mon Sep 17 00:00:00 2001 From: boris Date: Wed, 6 Nov 2024 16:37:06 +0200 Subject: [PATCH 2/3] feat: Try testTagsAsResourceId to improve UI tests [WPB-9284] (#3588) --- .../com/wire/android/ui/WireActivity.kt | 75 ++++++++++++------- .../ui/calling/StartingCallActivity.kt | 6 ++ .../ui/calling/ongoing/OngoingCallActivity.kt | 6 ++ 3 files changed, 60 insertions(+), 27 deletions(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/WireActivity.kt b/app/src/main/kotlin/com/wire/android/ui/WireActivity.kt index 90dfd040a88..2cf4e38052b 100644 --- a/app/src/main/kotlin/com/wire/android/ui/WireActivity.kt +++ b/app/src/main/kotlin/com/wire/android/ui/WireActivity.kt @@ -40,9 +40,12 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.runtime.rememberUpdatedState import androidx.compose.runtime.staticCompositionLocalOf +import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalSoftwareKeyboardController +import androidx.compose.ui.semantics.semantics +import androidx.compose.ui.semantics.testTagsAsResourceId import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen import androidx.core.view.WindowCompat import androidx.lifecycle.Lifecycle @@ -71,6 +74,7 @@ import com.wire.android.ui.common.bottomsheet.rememberWireModalSheetState import com.wire.android.ui.common.bottomsheet.show import com.wire.android.ui.common.snackbar.LocalSnackbarHostState import com.wire.android.ui.common.topappbar.CommonTopAppBar +import com.wire.android.ui.common.topappbar.CommonTopAppBarState import com.wire.android.ui.common.topappbar.CommonTopAppBarViewModel import com.wire.android.ui.common.visbility.rememberVisibilityState import com.wire.android.ui.destinations.ConversationScreenDestination @@ -120,6 +124,7 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import javax.inject.Inject +@OptIn(ExperimentalComposeUiApi::class) @AndroidEntryPoint @Suppress("TooManyFunctions") class WireActivity : AppCompatActivity() { @@ -203,6 +208,7 @@ class WireActivity : AppCompatActivity() { } } + @Suppress("LongMethod") private fun setComposableContent( startDestination: Route, onComplete: () -> Unit @@ -220,36 +226,15 @@ class WireActivity : AppCompatActivity() { LocalActivity provides this ) { WireTheme { - Column(modifier = Modifier.statusBarsPadding()) { + Column( + modifier = Modifier + .statusBarsPadding() + .semantics { testTagsAsResourceId = true } + ) { val navigator = rememberNavigator(this@WireActivity::finish) - CommonTopAppBar( + WireTopAppBar( themeOption = viewModel.globalAppState.themeOption, commonTopAppBarState = commonTopAppBarViewModel.state, - onReturnToCallClick = { establishedCall -> - getOngoingCallIntent( - this@WireActivity, - establishedCall.conversationId.toString() - ).run { - startActivity(this) - } - }, - onReturnToIncomingCallClick = { - getIncomingCallIntent( - this@WireActivity, - it.conversationId.toString(), - null - ).run { - startActivity(this) - } - }, - onReturnToOutgoingCallClick = { - getOutgoingCallIntent( - this@WireActivity, - it.conversationId.toString() - ).run { - startActivity(this) - } - } ) CompositionLocalProvider(LocalNavigator provides navigator) { MainNavHost( @@ -269,6 +254,42 @@ class WireActivity : AppCompatActivity() { } } + @Composable + private fun WireTopAppBar( + themeOption: ThemeOption, + commonTopAppBarState: CommonTopAppBarState + ) { + CommonTopAppBar( + themeOption = themeOption, + commonTopAppBarState = commonTopAppBarState, + onReturnToCallClick = { establishedCall -> + getOngoingCallIntent( + this@WireActivity, + establishedCall.conversationId.toString() + ).run { + startActivity(this) + } + }, + onReturnToIncomingCallClick = { + getIncomingCallIntent( + this@WireActivity, + it.conversationId.toString(), + null + ).run { + startActivity(this) + } + }, + onReturnToOutgoingCallClick = { + getOutgoingCallIntent( + this@WireActivity, + it.conversationId.toString() + ).run { + startActivity(this) + } + } + ) + } + @Composable private fun HandleThemeChanges(themeOption: ThemeOption) { LaunchedEffect(themeOption) { diff --git a/app/src/main/kotlin/com/wire/android/ui/calling/StartingCallActivity.kt b/app/src/main/kotlin/com/wire/android/ui/calling/StartingCallActivity.kt index ac7ffdaf739..b5dc7d2cb47 100644 --- a/app/src/main/kotlin/com/wire/android/ui/calling/StartingCallActivity.kt +++ b/app/src/main/kotlin/com/wire/android/ui/calling/StartingCallActivity.kt @@ -28,6 +28,10 @@ import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember +import androidx.compose.ui.ExperimentalComposeUiApi +import androidx.compose.ui.Modifier +import androidx.compose.ui.semantics.semantics +import androidx.compose.ui.semantics.testTagsAsResourceId import androidx.core.view.WindowCompat import com.wire.android.appLogger import com.wire.android.navigation.style.TransitionAnimationType @@ -52,6 +56,7 @@ import javax.inject.Inject * @see IncomingCallScreen * @see OutgoingCallScreen */ +@OptIn(ExperimentalComposeUiApi::class) @AndroidEntryPoint class StartingCallActivity : CallActivity() { @Inject @@ -90,6 +95,7 @@ class StartingCallActivity : CallActivity() { TransitionAnimationType.POP_UP.exitTransition ) }, + modifier = Modifier.semantics { testTagsAsResourceId = true }, label = currentScreenType.name ) { screenType -> conversationId?.let { diff --git a/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/OngoingCallActivity.kt b/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/OngoingCallActivity.kt index 1dc83aff9a2..d318d103310 100644 --- a/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/OngoingCallActivity.kt +++ b/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/OngoingCallActivity.kt @@ -31,6 +31,10 @@ import androidx.compose.animation.togetherWith import androidx.compose.material3.SnackbarHostState import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.remember +import androidx.compose.ui.ExperimentalComposeUiApi +import androidx.compose.ui.Modifier +import androidx.compose.ui.semantics.semantics +import androidx.compose.ui.semantics.testTagsAsResourceId import androidx.core.view.WindowCompat import com.wire.android.R import com.wire.android.appLogger @@ -56,6 +60,7 @@ import javax.inject.Inject * * @see OngoingCallScreen */ +@OptIn(ExperimentalComposeUiApi::class) @AndroidEntryPoint class OngoingCallActivity : CallActivity() { @Inject @@ -91,6 +96,7 @@ class OngoingCallActivity : CallActivity() { TransitionAnimationType.POP_UP.exitTransition ) }, + modifier = Modifier.semantics { testTagsAsResourceId = true }, label = TAG ) { _ -> OngoingCallScreen( From 8f9cd86057a04c1b860bd55ebc1909d9add3a87a Mon Sep 17 00:00:00 2001 From: Damian Kaczmarek <76782439+damian-kaczmarek@users.noreply.github.com> Date: Wed, 6 Nov 2024 15:52:42 +0100 Subject: [PATCH 3/3] fix: black screen when last caller in a group #WPB-10652 (#3550) --- .../ui/calling/ongoing/OngoingCallScreen.kt | 35 +++++++++++++------ ...ipantsTiles.kt => VerticalCallingPager.kt} | 23 +++++++----- .../gridview/CallingGridView.kt | 13 ++++--- .../horizentalview/CallingHorizontalView.kt | 25 ++++++------- kalium | 2 +- 5 files changed, 58 insertions(+), 40 deletions(-) rename app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantsview/{ParticipantsTiles.kt => VerticalCallingPager.kt} (93%) 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 b75994ae2bf..fae2471ac08 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 @@ -96,6 +96,7 @@ import com.wire.kalium.logic.data.call.CallStatus import com.wire.kalium.logic.data.conversation.Conversation import com.wire.kalium.logic.data.id.ConversationId import com.wire.kalium.logic.data.id.QualifiedID +import com.wire.kalium.logic.data.user.UserId import kotlinx.collections.immutable.PersistentList import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toPersistentList @@ -161,6 +162,7 @@ fun OngoingCallScreen( } } + val inPictureInPictureMode = activity.isInPictureInPictureMode OngoingCallContent( callState = sharedCallingViewModel.callState, shouldShowDoubleTapToast = ongoingCallViewModel.shouldShowDoubleTapToast, @@ -175,7 +177,9 @@ fun OngoingCallScreen( requestVideoStreams = ongoingCallViewModel::requestVideoStreams, hideDoubleTapToast = ongoingCallViewModel::hideDoubleTapToast, onCameraPermissionPermanentlyDenied = onCameraPermissionPermanentlyDenied, - participants = sharedCallingViewModel.participantsState + participants = sharedCallingViewModel.participantsState, + inPictureInPictureMode = inPictureInPictureMode, + currentUserId = ongoingCallViewModel.currentUserId, ) BackHandler { @@ -283,10 +287,10 @@ private fun OngoingCallContent( hideDoubleTapToast: () -> Unit, onCameraPermissionPermanentlyDenied: () -> Unit, requestVideoStreams: (participants: List) -> Unit, - participants: PersistentList + participants: PersistentList, + inPictureInPictureMode: Boolean, + currentUserId: UserId, ) { - val activity = LocalActivity.current - val sheetInitialValue = SheetValue.PartiallyExpanded val sheetState = rememberStandardBottomSheetState( initialValue = sheetInitialValue @@ -301,7 +305,7 @@ private fun OngoingCallContent( WireBottomSheetScaffold( sheetDragHandle = null, - topBar = if (activity.isInPictureInPictureMode) { + topBar = if (inPictureInPictureMode) { null } else { { @@ -319,10 +323,10 @@ private fun OngoingCallContent( ) } }, - sheetPeekHeight = if (activity.isInPictureInPictureMode) 0.dp else dimensions().defaultSheetPeekHeight, + sheetPeekHeight = if (inPictureInPictureMode) 0.dp else dimensions().defaultSheetPeekHeight, scaffoldState = scaffoldState, sheetContent = { - if (!activity.isInPictureInPictureMode) { + if (!inPictureInPictureMode) { CallingControls( conversationId = callState.conversationId, isMuted = callState.isMuted ?: true, @@ -343,7 +347,7 @@ private fun OngoingCallContent( modifier = Modifier .padding( top = it.calculateTopPadding(), - bottom = if (activity.isInPictureInPictureMode) 0.dp else dimensions().defaultSheetPeekHeight + bottom = if (inPictureInPictureMode) 0.dp else dimensions().defaultSheetPeekHeight ) ) { @@ -399,14 +403,16 @@ private fun OngoingCallContent( participants = participants, isSelfUserCameraOn = callState.isCameraOn, isSelfUserMuted = callState.isMuted ?: true, + isInPictureInPictureMode = inPictureInPictureMode, contentHeight = this@BoxWithConstraints.maxHeight, onSelfVideoPreviewCreated = setVideoPreview, onSelfClearVideoPreview = clearVideoPreview, requestVideoStreams = requestVideoStreams, + currentUserId = currentUserId, onDoubleTap = { selectedParticipant -> selectedParticipantForFullScreen = selectedParticipant shouldOpenFullScreen = !shouldOpenFullScreen - } + }, ) DoubleTapToast( modifier = Modifier.align(Alignment.TopCenter), @@ -416,11 +422,16 @@ private fun OngoingCallContent( ) } if (BuildConfig.PICTURE_IN_PICTURE_ENABLED && participants.size > 1) { + val selfUser = + participants.first { participant -> + // API returns only id.value, without domain, till this get changed compare only id.value + participant.id.equalsIgnoringBlankDomain(currentUserId) + } FloatingSelfUserTile( modifier = Modifier.align(Alignment.TopEnd), contentHeight = this@BoxWithConstraints.maxHeight, contentWidth = this@BoxWithConstraints.maxWidth, - participant = participants.first(), + participant = selfUser, onSelfUserVideoPreviewCreated = setVideoPreview, onClearSelfUserVideoPreview = clearVideoPreview ) @@ -564,7 +575,9 @@ fun PreviewOngoingCallContent(participants: PersistentList) { hideDoubleTapToast = {}, onCameraPermissionPermanentlyDenied = {}, requestVideoStreams = {}, - participants = participants + participants = participants, + inPictureInPictureMode = false, + currentUserId = UserId("userId", "domain"), ) } diff --git a/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantsview/ParticipantsTiles.kt b/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantsview/VerticalCallingPager.kt similarity index 93% rename from app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantsview/ParticipantsTiles.kt rename to app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantsview/VerticalCallingPager.kt index 99ba862721a..3db3a4b43b4 100644 --- a/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantsview/ParticipantsTiles.kt +++ b/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantsview/VerticalCallingPager.kt @@ -41,7 +41,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.wire.android.BuildConfig -import com.wire.android.ui.LocalActivity import com.wire.android.ui.calling.model.UICallParticipant import com.wire.android.ui.calling.ongoing.buildPreviewParticipantsList import com.wire.android.ui.calling.ongoing.fullscreen.SelectedParticipant @@ -52,6 +51,7 @@ import com.wire.android.ui.common.dimensions import com.wire.android.ui.theme.WireTheme import com.wire.android.ui.theme.wireDimensions import com.wire.android.util.ui.PreviewMultipleThemes +import com.wire.kalium.logic.data.user.UserId private const val MAX_TILES_PER_PAGE = 8 private const val MAX_ITEMS_FOR_HORIZONTAL_VIEW = 3 @@ -61,15 +61,15 @@ fun VerticalCallingPager( participants: List, isSelfUserMuted: Boolean, isSelfUserCameraOn: Boolean, + isInPictureInPictureMode: Boolean, contentHeight: Dp, + currentUserId: UserId, onSelfVideoPreviewCreated: (view: View) -> Unit, onSelfClearVideoPreview: () -> Unit, requestVideoStreams: (participants: List) -> Unit, onDoubleTap: (selectedParticipant: SelectedParticipant) -> Unit, modifier: Modifier = Modifier, ) { - val activity = LocalActivity.current - Column( modifier = modifier .fillMaxWidth() @@ -101,13 +101,13 @@ fun VerticalCallingPager( if (participantsChunkedList[pageIndex].size <= MAX_ITEMS_FOR_HORIZONTAL_VIEW) { CallingHorizontalView( participants = participantsChunkedList[pageIndex], - pageIndex = pageIndex, isSelfUserMuted = isSelfUserMuted, isSelfUserCameraOn = isSelfUserCameraOn, contentHeight = contentHeight, onSelfVideoPreviewCreated = onSelfVideoPreviewCreated, onSelfClearVideoPreview = onSelfClearVideoPreview, - onDoubleTap = onDoubleTap + onDoubleTap = onDoubleTap, + currentUserId = currentUserId, ) } else { GroupCallGrid( @@ -118,7 +118,8 @@ fun VerticalCallingPager( contentHeight = contentHeight, onSelfVideoPreviewCreated = onSelfVideoPreviewCreated, onSelfClearVideoPreview = onSelfClearVideoPreview, - onDoubleTap = onDoubleTap + onDoubleTap = onDoubleTap, + currentUserId = currentUserId, ) } @@ -132,7 +133,7 @@ fun VerticalCallingPager( } } // we don't need to display the indicator if we have one page and when it's in PiP mode - if (pagesCount(participants.size) > 1 && !activity.isInPictureInPictureMode) { + if (pagesCount(participants.size) > 1 && !isInPictureInPictureMode) { Surface( shape = RoundedCornerShape(dimensions().corner16x), modifier = Modifier @@ -165,7 +166,9 @@ private fun pagesCount(size: Int): Int { val pages = size / MAX_TILES_PER_PAGE return if (size % MAX_TILES_PER_PAGE > 0) { pages + 1 - } else pages + } else { + pages + } } @Composable @@ -178,7 +181,9 @@ private fun PreviewVerticalCallingPager(participants: List) { onSelfVideoPreviewCreated = {}, onSelfClearVideoPreview = {}, requestVideoStreams = {}, - onDoubleTap = { } + onDoubleTap = { }, + isInPictureInPictureMode = false, + currentUserId = UserId("id", "domain") ) } diff --git a/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantsview/gridview/CallingGridView.kt b/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantsview/gridview/CallingGridView.kt index 63d431a4d35..6b26f6025db 100644 --- a/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantsview/gridview/CallingGridView.kt +++ b/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantsview/gridview/CallingGridView.kt @@ -34,7 +34,6 @@ import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.times -import com.wire.android.BuildConfig import com.wire.android.ui.LocalActivity import com.wire.android.ui.calling.model.UICallParticipant import com.wire.android.ui.calling.ongoing.buildPreviewParticipantsList @@ -43,6 +42,7 @@ import com.wire.android.ui.calling.ongoing.participantsview.ParticipantTile import com.wire.android.ui.common.dimensions import com.wire.android.ui.theme.WireTheme import com.wire.android.util.ui.PreviewMultipleThemes +import com.wire.kalium.logic.data.user.UserId @Composable fun GroupCallGrid( @@ -51,6 +51,7 @@ fun GroupCallGrid( isSelfUserMuted: Boolean, isSelfUserCameraOn: Boolean, contentHeight: Dp, + currentUserId: UserId, onSelfVideoPreviewCreated: (view: View) -> Unit, onSelfClearVideoPreview: () -> Unit, onDoubleTap: (selectedParticipant: SelectedParticipant) -> Unit, @@ -82,11 +83,8 @@ fun GroupCallGrid( key = { it.id.toString() + it.clientId + pageIndex }, contentType = { getContentType(it.isCameraOn, it.isSharingScreen) } ) { participant -> - // since we are getting participants by chunk of 8 items, - // we need to check that we are on first page for self user - val isSelfUser = remember(pageIndex, participants.first()) { - pageIndex == 0 && participants.first() == participant && !BuildConfig.PICTURE_IN_PICTURE_ENABLED - } + // API returns only id.value, without domain, till this get changed compare only id.value + val isSelfUser = participant.id.equalsIgnoringBlankDomain(currentUserId) ParticipantTile( modifier = Modifier @@ -142,7 +140,8 @@ private fun PreviewGroupCallGrid(participants: List, modifier contentHeight = 800.dp, onSelfVideoPreviewCreated = {}, onSelfClearVideoPreview = {}, - onDoubleTap = { } + onDoubleTap = { }, + currentUserId = UserId("id", "domain") ) } } diff --git a/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantsview/horizentalview/CallingHorizontalView.kt b/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantsview/horizentalview/CallingHorizontalView.kt index 60864ab2d5f..42dce497b4d 100644 --- a/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantsview/horizentalview/CallingHorizontalView.kt +++ b/app/src/main/kotlin/com/wire/android/ui/calling/ongoing/participantsview/horizentalview/CallingHorizontalView.kt @@ -34,7 +34,6 @@ import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.times -import com.wire.android.BuildConfig import com.wire.android.ui.calling.model.UICallParticipant import com.wire.android.ui.calling.ongoing.buildPreviewParticipantsList import com.wire.android.ui.calling.ongoing.fullscreen.SelectedParticipant @@ -42,14 +41,15 @@ import com.wire.android.ui.calling.ongoing.participantsview.ParticipantTile import com.wire.android.ui.common.dimensions import com.wire.android.ui.theme.WireTheme import com.wire.android.util.ui.PreviewMultipleThemes +import com.wire.kalium.logic.data.user.UserId @Composable fun CallingHorizontalView( participants: List, - pageIndex: Int, isSelfUserMuted: Boolean, isSelfUserCameraOn: Boolean, contentHeight: Dp, + currentUserId: UserId, onSelfVideoPreviewCreated: (view: View) -> Unit, onSelfClearVideoPreview: () -> Unit, onDoubleTap: (selectedParticipant: SelectedParticipant) -> Unit, @@ -58,7 +58,8 @@ fun CallingHorizontalView( spacedBy: Dp = dimensions().spacing2x, ) { val tileHeight = remember(participants.size, contentHeight, contentPadding, spacedBy) { - val heightAvailableForItems = contentHeight - 2 * contentPadding - (participants.size - 1) * spacedBy + val heightAvailableForItems = + contentHeight - 2 * contentPadding - (participants.size - 1) * spacedBy heightAvailableForItems / participants.size } LazyColumn( @@ -68,11 +69,8 @@ fun CallingHorizontalView( verticalArrangement = Arrangement.spacedBy(spacedBy) ) { items(items = participants, key = { it.id.toString() + it.clientId }) { participant -> - // since we are getting participants by chunk of 8 items, - // we need to check that we are on first page for self user - val isSelfUser = remember(pageIndex, participants.first()) { - pageIndex == 0 && participants.first() == participant && !BuildConfig.PICTURE_IN_PICTURE_ENABLED - } + // API returns only id.value, without domain, till this get changed compare only id.value + val isSelfUser = participant.id.equalsIgnoringBlankDomain(currentUserId) ParticipantTile( modifier = Modifier .pointerInput(Unit) { @@ -96,24 +94,27 @@ fun CallingHorizontalView( isSelfUserMuted = isSelfUserMuted, isSelfUserCameraOn = isSelfUserCameraOn, onSelfUserVideoPreviewCreated = onSelfVideoPreviewCreated, - onClearSelfUserVideoPreview = onSelfClearVideoPreview + onClearSelfUserVideoPreview = onSelfClearVideoPreview, ) } } } @Composable -fun PreviewCallingHorizontalView(participants: List, modifier: Modifier = Modifier) { +fun PreviewCallingHorizontalView( + participants: List, + modifier: Modifier = Modifier, +) { Box(modifier = modifier.height(800.dp)) { CallingHorizontalView( participants = participants, - pageIndex = 0, isSelfUserMuted = true, isSelfUserCameraOn = false, contentHeight = 800.dp, + currentUserId = UserId("id", "domain"), onSelfVideoPreviewCreated = {}, onSelfClearVideoPreview = {}, - onDoubleTap = { } + onDoubleTap = { }, ) } } diff --git a/kalium b/kalium index 77e42a2af5a..77bf60957cd 160000 --- a/kalium +++ b/kalium @@ -1 +1 @@ -Subproject commit 77e42a2af5adabba936b7ae6307475a93545d6b1 +Subproject commit 77bf60957cdc50e9b81d9327883adc2b93285472