Skip to content

Commit

Permalink
fix(e2ei): remove E2EI shield from remove device screen (WPB-6519) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mchenani authored Feb 12, 2024
1 parent 6f61248 commit 876f5da
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ fun DeviceItem(
device: Device,
placeholder: Boolean,
shouldShowVerifyLabel: Boolean,
isCurrentClient: Boolean = false,
background: Color? = null,
icon: @Composable (() -> Unit),
isWholeItemClickable: Boolean = false,
Expand All @@ -85,7 +86,8 @@ fun DeviceItem(
icon = icon,
onClickAction = onClickAction,
isWholeItemClickable = isWholeItemClickable,
shouldShowVerifyLabel = shouldShowVerifyLabel
shouldShowVerifyLabel = shouldShowVerifyLabel,
isCurrentClient = isCurrentClient
)
}

Expand All @@ -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,
Expand All @@ -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) {
Expand Down Expand Up @@ -154,6 +157,7 @@ private fun DeviceItemTexts(
device: Device,
placeholder: Boolean,
shouldShowVerifyLabel: Boolean,
isCurrentClient: Boolean = false,
isDebug: Boolean = BuildConfig.DEBUG
) {
val displayZombieIndicator = remember {
Expand All @@ -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))
Expand Down Expand Up @@ -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 = "") }
) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}
}
Expand All @@ -113,6 +116,7 @@ private fun LazyListScope.folderDeviceItems(
header: String,
items: List<Device>,
shouldShowVerifyLabel: Boolean,
isCurrentClient: Boolean,
onDeviceClick: (Device) -> Unit = {}
) {
folderWithElements(
Expand All @@ -132,7 +136,8 @@ private fun LazyListScope.folderDeviceItems(
onClickAction = onDeviceClick,
icon = Icons.Filled.ChevronRight.Icon(),
isWholeItemClickable = true,
shouldShowVerifyLabel = shouldShowVerifyLabel
shouldShowVerifyLabel = shouldShowVerifyLabel,
isCurrentClient = isCurrentClient
)
}
}
Expand Down

0 comments on commit 876f5da

Please sign in to comment.