fix: address 2.8.0 release-audit findings (#6189)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
James Rich
2026-07-10 07:41:54 -05:00
committed by GitHub
parent de37a8cc28
commit 0a3e000252
17 changed files with 165 additions and 36 deletions

View File

@@ -63,9 +63,11 @@ import org.meshtastic.core.resources.air_quality_metrics_log
import org.meshtastic.core.resources.co2
import org.meshtastic.core.resources.co2_humidity
import org.meshtastic.core.resources.co2_temperature
import org.meshtastic.core.resources.micrograms_per_cubic_meter
import org.meshtastic.core.resources.pm10
import org.meshtastic.core.resources.pm1_0
import org.meshtastic.core.resources.pm2_5
import org.meshtastic.core.resources.ppm
import org.meshtastic.core.ui.component.Co2Severity
import org.meshtastic.core.ui.theme.AppTheme
import org.meshtastic.core.ui.theme.GraphColors.Blue
@@ -304,18 +306,25 @@ private fun AirQualityMetricsCard(
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Spacer(modifier = Modifier.height(4.dp))
val ugm3 = stringResource(Res.string.micrograms_per_cubic_meter)
val ppmUnit = stringResource(Res.string.ppm)
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) {
Column {
// Present-and-zero is a valid clean-air reading; only `?.` (absent field) hides a row.
aq.pm10_standard?.let { Text("PM1.0: $it µg/m³", style = MaterialTheme.typography.bodySmall) }
aq.pm25_standard?.let { Text("PM2.5: $it µg/m³", style = MaterialTheme.typography.bodySmall) }
aq.pm100_standard?.let { Text("PM10: $it µg/m³", style = MaterialTheme.typography.bodySmall) }
listOfNotNull(
aq.pm10_standard?.let { Res.string.pm1_0 to it },
aq.pm25_standard?.let { Res.string.pm2_5 to it },
aq.pm100_standard?.let { Res.string.pm10 to it },
)
.forEach { (label, value) ->
Text("${stringResource(label)}: $value $ugm3", style = MaterialTheme.typography.bodySmall)
}
}
Column {
aq.co2?.let { co2 ->
val severity = Co2Severity.fromPpm(co2)
Text(
text = "CO₂: $co2 ppm",
text = "${stringResource(Res.string.co2)}: $co2 $ppmUnit",
style = MaterialTheme.typography.bodySmall,
fontWeight = FontWeight.Medium,
color = severity?.color ?: MaterialTheme.colorScheme.onSurface,

View File

@@ -246,13 +246,16 @@ private fun PowerMetricsChart(
->
val currentColor = PowerMetric.CURRENT.color
val voltageColor = PowerMetric.VOLTAGE.color
// The formatter runs outside composition, so resolve the labels here.
val currentLabel = stringResource(Res.string.current)
val voltageLabel = stringResource(Res.string.voltage)
val marker =
ChartStyling.rememberMarker(
valueFormatter =
ChartStyling.createColoredMarkerValueFormatter { value, color ->
when (color) {
currentColor -> "Current: ${MetricFormatter.current(value.toFloat(), 0)}"
voltageColor -> "Voltage: ${NumberFormatter.format(value.toFloat(), 1)} V"
currentColor -> "$currentLabel: ${MetricFormatter.current(value.toFloat(), 0)}"
voltageColor -> "$voltageLabel: ${MetricFormatter.voltage(value.toFloat(), 1)}"
else -> NumberFormatter.format(value.toFloat(), 1)
}
},
@@ -322,7 +325,7 @@ private fun PowerMetricsChart(
if (voltageData.isNotEmpty()) {
VerticalAxis.rememberEnd(
label = ChartStyling.rememberAxisLabel(color = voltageColor),
valueFormatter = { _, value, _ -> "${NumberFormatter.format(value.toFloat(), 1)} V" },
valueFormatter = { _, value, _ -> MetricFormatter.voltage(value.toFloat(), 1) },
)
} else {
null