From 9576607fc6d3b0dd3f48ddce2f9d0b1db5bd87cb Mon Sep 17 00:00:00 2001 From: QIU Date: Wed, 26 Aug 2026 06:43:53 +0000 Subject: [PATCH] fix(log): mark a held clock in words, not only in colour Three corrections to the editable-time commit. The held clock was distinguished only by colorScheme.primary. Material is explicit that colour must not be the sole carrier of meaning, and roughly one man in twelve cannot reliably separate that colour from the default text. Missing it costs every remaining contact the wrong time and, for a pass across midnight UTC, the wrong day. The row now reads "Held at 23:58" rather than just showing it in a different colour. The comment on the state claimed rememberSaveable survives rotation but not process death. Official documentation says the opposite: it goes through the saved instance state and does survive system-initiated process death. A probe traced the one case that genuinely loses the hold - the user swiping the app away - and not restoring it there is correct, since a clock pressed hours ago would put the next session's contacts on the wrong day. The comment says that now instead of something false. MenuAnchorType is deprecated in favour of ExposedDropdownMenuAnchorType. Surfaced by a subagent's build log rather than mine, because my grep filter was hiding warnings. --- .../src/main/res/values-zh/strings.xml | 1 + .../src/main/res/values/strings.xml | 1 + .../rtbishop/look4sat/feature/radar/LogTab.kt | 22 +++++++++++++------ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/core/presentation/src/main/res/values-zh/strings.xml b/core/presentation/src/main/res/values-zh/strings.xml index ea7c5c3c..6769961b 100644 --- a/core/presentation/src/main/res/values-zh/strings.xml +++ b/core/presentation/src/main/res/values-zh/strings.xml @@ -280,6 +280,7 @@ 修改模式 时间 当前 + 按住 %1$s 设置记录时间 UTC 时间如 14:55, 或 +3 / -2 分钟。留空则用当前时间。 不是时间 - 将使用当前时间 diff --git a/core/presentation/src/main/res/values/strings.xml b/core/presentation/src/main/res/values/strings.xml index 2ecf03e6..10b7a2a9 100644 --- a/core/presentation/src/main/res/values/strings.xml +++ b/core/presentation/src/main/res/values/strings.xml @@ -311,6 +311,7 @@ Edit the mode Time Now + Held at %1$s Set the logging time UTC time such as 14:55, or +3 / -2 minutes. Empty logs at the current time. Not a time - the current time will be used diff --git a/feature/radar/src/main/java/com/rtbishop/look4sat/feature/radar/LogTab.kt b/feature/radar/src/main/java/com/rtbishop/look4sat/feature/radar/LogTab.kt index 0702ae24..061f344b 100644 --- a/feature/radar/src/main/java/com/rtbishop/look4sat/feature/radar/LogTab.kt +++ b/feature/radar/src/main/java/com/rtbishop/look4sat/feature/radar/LogTab.kt @@ -40,7 +40,7 @@ import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExposedDropdownMenuBox import androidx.compose.material3.ExposedDropdownMenuDefaults -import androidx.compose.material3.MenuAnchorType +import androidx.compose.material3.ExposedDropdownMenuAnchorType import androidx.compose.material3.Icon import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.MaterialTheme @@ -145,7 +145,7 @@ fun LogTab( trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = menuExpanded) }, textStyle = MaterialTheme.typography.bodyMedium, modifier = Modifier - .menuAnchor(MenuAnchorType.PrimaryNotEditable) + .menuAnchor(ExposedDropdownMenuAnchorType.PrimaryNotEditable) .fillMaxWidth() ) ExposedDropdownMenu( @@ -283,8 +283,10 @@ private fun ExpandedLogInput( var modeEditable by remember(radio.uuid) { mutableStateOf(false) } val editModeLabel = stringResource(id = R.string.wavelog_mode_edit) val editTimeLabel = stringResource(id = R.string.wavelog_time_edit) - // Survives rotation like workedThisSession: losing a held clock mid-transcription would put - // every remaining contact at the wrong time without saying so. + // rememberSaveable, not remember: this goes through the saved instance state, so a held clock + // survives rotation AND system-initiated process death. Losing it mid-transcription would put + // every remaining contact at the wrong time and on the wrong UTC day without saying so. It is + // deliberately NOT restored when the user swipes the app away - that is them ending the session. var timeEntry by rememberSaveable { mutableStateOf("") } var timeEditable by rememberSaveable { mutableStateOf(false) } // Calls logged during this pass, so a repeat can be mentioned without being blocked: the same @@ -512,10 +514,16 @@ private fun ExpandedLogInput( color = MaterialTheme.colorScheme.onSurfaceVariant ) Text( - text = if (holding) timeEntry.trim() else stringResource(id = R.string.wavelog_time_live), + // A held clock is marked in words as well as colour. Material is explicit that + // colour must not be the only carrier of meaning, and roughly one man in twelve + // cannot reliably separate the primary colour from the default text here. The + // consequence of missing it is every remaining contact logged at the wrong time. + text = if (holding) { + stringResource(id = R.string.wavelog_time_held, timeEntry.trim()) + } else { + stringResource(id = R.string.wavelog_time_live) + }, style = MaterialTheme.typography.bodyMedium, - // A held clock is coloured, because logging at the wrong time silently is the - // failure this whole change exists to prevent. color = if (holding) { MaterialTheme.colorScheme.primary } else {