fix: Resolve debug settings bottom sheet crash on some devices (#474)

Fixes #472 - App crashing in debug settings
The issue was in ui/debug/DebugSettingsSheet.kt:
- Line 304: Code was pre-formatting double value with String.format() then passing
  to string resource that expected raw double parameter
- Line 307: Numeric values weren't properly converted to strings for string resource
  that expected string parameters
Changes made:
- Changed stringResource(R.string.debug_target_fpr_fmt, String.format("%.2f", gcsFpr))
  to stringResource(R.string.debug_target_fpr_fmt, gcsFpr) - passes raw double value
- Changed stringResource(R.string.debug_derived_p_fmt, p, nmax)
  to stringResource(R.string.debug_derived_p_fmt, p.toString(), nmax.toString()) -
  properly converts numeric values to strings
This resolves the IllegalFormatConversionException: f != java.lang.String crash
when scrolling through the debug settings bottom sheet.
This commit is contained in:
Developer Chunk
2025-10-16 13:21:44 +02:00
committed by GitHub
parent 4a6fe922f3
commit fc3a00b4b9
2 changed files with 12 additions and 2 deletions
+7
View File
@@ -3,6 +3,13 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## [1.4.0] - 2025-10-15
### Fixed
- fix: Resolve debug settings bottom sheet crash on some devices (Issue #472)
- Fixed IllegalFormatConversionException in DebugSettingsSheet.kt when scrolling through debug settings
- Corrected string formatting for debug_target_fpr_fmt and debug_derived_p_fmt string resources
- Improved string resource parameter handling for numeric values
## [0.7.2] - 2025-07-20 ## [0.7.2] - 2025-07-20
### Fixed ### Fixed
- fix: battery optimization screen content scrollable with fixed buttons - fix: battery optimization screen content scrollable with fixed buttons
@@ -301,15 +301,18 @@ fun DebugSettingsSheet(
Slider(value = seenCapacity.toFloat(), onValueChange = { manager.setSeenPacketCapacity(it.toInt()) }, valueRange = 10f..1000f, steps = 99) Slider(value = seenCapacity.toFloat(), onValueChange = { manager.setSeenPacketCapacity(it.toInt()) }, valueRange = 10f..1000f, steps = 99)
Text(stringResource(R.string.debug_max_gcs_filter_size_fmt, gcsMaxBytes), fontFamily = FontFamily.Monospace, fontSize = 11.sp, color = colorScheme.onSurface.copy(alpha = 0.7f)) Text(stringResource(R.string.debug_max_gcs_filter_size_fmt, gcsMaxBytes), fontFamily = FontFamily.Monospace, fontSize = 11.sp, color = colorScheme.onSurface.copy(alpha = 0.7f))
Slider(value = gcsMaxBytes.toFloat(), onValueChange = { manager.setGcsMaxBytes(it.toInt()) }, valueRange = 128f..1024f, steps = 0) Slider(value = gcsMaxBytes.toFloat(), onValueChange = { manager.setGcsMaxBytes(it.toInt()) }, valueRange = 128f..1024f, steps = 0)
Text(stringResource(R.string.debug_target_fpr_fmt, String.format("%.2f", gcsFpr)), fontFamily = FontFamily.Monospace, fontSize = 11.sp, color = colorScheme.onSurface.copy(alpha = 0.7f)) Text(stringResource(R.string.debug_target_fpr_fmt, gcsFpr), fontFamily = FontFamily.Monospace, fontSize = 11.sp, color = colorScheme.onSurface.copy(alpha = 0.7f))
Slider(value = gcsFpr.toFloat(), onValueChange = { manager.setGcsFprPercent(it.toDouble()) }, valueRange = 0.1f..5.0f, steps = 49) Slider(value = gcsFpr.toFloat(), onValueChange = { manager.setGcsFprPercent(it.toDouble()) }, valueRange = 0.1f..5.0f, steps = 49)
val p = remember(gcsFpr) { com.bitchat.android.sync.GCSFilter.deriveP(gcsFpr / 100.0) } val p = remember(gcsFpr) { com.bitchat.android.sync.GCSFilter.deriveP(gcsFpr / 100.0) }
val nmax = remember(gcsFpr, gcsMaxBytes) { com.bitchat.android.sync.GCSFilter.estimateMaxElementsForSize(gcsMaxBytes, p) } val nmax = remember(gcsFpr, gcsMaxBytes) { com.bitchat.android.sync.GCSFilter.estimateMaxElementsForSize(gcsMaxBytes, p) }
Text(stringResource(R.string.debug_derived_p_fmt, p, nmax), fontFamily = FontFamily.Monospace, fontSize = 11.sp, color = colorScheme.onSurface.copy(alpha = 0.7f)) Text(stringResource(R.string.debug_derived_p_fmt, p.toString(), nmax.toString()), fontFamily = FontFamily.Monospace, fontSize = 11.sp, color = colorScheme.onSurface.copy(alpha = 0.7f))
} }
} }
} }
// Connected devices // Connected devices
item { item {
Surface(shape = RoundedCornerShape(12.dp), color = colorScheme.surfaceVariant.copy(alpha = 0.2f)) { Surface(shape = RoundedCornerShape(12.dp), color = colorScheme.surfaceVariant.copy(alpha = 0.2f)) {