Drop the source name from the status line, make it localized

statusLine() used to build the whole "via Coinbase, updated ..."
string in shared code with hardcoded English literals ("updated",
"loading rates…", "via ") — not localizable, since this shared code
has no Composable/moko-resources context to resolve a string from,
and said more than needed (the source is already shown in the Price
Source picker right above it).

Replaced with lastUpdatedDateTime(): String?, which returns only the
locale-formatted date/time (still shared, since that part is genuine
platform-native locale formatting, not translated text) — null for
Manual, or while the first fetch hasn't completed. Each UI layer now
builds the localized "Updated %1$s" / "Loading rates…" text itself
via stringResource()/IosLocalizationKt around that value, using two
new string resources.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FXcrACM5sok3M1KQJ8kByy
This commit is contained in:
2026-09-10 15:45:52 +03:00
co-authored by Claude Sonnet 5
parent 70ce0bccb1
commit cd37d5c472
5 changed files with 39 additions and 11 deletions
@@ -11,10 +11,16 @@ import kotlin.time.Instant
/** Derived display strings/flags shared between the Compose UI and the iOS SwiftUI bridge. */
fun ConverterUiState.statusLine(): String {
if (isManualSource) return ""
val updated = lastUpdated?.let { "updated ${it.toDateTimeString()}" } ?: "loading rates…"
return if (sourceName.isEmpty()) updated else "via $sourceName, $updated"
/**
* The current platform's locale-formatted rendering of [ConverterUiState.lastUpdated] — just the
* date/time itself, not the surrounding localized "Updated ..."/"Loading rates…" text, since this
* shared code has no Composable/moko-resources context to resolve a localized string from; the UI
* layer supplies that around whatever this returns. Null while manual (nothing to show — a
* manually typed rate has no "last updated" moment) or before the first fetch completes.
*/
fun ConverterUiState.lastUpdatedDateTime(): String? {
if (isManualSource) return null
return lastUpdated?.toDateTimeString()
}
fun ConverterUiState.exceedsMaxSupply(): Boolean {
@@ -141,8 +141,13 @@ fun PriceScreen(
) {
Column(modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp)) {
Text("SatsPrice", style = MaterialTheme.typography.headlineMedium)
val statusLine = state.statusLine()
if (statusLine.isNotEmpty()) {
val statusLine = if (state.isManualSource) {
null
} else {
state.lastUpdatedDateTime()?.let { stringResource(MR.strings.updated_status, it) }
?: stringResource(MR.strings.loading_rates_status)
}
if (statusLine != null) {
Text(
text = statusLine,
style = MaterialTheme.typography.bodySmall,