Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: empty dependencies section [WPB-10929] #3425

Merged
merged 4 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading