findfamily: remove relay status indicator
- Commit
07d8f2298a20e976453ca7fc5fd4467e488ed2ff- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-02 02:19 UTC (4 days ago)
- Parents
cdf0aea
Remove the RelayStatusChip from the findfamily map page: the chip in the top bar (phone) and over the map (expanded layout) that showed Relay connected / Relay offline with the age of the newest location. Delete the chip composable, its two call sites, the relayConnected and lastLocationMillis fields on MainPageUiState that existed only to feed it, the FindFamilyViewModel relayConnected exposure, and the relay_connected / relay_disconnected_last_updated / relay_disconnected_no_locations strings from values/strings.xml (no values-* locale carried a translation of them). The underlying sync and connection plumbing is untouched: Networking.liveConnectedFlow and the live relay loop still run exactly as before; only the UI indicator is gone. No test pinned the indicator, so no test changes were needed. Verified in this worktree: :findfamily:testDevUnitTest is green. :findfamily:lint and :findfamily:lintVitalRelease both report the same 13 pre-existing errors (3 DialogAsRoute, 10 RouteScreenshotCoverage, in MainActivity.kt, PersonDetailSheet.kt, PersonSheet.kt and Route.kt - none of them files touched here) and no new findings from this change.
Diff
findfamily/src/main/java/com/vayunmathur/findfamily/platform/FindFamilyUiContract.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FindFamilyUiContract.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FindFamilyUiContract.ktindex b9f40faffc..a0df8899d9 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FindFamilyUiContract.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FindFamilyUiContract.kt@@ -118,10 +118,6 @@ interface PersonActions { data class MainPageUiState( val usingGpsFallback: Boolean = false, val familyList: FamilyListUiState = FamilyListUiState(),- /** True while the live relay socket is connected; false means positions may be stale. */- val relayConnected: Boolean = true,- /** Epoch millis of the newest family location report, for the disconnected staleness line. */- val lastLocationMillis: Long? = null, ) /**
findfamily/src/main/java/com/vayunmathur/findfamily/platform/FindFamilyViewModel.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FindFamilyViewModel.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FindFamilyViewModel.ktindex d0b27a924e..86f9bac9fa 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FindFamilyViewModel.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FindFamilyViewModel.kt@@ -90,9 +90,6 @@ class FindFamilyViewModel( val latestLocationByUser: StateFlow<Map<Long, LocationValue>> = repository.latestLocationByUser .stateIn(viewModelScope, SharingStarted.WhileSubscribed(5_000), emptyMap()) - /** Relay socket connectivity for the top-bar status; false must not read as family offline. */- val relayConnected: StateFlow<Boolean> = Networking.liveConnectedFlow- /** Connected people (mutual connection or awaiting our response) — the main list. */ val connectedUsers: StateFlow<List<User>> = repository.users .map { list ->
findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPage.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPage.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPage.ktindex 1737243c1b..08f58e2101 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPage.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPage.kt@@ -202,8 +202,6 @@ fun MainPage( val usersByLocationName by ffViewModel.usersByLocationName.collectAsState() val userPositions by ffViewModel.latestLocationByUser.collectAsState() - val relayConnected by ffViewModel.relayConnected.collectAsState()- val context = LocalContext.current // The selected contact (from the sheet route on top of the stack),@@ -221,10 +219,6 @@ fun MainPage( val state = MainPageUiState( usingGpsFallback = usingGpsFallback,- relayConnected = relayConnected,- // Newest report on screen (reportedAt, not the fix's measurement- // time) — what "last updated" means when the relay drops.- lastLocationMillis = userPositions.values.maxOfOrNull { it.reportedAt.toEpochMilliseconds() }, familyList = FamilyListUiState( connectedUsers = connectedUsers, awaitingRequestUsers = awaitingRequestUsers,
findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPageContent.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPageContent.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPageContent.ktindex 43791f4b34..a5df74f4be 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPageContent.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPageContent.kt@@ -93,11 +93,6 @@ fun MainPageContent( map = { Box(Modifier.fillMaxSize()) { map()- RelayStatusChip(- relayConnected = state.relayConnected,- lastLocationMillis = state.lastLocationMillis,- modifier = Modifier.align(Alignment.TopStart).padding(16.dp),- ) } }, panel = { modifier ->
findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPageOverlays.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPageOverlays.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPageOverlays.ktindex 3c4ff7d4d5..2dcf2903cf 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPageOverlays.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPageOverlays.kt@@ -40,11 +40,5 @@ internal fun MapOverlayBar( TopAppBarOverlay( onNavigateBack = null, actions = overlayActions,- title = {- RelayStatusChip(- relayConnected = state.relayConnected,- lastLocationMillis = state.lastLocationMillis,- )- } ) }
findfamily/src/main/java/com/vayunmathur/findfamily/ui/RelayStatusChip.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/RelayStatusChip.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/RelayStatusChip.ktdeleted file mode 100644index cb7770d37c..0000000000--- a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/RelayStatusChip.kt+++ /dev/null@@ -1,89 +0,0 @@-package com.vayunmathur.findfamily.ui--import androidx.compose.foundation.background-import androidx.compose.foundation.layout.Arrangement-import androidx.compose.foundation.layout.Row-import androidx.compose.foundation.layout.padding-import androidx.compose.foundation.layout.size-import androidx.compose.foundation.shape.RoundedCornerShape-import androidx.compose.runtime.Composable-import androidx.compose.runtime.LaunchedEffect-import androidx.compose.runtime.getValue-import androidx.compose.runtime.mutableLongStateOf-import androidx.compose.runtime.remember-import androidx.compose.runtime.setValue-import androidx.compose.ui.Alignment-import androidx.compose.ui.Modifier-import androidx.compose.ui.platform.LocalContext-import androidx.compose.ui.res.stringResource-import androidx.compose.ui.text.style.TextOverflow-import androidx.compose.ui.unit.dp-import com.vayunmathur.findfamily.R-import com.vayunmathur.library.ui.IconWifiFull-import com.vayunmathur.library.ui.IconWifiOff-import com.vayunmathur.library.ui.MaterialTheme-import com.vayunmathur.library.ui.Text-import kotlin.time.Instant-import kotlinx.coroutines.delay--/**- * Relay connectivity for the map top bar.- *- * A relay outage and every family member being offline used to look the- * same: pins simply stopped moving. This chip makes the relay itself- * visible — connected quietly, disconnected with the age of the newest- * location on screen so stale positions are never read as current.- */-@Composable-fun RelayStatusChip(relayConnected: Boolean, lastLocationMillis: Long?, modifier: Modifier = Modifier) {- val context = LocalContext.current- // Re-render the "last updated" age while disconnected; it is the whole- // point of the disconnected state and must not freeze at disconnect time.- var nowMillis by remember { mutableLongStateOf(System.currentTimeMillis()) }- LaunchedEffect(relayConnected) {- while (!relayConnected) {- nowMillis = System.currentTimeMillis()- delay(30_000L)- }- }- val container = if (relayConnected) {- MaterialTheme.colorScheme.surfaceContainerHigh- } else {- MaterialTheme.colorScheme.errorContainer- }- val content = if (relayConnected) {- MaterialTheme.colorScheme.onSurface- } else {- MaterialTheme.colorScheme.onErrorContainer- }- val label = if (relayConnected) {- stringResource(R.string.relay_connected)- } else if (lastLocationMillis != null) {- stringResource(- R.string.relay_disconnected_last_updated,- timestring(Instant.fromEpochMilliseconds(lastLocationMillis), context),- )- } else {- stringResource(R.string.relay_disconnected_no_locations)- }- Row(- modifier = modifier- .background(container, RoundedCornerShape(50))- .padding(horizontal = 10.dp, vertical = 6.dp),- horizontalArrangement = Arrangement.spacedBy(6.dp),- verticalAlignment = Alignment.CenterVertically,- ) {- if (relayConnected) {- IconWifiFull(Modifier.size(16.dp), tint = content)- } else {- IconWifiOff(Modifier.size(16.dp), tint = content)- }- Text(- label,- style = MaterialTheme.typography.labelMedium,- color = content,- maxLines = 1,- overflow = TextOverflow.Ellipsis,- )- }-}
findfamily/src/main/res/values/strings.xml
diff --git a/findfamily/src/main/res/values/strings.xml b/findfamily/src/main/res/values/strings.xmlindex 1289274178..a70dec80f1 100644--- a/findfamily/src/main/res/values/strings.xml+++ b/findfamily/src/main/res/values/strings.xml@@ -146,13 +146,6 @@ <!-- MainPage: BatteryBar percentage label. %1$d = battery level 0-100, e.g. 85 --> <string name="battery_percentage"><xliff:g id="battery_level" example="85">%1$d</xliff:g>%%</string> - <!-- MainPage: relay status chip while the live socket is connected. Short label -->- <string name="relay_connected">Relay connected</string>- <!-- MainPage: relay status chip while disconnected. %1$s = age of newest location, e.g. 5 minutes ago -->- <string name="relay_disconnected_last_updated">Relay offline · Last updated <xliff:g id="last_updated" example="5 minutes ago">%1$s</xliff:g></string>- <!-- MainPage: relay status chip while disconnected with no location received yet -->- <string name="relay_disconnected_no_locations">Relay offline · Locations may be out of date</string>- <!-- MainPage: timestring helper for just now. Adverbial phrase, past --> <string name="time_just_now">just now</string> <!-- MainPage: timestring past minutes. %1$d = count, e.g. 5 -->