From 2118e42cfd29b02b8eac439ef3a59f6288f49b98 Mon Sep 17 00:00:00 2001 From: AndroidBob Date: Mon, 12 Feb 2024 16:08:44 +0100 Subject: [PATCH] fix(e2ei): remove E2EI shield from remove device screen (WPB-6519) (#2686) Co-authored-by: Mojtaba Chenani --- .../ui/authentication/devices/DeviceItem.kt | 15 ++++++++---- .../ui/settings/devices/SelfDevicesScreen.kt | 23 +++++++++++-------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/authentication/devices/DeviceItem.kt b/app/src/main/kotlin/com/wire/android/ui/authentication/devices/DeviceItem.kt index 112d9300e18..c171c236fa7 100644 --- a/app/src/main/kotlin/com/wire/android/ui/authentication/devices/DeviceItem.kt +++ b/app/src/main/kotlin/com/wire/android/ui/authentication/devices/DeviceItem.kt @@ -73,6 +73,7 @@ fun DeviceItem( device: Device, placeholder: Boolean, shouldShowVerifyLabel: Boolean, + isCurrentClient: Boolean = false, background: Color? = null, icon: @Composable (() -> Unit), isWholeItemClickable: Boolean = false, @@ -85,7 +86,8 @@ fun DeviceItem( icon = icon, onClickAction = onClickAction, isWholeItemClickable = isWholeItemClickable, - shouldShowVerifyLabel = shouldShowVerifyLabel + shouldShowVerifyLabel = shouldShowVerifyLabel, + isCurrentClient = isCurrentClient ) } @@ -97,7 +99,8 @@ private fun DeviceItemContent( icon: @Composable (() -> Unit), onClickAction: ((Device) -> Unit)?, isWholeItemClickable: Boolean, - shouldShowVerifyLabel: Boolean + shouldShowVerifyLabel: Boolean, + isCurrentClient: Boolean ) { Row( verticalAlignment = Alignment.Top, @@ -123,7 +126,7 @@ private fun DeviceItemContent( modifier = Modifier .padding(start = MaterialTheme.wireDimensions.removeDeviceItemPadding) .weight(1f) - ) { DeviceItemTexts(device, placeholder, shouldShowVerifyLabel) } + ) { DeviceItemTexts(device, placeholder, shouldShowVerifyLabel, isCurrentClient) } } if (!placeholder) { if (onClickAction != null && !isWholeItemClickable) { @@ -154,6 +157,7 @@ private fun DeviceItemTexts( device: Device, placeholder: Boolean, shouldShowVerifyLabel: Boolean, + isCurrentClient: Boolean = false, isDebug: Boolean = BuildConfig.DEBUG ) { val displayZombieIndicator = remember { @@ -173,10 +177,10 @@ private fun DeviceItemTexts( .wrapContentWidth() .shimmerPlaceholder(visible = placeholder) ) - MLSVerificationIcon(device.e2eiCertificateStatus) if (shouldShowVerifyLabel) { + MLSVerificationIcon(device.e2eiCertificateStatus) Spacer(modifier = Modifier.width(MaterialTheme.wireDimensions.spacing8x)) - if (device.isVerifiedProteus) ProteusVerifiedIcon( + if (device.isVerifiedProteus && !isCurrentClient) ProteusVerifiedIcon( Modifier .wrapContentWidth() .align(Alignment.CenterVertically)) @@ -251,6 +255,7 @@ fun PreviewDeviceItemWithActionIcon() { device = Device(name = UIText.DynamicString("name"), isVerifiedProteus = true), placeholder = false, shouldShowVerifyLabel = true, + isCurrentClient = true, background = null, { Icon(painter = painterResource(id = R.drawable.ic_remove), contentDescription = "") } ) {} diff --git a/app/src/main/kotlin/com/wire/android/ui/settings/devices/SelfDevicesScreen.kt b/app/src/main/kotlin/com/wire/android/ui/settings/devices/SelfDevicesScreen.kt index 5ebe3d29750..b451b7eadc3 100644 --- a/app/src/main/kotlin/com/wire/android/ui/settings/devices/SelfDevicesScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/settings/devices/SelfDevicesScreen.kt @@ -90,17 +90,20 @@ fun SelfDevicesScreenContent( false -> { state.currentDevice?.let { currentDevice -> folderDeviceItems( - context.getString(R.string.current_device_label), - listOf(currentDevice), - false, - onDeviceClick + header = context.getString(R.string.current_device_label), + items = listOf(currentDevice), + shouldShowVerifyLabel = true, + isCurrentClient = true, + onDeviceClick = onDeviceClick, + ) } folderDeviceItems( - context.getString(R.string.other_devices_label), - state.deviceList, - true, - onDeviceClick + header = context.getString(R.string.other_devices_label), + items = state.deviceList, + shouldShowVerifyLabel = true, + isCurrentClient = false, + onDeviceClick = onDeviceClick ) } } @@ -113,6 +116,7 @@ private fun LazyListScope.folderDeviceItems( header: String, items: List, shouldShowVerifyLabel: Boolean, + isCurrentClient: Boolean, onDeviceClick: (Device) -> Unit = {} ) { folderWithElements( @@ -132,7 +136,8 @@ private fun LazyListScope.folderDeviceItems( onClickAction = onDeviceClick, icon = Icons.Filled.ChevronRight.Icon(), isWholeItemClickable = true, - shouldShowVerifyLabel = shouldShowVerifyLabel + shouldShowVerifyLabel = shouldShowVerifyLabel, + isCurrentClient = isCurrentClient ) } }