fix: extract hardcoded strings to string resources (Constitution §VIII)

- FirmwareReleaseSheetContent: reuse firmware_version string resource
- NeighborInfoLog: add 'success' string resource, replace hardcoded text

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
James Rich
2026-05-11 14:00:48 -05:00
parent 9f7b3624a5
commit 68700f9add
4 changed files with 14 additions and 2 deletions

View File

@@ -1104,6 +1104,7 @@ store_forward
store_forward_config
store_forward_enabled
subnet
success
super_deep_sleep_duration_seconds
supported
supported_by_community

View File

@@ -1146,6 +1146,7 @@
<string name="store_forward_config">Store &amp; Forward Config</string>
<string name="store_forward_enabled">Store &amp; Forward enabled</string>
<string name="subnet">Subred</string>
<string name="success">Success</string>
<string name="super_deep_sleep_duration_seconds">Super deep sleep duration</string>
<string name="supported">Supported</string>
<string name="supported_by_community">Supported by Meshtastic Community</string>

View File

@@ -37,6 +37,7 @@ import org.jetbrains.compose.resources.stringResource
import org.meshtastic.core.database.entity.FirmwareRelease
import org.meshtastic.core.resources.Res
import org.meshtastic.core.resources.download
import org.meshtastic.core.resources.firmware_version
import org.meshtastic.core.resources.view_release
import org.meshtastic.core.ui.icon.Download
import org.meshtastic.core.ui.icon.LinkIcon
@@ -52,7 +53,10 @@ fun FirmwareReleaseSheetContent(firmwareRelease: FirmwareRelease, modifier: Modi
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
Text(text = firmwareRelease.title, style = MaterialTheme.typography.titleLarge)
Text(text = "Version: ${firmwareRelease.id}", style = MaterialTheme.typography.bodyMedium)
Text(
text = stringResource(Res.string.firmware_version, firmwareRelease.id),
style = MaterialTheme.typography.bodyMedium,
)
Markdown(modifier = Modifier.padding(8.dp), content = firmwareRelease.releaseNotes)
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Button(onClick = { openUrl(firmwareRelease.pageUrl) }, modifier = Modifier.weight(1f)) {

View File

@@ -42,6 +42,7 @@ import org.meshtastic.core.model.getNeighborInfoResponse
import org.meshtastic.core.resources.Res
import org.meshtastic.core.resources.neighbor_info
import org.meshtastic.core.resources.routing_error_no_response
import org.meshtastic.core.resources.success
import org.meshtastic.core.ui.component.MainAppBar
import org.meshtastic.core.ui.icon.Groups
import org.meshtastic.core.ui.icon.MeshtasticIcons
@@ -102,7 +103,12 @@ fun NeighborInfoLogScreen(modifier: Modifier = Modifier, viewModel: MetricsViewM
}
val time = DateFormatter.formatDateTime(log.received_date)
val text = if (result != null) "Success" else stringResource(Res.string.routing_error_no_response)
val text =
if (result != null) {
stringResource(Res.string.success)
} else {
stringResource(Res.string.routing_error_no_response)
}
val icon = if (result != null) MeshtasticIcons.Groups else MeshtasticIcons.PersonOff
val header = stringResource(Res.string.neighbor_info)
var expanded by remember { mutableStateOf(false) }