Skip to content

Commit

Permalink
fix: empty dependencies section [WPB-10929] (#3425)
Browse files Browse the repository at this point in the history
  • Loading branch information
saleniuk authored Sep 10, 2024
1 parent b8fb118 commit 4f9f365
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -431,20 +431,23 @@ private fun DebugToolsOptions(
*/
@Composable
fun DependenciesItem(dependencies: ImmutableMap<String, String?>) {
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)
)
}
},
)
}

Expand Down Expand Up @@ -478,12 +481,9 @@ private fun DisableEventProcessingSwitch(
}

@Stable
private fun prettyPrintMap(map: Map<String, String?>, title: String): String = StringBuilder().apply {
append("$title\n")
map.forEach { (key, value) ->
append("$key: $value\n")
}
}.toString()
private fun Map<String, String?>.prettyPrintMap(): String = this
.map { (key, value) -> "$key: $value" }
.joinToString("\n")

//endregion

Expand Down Expand Up @@ -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")
)
}
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
<string name="debug_settings_api_versioning_title" translatable="false">API VERSIONING</string>
<string name="debug_settings_e2ei_enrollment_title" translatable="false">E2EI Manual Enrollment</string>
<string name="debug_settings_force_api_versioning_update" translatable="false">Force API versioning update</string>
<string name="item_dependencies_title">Dependencies:</string>
<string name="item_dependencies_title">Dependencies</string>
<string name="debug_settings_force_api_versioning_update_button_text" translatable="false">Update</string>
<string name="support_screen_title">Support</string>
<string name="backup_and_restore_screen_title">Back up &amp; Restore Conversations</string>
Expand Down

0 comments on commit 4f9f365

Please sign in to comment.