From 4f9f365367ca888a9b0cd23f1db8ccceffc3b42a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Saleniuk?= <30429749+saleniuk@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:50:55 +0200 Subject: [PATCH] fix: empty dependencies section [WPB-10929] (#3425) --- .../wire/android/ui/debug/DebugDataOptions.kt | 26 +++++++++---------- app/src/main/res/values/strings.xml | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptions.kt b/app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptions.kt index 7cc855f5187..08ad4b2c581 100644 --- a/app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptions.kt +++ b/app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptions.kt @@ -431,20 +431,23 @@ private fun DebugToolsOptions( */ @Composable fun DependenciesItem(dependencies: ImmutableMap) { - val title = stringResource(id = R.string.item_dependencies_title) - val text = remember { - prettyPrintMap(dependencies, title) + val text = remember(dependencies) { + dependencies.prettyPrintMap() } RowItemTemplate( - modifier = Modifier.wrapContentWidth(), + modifier = Modifier.padding(dimensions().spacing8x), title = { + Text( + style = MaterialTheme.wireTypography.label01, + color = MaterialTheme.wireColorScheme.secondaryText, + text = stringResource(id = R.string.item_dependencies_title), + ) Text( style = MaterialTheme.wireTypography.body01, color = MaterialTheme.wireColorScheme.onBackground, text = text, - modifier = Modifier.padding(start = dimensions().spacing8x) ) - } + }, ) } @@ -478,12 +481,9 @@ private fun DisableEventProcessingSwitch( } @Stable -private fun prettyPrintMap(map: Map, title: String): String = StringBuilder().apply { - append("$title\n") - map.forEach { (key, value) -> - append("$key: $value\n") - } -}.toString() +private fun Map.prettyPrintMap(): String = this + .map { (key, value) -> "$key: $value" } + .joinToString("\n") //endregion @@ -512,6 +512,6 @@ fun PreviewOtherDebugOptions() { handleE2EIEnrollmentResult = {}, dismissCertificateDialog = {}, checkCrlRevocationList = {}, - dependenciesMap = persistentMapOf() + dependenciesMap = persistentMapOf("preview dependency" to "1.0.0", "another dependency" to "1.0.0") ) } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9a3a1365571..857b6435b46 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -214,7 +214,7 @@ API VERSIONING E2EI Manual Enrollment Force API versioning update - Dependencies: + Dependencies Update Support Back up & Restore Conversations