findfamily: make history a separate nav-graph screen
- Commit
495cd19a8db88c0b45e16a5d2241c78e6a28a69b- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-06 03:56 UTC (8 hours ago)
- Parents
30c105c
History was a mode inside the map page: selecting a person and flipping MapPageState.isShowingPresent swapped the bottom panel to a scrubber, greyed the live pin, and intercepted back to return to present. Per the repo's route-only navigation rule, history is now Route.PersonHistory(userId), a full screen on the back stack with its own pannable map (PersonHistoryPage, centred on the scrubbed position) and the existing HistoryScrubber. The history FAB on the map page pushes it; the history screen hosts no FAB, and back pops to the live map page, which always shows the present so returning needs no present-restoring step. MapPageState loses the present/history mode flag entirely (only the historical position remains, cleared on person/history open); PersonSheet is always the person detail; MainPage drops its history BackHandler and the map/effects lose their historical branches. Tests that pinned the mode flag now pin the historical pin lifecycle and that showHistory pushes PersonHistory. A 12-person-history-page screenshot preview covers the new route (RouteScreenshotCoverage) and the tracked listing screenshots are regenerated. findfamily/AGENTS.md updated to match. Verified: :findfamily:testDevUnitTest (incl. Native suite), :findfamily:lint, :findfamily:lintVitalRelease, :findfamily:metadata.
Diff
findfamily/AGENTS.md
diff --git a/findfamily/AGENTS.md b/findfamily/AGENTS.mdindex 9d2d53e459..0519af0d62 100644--- a/findfamily/AGENTS.md+++ b/findfamily/AGENTS.md@@ -21,7 +21,7 @@ WebSocket relay host: `wss://api.maproj.org/api/ws` (Cloudflare FIRST_PARTY pins - Live battery, speed, and dwell-time per person; UWB precision ranging where hardware supports it - Powered-off finding (BLE beacons) and a Quick Settings tile to stop sharing instantly **Architecture / data-flow:** Single `MainPage` UI + `platform/FindFamilyViewModel` over `data/FindFamilyRepository` (Room: users, waypoints, links, no-show alerts); live location flows through `util/LocationTracking*` foreground service + `tracker/` BLE protocol and `uwb/` ranging, relayed E2EE via `:library:e2ee-p2p` (`util/Networking*`). `onCreateBeforeContent`: parse the add-invite deep link, then `NetworkClient.init(FIRST_PARTY)`.-**Entry points + reading order:** `Route` (`MainPage` / `PersonSheet` / `WaypointSheet` / `FirstRunSheet` / `AddPersonDialog` / `AddLinkDialog` / `AddTrackerDialog` / `MissingFeaturesDialog` / `NoShowAlertDialog` / `PermissionUpgradeDialog` / `UwbRangingPage`) → `Navigation.kt` → `ui/MainPage.kt` → `platform/FindFamilyViewModel.kt` → `data/FindFamilyRepository.kt`. Dialogs are routes: screens push `Route.…Dialog` and the entry renders the stateless `…Content` under `ui/dialogs/` unconditionally (all `DialogPage()`); `PersonDetailSheet` only requests the no-show dialog via its `onShowNoShowAlert` callback. Person/waypoint selection is also route-driven but is not a dialog: `PersonSheet` / `WaypointSheet` entries render `MainPage`, whose bottom panel (phone `BottomSheetScaffold` sheet, expanded side panel) swaps from the family list to that route's person/waypoint content, so the map stays reachable to move a saved place by dragging it; back returns the panel to the family list. Every route has a deterministic capture in `src/screenshotTest` (`MetadataPreviews`, `<n>-<route-kebab>`).+**Entry points + reading order:** `Route` (`MainPage` / `PersonSheet` / `WaypointSheet` / `PersonHistory` / `FirstRunSheet` / `AddPersonDialog` / `AddLinkDialog` / `AddTrackerDialog` / `MissingFeaturesDialog` / `NoShowAlertDialog` / `PermissionUpgradeDialog` / `UwbRangingPage`) → `Navigation.kt` → `ui/MainPage.kt` → `platform/FindFamilyViewModel.kt` → `data/FindFamilyRepository.kt`. Dialogs are routes: screens push `Route.…Dialog` and the entry renders the stateless `…Content` under `ui/dialogs/` unconditionally (all `DialogPage()`); `PersonDetailSheet` only requests the no-show dialog via its `onShowNoShowAlert` callback. Person/waypoint selection is also route-driven but is not a dialog: `PersonSheet` / `WaypointSheet` entries render `MainPage`, whose bottom panel (phone sheet in the repo's `FreeHeightBottomSheetScaffold`, expanded side panel) swaps from the family list to that route's person/waypoint content, so the map stays reachable to move a saved place by dragging it; back returns the panel to the family list. History is not a panel mode: `Route.PersonHistory` is a separate full screen with its own map and the history scrubber, pushed by the map's history FAB and popped by back to the live map page. Every route has a deterministic capture in `src/screenshotTest` (`MetadataPreviews`, `<n>-<route-kebab>`). **Gotchas:** - Location permission spec must request fine AND coarse together (Android 12+ Precise/Approximate choice; fine alone is ignored), plus background location and `BLUETOOTH_SCAN` — the powered-off-finder scanner starts then dies without it - `singleTop` warm-start invites/UWB taps arrive via `onNewIntent`, not a fresh `onCreate`@@ -73,8 +73,8 @@ location sharing never starts there. ## Key files ### Root — entry + navigation - com/vayunmathur/findfamily/MainActivity.kt — deep-link parsing, permission spec, permission-upgrade trigger-- com/vayunmathur/findfamily/Route.kt — sealed `Route` destinations (bottom-panel person/waypoint routes + dialog routes + UWB screen)-- com/vayunmathur/findfamily/Navigation.kt — `MainNavigation` entries for every route; `PersonSheet`/`WaypointSheet` render `MainPage` (bottom-panel host), the `…Dialog` routes use `DialogPage()`+- com/vayunmathur/findfamily/Route.kt — sealed `Route` destinations (bottom-panel person/waypoint routes + full-screen history and UWB screens + dialog routes)+- com/vayunmathur/findfamily/Navigation.kt — `MainNavigation` entries for every route; `PersonSheet`/`WaypointSheet` render `MainPage` (bottom-panel host), `PersonHistory` renders `PersonHistoryPage`, the `…Dialog` routes use `DialogPage()` ### data/ — Room entities + repository - com/vayunmathur/findfamily/data/FindFamilyRepository.kt - com/vayunmathur/findfamily/data/FFDatabase.kt@@ -148,11 +148,13 @@ location sharing never starts there. - com/vayunmathur/findfamily/ui/MainMapSlot.kt - com/vayunmathur/findfamily/ui/MainSheetContent.kt - com/vayunmathur/findfamily/ui/MapView.kt-- com/vayunmathur/findfamily/ui/MainFabOverlay.kt — history FAB over the map (selected person, present mode only; enters history mode)+- com/vayunmathur/findfamily/ui/MainFabOverlay.kt — history FAB over the map (selected person only; pushes `Route.PersonHistory`; the history screen itself shows no FAB) - com/vayunmathur/findfamily/ui/MainPageOverlays.kt — transparent `TopAppBarOverlay` over the map: back button for a selection plus the Find Nearby action for a selected non-self UWB person and the GPS warning - com/vayunmathur/findfamily/ui/FamilyListSheet.kt - com/vayunmathur/findfamily/ui/PersonDetailSheet.kt-- com/vayunmathur/findfamily/ui/PersonSheet.kt — bottom-panel person content for `Route.PersonSheet` (detail + history scrubber in history mode), hosted by `MainPage`'s panel, not a dialog; Find Nearby is an action in the map's transparent top bar and entering history is the history FAB over the map+- com/vayunmathur/findfamily/ui/PersonSheet.kt — bottom-panel person detail content for `Route.PersonSheet`, hosted by `MainPage`'s panel, not a dialog; Find Nearby is an action in the map's transparent top bar and entering history is the history FAB over the map+- com/vayunmathur/findfamily/ui/PersonHistoryPage.kt — full-screen history for `Route.PersonHistory`: its own pannable map centred on the scrubbed position plus the history scrubber; back pops to the live map+- com/vayunmathur/findfamily/ui/PersonHistoryContent.kt — stateless history page layout (scaffold + map/scrubber slots) for previews - com/vayunmathur/findfamily/ui/WaypointSheet.kt — bottom-panel saved-place editor for `Route.WaypointSheet` (name/range/delete; place moves with the map centre), hosted by `MainPage`'s panel, not a dialog - com/vayunmathur/findfamily/ui/UserCard.kt - com/vayunmathur/findfamily/ui/UserPicture.kt — face icons via `peopleFaceRequest`: stable SHA-256 memory+disk cache keys and explicit decode size through `:library:image`, so scrolling the people list does not refetch/re-decode faces
findfamily/src/main/java/com/vayunmathur/findfamily/Navigation.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/Navigation.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/Navigation.ktindex 233ea88a15..d4fd88b05a 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/Navigation.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/Navigation.kt@@ -8,6 +8,7 @@ import com.vayunmathur.findfamily.platform.FindFamilyViewModel import com.vayunmathur.findfamily.platform.Platform import com.vayunmathur.findfamily.ui.FirstRunSheet import com.vayunmathur.findfamily.ui.MainPage+import com.vayunmathur.findfamily.ui.PersonHistoryPage import com.vayunmathur.findfamily.ui.UwbRangingScreen import com.vayunmathur.findfamily.ui.dialogs.AddLinkDialog import com.vayunmathur.findfamily.ui.dialogs.AddPersonDialog@@ -109,6 +110,12 @@ fun Navigation( entry<Route.WaypointSheet>(metadata = SiblingPage()) { MainPage(platform, backStack, ffViewModel) }+ // History is a separate full screen with its own map, not a mode of+ // the map page: it pushes like any other screen and back pops to the+ // live map underneath.+ entry<Route.PersonHistory> {+ PersonHistoryPage(backStack, ffViewModel, it.userId)+ } entry<Route.UserPageHistoryDatePicker>(metadata = DialogPage()) { DatePickerDialog( backStack,
findfamily/src/main/java/com/vayunmathur/findfamily/Route.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/Route.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/Route.ktindex c86a3b0d84..a8bc609d86 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/Route.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/Route.kt@@ -23,6 +23,10 @@ sealed interface Route: NavKey { /** Waypoint (0 = create a new one) for the map page's bottom panel: swaps the panel to the saved-place editor while the map stays reachable to move the place; back returns it to the family list. Not a dialog. */ data class WaypointSheet(val waypointId: Long): Route + @Serializable+ /** Full-screen location history for one person: its own map centred on the scrubbed historical position, with the history scrubber. A real screen (not a mode of the map page); back pops to the live map page. */+ data class PersonHistory(val userId: Long): Route+ @Serializable /** Dialog for picking the date whose location history to show. */ data class UserPageHistoryDatePicker(val initialDate: LocalDate): Route
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 3d56153b41..88d2074301 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FindFamilyUiContract.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FindFamilyUiContract.kt@@ -125,8 +125,6 @@ data class MainPageUiState( val selectedWaypointId: Long? = null, /** True when Find Nearby (UWB) can be offered for the selected person. */ val canFindNearby: Boolean = false,- /** False while the selected person's history is being viewed. */- val isShowingPresent: Boolean = true, ) { /** True when the bottom panel shows the family list. */ val nothingSelected: Boolean@@ -137,8 +135,9 @@ data class MainPageUiState( * Map-overlay and FAB callbacks for the map page. Same no-op-default arrangement as the sheet * action interfaces so [Noop] is all a preview needs. The stateful `MainPage` wires these to * the ViewModel and nav back stack. The transparent top bar carries back- * navigation and Find Nearby for a selected person; the FAB enters that- * person's history. Add-person/place/link creation is not on this page's FAB.+ * navigation and Find Nearby for a selected person; the FAB opens that+ * person's history screen (`Route.PersonHistory`). Add-person/place/link+ * creation is not on this page's FAB. */ interface MainPageActions { fun onGpsWarningClick() {}
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 48e10c0973..c6ddeca1f1 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FindFamilyViewModel.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/platform/FindFamilyViewModel.kt@@ -220,14 +220,14 @@ class FindFamilyViewModel( // ------------------------------------------------------------------ /**- * Present-vs-history, the historical position, and the waypoint editing- * form. Lives in [MapPageState] so this class stays under the function- * cap; the StateFlows below are the same observables as before. Selection- * itself is not here — it is the top of the navigation back stack.+ * The historical position (for the `Route.PersonHistory` screen) and the+ * waypoint editing form. Lives in [MapPageState] so this class stays+ * under the function cap; the StateFlow below is the same observable as+ * before. Selection itself is not here — it is the top of the navigation+ * back stack, and history is a screen on that stack, not a mode here. */ val mapState = MapPageState(viewModelScope, repository) - val isShowingPresent: StateFlow<Boolean> = mapState.isShowingPresent val historicalPosition: StateFlow<GeoPoint?> = mapState.historicalPosition val waypointName: StateFlow<String> = mapState.waypointName
findfamily/src/main/java/com/vayunmathur/findfamily/platform/MapPageState.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/platform/MapPageState.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/platform/MapPageState.ktindex b86a10e0f5..27d8e56eab 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/platform/MapPageState.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/platform/MapPageState.kt@@ -15,21 +15,19 @@ import kotlinx.coroutines.launch * Map-page UI state extracted from [FindFamilyViewModel] so the ViewModel * stays under the function cap. *- * Owns present-vs-history display, the historical position, and the waypoint- * editing form (name / range / coordinate, persisted through [repository] on- * [scope]). Which person/place is selected is NOT held here: selection lives- * in the navigation back stack (`Route.PersonSheet` / `Route.WaypointSheet`),- * and call sites receive the selected id from the route. Only- * [saveCurrentWaypoint] launches.+ * Owns the historical position shown by the `Route.PersonHistory` screen+ * and the waypoint editing form (name / range / coordinate, persisted+ * through [repository] on [scope]). Which person/place is selected is NOT+ * held here: selection lives in the navigation back stack+ * (`Route.PersonSheet` / `Route.WaypointSheet`), history is its own route+ * on that stack, and call sites receive the selected id from the route.+ * Only [saveCurrentWaypoint] launches. */ class MapPageState( private val scope: CoroutineScope, private val repository: FindFamilyRepository, ) { - private val _isShowingPresent = MutableStateFlow(true)- val isShowingPresent: StateFlow<Boolean> = _isShowingPresent.asStateFlow()- private val _historicalPosition = MutableStateFlow<GeoPoint?>(null) val historicalPosition: StateFlow<GeoPoint?> = _historicalPosition.asStateFlow() @@ -42,24 +40,18 @@ class MapPageState( private val _waypointCoord = MutableStateFlow(Coord(0.0, 0.0)) val waypointCoord: StateFlow<Coord> = _waypointCoord.asStateFlow() - fun setShowingPresent(value: Boolean) {- _isShowingPresent.value = value- // Leaving history drops the historical pin with it, so it cannot linger as a- // ghost marker or a stale camera target once live tracking resumes.- if (value) _historicalPosition.value = null- } fun setHistoricalPosition(position: GeoPoint?) { _historicalPosition.value = position } fun setWaypointName(name: String) { _waypointName.value = name } fun setWaypointRange(range: String) { _waypointRange.value = range } fun setWaypointCoord(coord: Coord) { _waypointCoord.value = coord } /**- * Reset history state for a newly opened person sheet. Called when a- * `Route.PersonSheet` is pushed: the newly selected person starts in- * present mode with no historical pin of their own (GitHub #818).+ * Drop any historical pin. Called when the history screen for a person+ * is opened (so a pin scrubbed for someone else, or on an earlier+ * visit, never masquerades as this person's) and when a person sheet+ * is opened on the live map. */- fun onPersonOpened() {- _isShowingPresent.value = true+ fun clearHistoricalPosition() { _historicalPosition.value = null }
findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainFabOverlay.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainFabOverlay.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainFabOverlay.ktindex 210dea76da..58b04ee99d 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainFabOverlay.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainFabOverlay.kt@@ -19,10 +19,10 @@ import com.vayunmathur.library.ui.IconHistory import com.vayunmathur.library.ui.MaterialTheme /**- * History FAB over the map. It replaces the former add (plus) FAB menu:- * with a person selected in present mode it enters that person's history- * (the scrubber then renders in the bottom panel). With no person- * selected, or already in history mode, no FAB is shown.+ * History FAB over the map. With a person selected it opens that person's+ * history screen (`Route.PersonHistory`). With no person selected no FAB+ * is shown; the history screen itself hosts no FAB, so there is no+ * history action while already viewing history. */ @Composable internal fun BoxScope.MainFabOverlay(@@ -35,7 +35,7 @@ internal fun BoxScope.MainFabOverlay( lightScheme: ColorScheme, inPreview: Boolean, ) {- if (state.selectedUserId == null || !state.isShowingPresent) return+ if (state.selectedUserId == null) return // FAB floats just above the sheet peek, lifting as the sheet expands. // Wrapped in the light scheme so it reads correctly over the light map. Box(
findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainMapSlot.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainMapSlot.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainMapSlot.ktindex dcff775f2f..75ad09349b 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainMapSlot.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainMapSlot.kt@@ -156,15 +156,13 @@ internal fun MainMapSlot( camera: CameraState, selectedUserId: Long?, selectedUser: User?,- isShowingPresent: Boolean,- historicalPosition: GeoPoint?, selectedWaypointId: Long?, waypointRange: String, onUserClick: (Long) -> Unit, onMapClick: () -> Unit, ) { val selectedUserObj = if (selectedUserId != null) {- selectedUser?.let { SelectedUser(it, isShowingPresent, historicalPosition) }+ selectedUser?.let { SelectedUser(it) } } else null val selectedWaypointObj = if (selectedWaypointId != null) {
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 0c424bd2f9..a2823224a1 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPage.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPage.kt@@ -175,22 +175,11 @@ fun MainPage( val topRoute = backStack.backStack.lastOrNull() val selectedUserId = (topRoute as? Route.PersonSheet)?.userId val selectedWaypointId = (topRoute as? Route.WaypointSheet)?.waypointId- val isShowingPresent by ffViewModel.isShowingPresent.collectAsState()- val historicalPosition by ffViewModel.historicalPosition.collectAsState() var showGpsWarning by remember { mutableStateOf(false) } val usingGpsFallback by ffViewModel.usingGpsFallback.collectAsState() val waypointRange by ffViewModel.waypointRange.collectAsState() - // History mode = a contact is selected and we're viewing their past track.- val historyMode = selectedUserId != null && !isShowingPresent-- // Back from history returns to the person's present location; back- // anywhere else pops the sheet destination off the stack (NavDisplay).- BackHandler(selectedUserId != null && historyMode) {- ffViewModel.mapState.setShowingPresent(true)- }- val temporaryLinks by ffViewModel.temporaryLinks.collectAsState() val waypoints by ffViewModel.waypoints.collectAsState() val globalSharingEnabled by ffViewModel.globalSharingEnabled.collectAsState()@@ -222,7 +211,6 @@ fun MainPage( selectedWaypointId = selectedWaypointId, canFindNearby = selectedUserId != null && selectedUserId != Networking.userid && UwbSessionManager.isAvailable(context),- isShowingPresent = isShowingPresent, familyList = FamilyListUiState( connectedUsers = connectedUsers, awaitingRequestUsers = awaitingRequestUsers,@@ -269,12 +257,10 @@ fun MainPage( camera = camera, selectedUserId = selectedUserId, selectedUser = selectedUser,- isShowingPresent = isShowingPresent,- historicalPosition = historicalPosition, selectedWaypointId = selectedWaypointId, waypointRange = waypointRange, onUserClick = { userId ->- ffViewModel.mapState.onPersonOpened()+ ffViewModel.mapState.clearHistoricalPosition() backStack.pushOrReplace(Route.PersonSheet(userId)) { it is Route.PersonSheet || it is Route.WaypointSheet }@@ -295,8 +281,6 @@ fun MainPage( camera = camera, selectedUserId = selectedUserId, selfUserId = Networking.userid,- isShowingPresent = isShowingPresent,- historicalPosition = historicalPosition, userPositions = userPositions, selectedWaypointId = selectedWaypointId, waypoints = waypoints,
findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPageActions.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPageActions.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPageActions.ktindex de36f6a007..29aa395835 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPageActions.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPageActions.kt@@ -164,7 +164,7 @@ internal fun rememberMainPageActions( val familyActions = remember(ffViewModel, backStack, platform) { object : FamilyListActions by ffViewModel { override fun selectUser(userId: Long) {- ffViewModel.mapState.onPersonOpened()+ ffViewModel.mapState.clearHistoricalPosition() backStack.pushOrReplace(Route.PersonSheet(userId)) { it is Route.PersonSheet || it is Route.WaypointSheet }@@ -201,7 +201,10 @@ internal fun rememberMainPageActions( val userId = (backStack.backStack.lastOrNull() as? Route.PersonSheet)?.userId ?: return backStack.add(Route.UwbRangingPage(userId)) }- override fun showHistory() { ffViewModel.mapState.setShowingPresent(false) }+ override fun showHistory() {+ val userId = (backStack.backStack.lastOrNull() as? Route.PersonSheet)?.userId ?: return+ backStack.add(Route.PersonHistory(userId))+ } } return Pair(familyActions, mainActions) }
findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPageEffects.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPageEffects.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPageEffects.ktindex 5935df6314..8cca7c46cd 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPageEffects.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPageEffects.kt@@ -155,8 +155,6 @@ internal fun MainPageEffects( camera: CameraState, selectedUserId: Long?, selfUserId: Long,- isShowingPresent: Boolean,- historicalPosition: GeoPoint?, userPositions: Map<Long, LocationValue>, selectedWaypointId: Long?, waypoints: List<Waypoint>,@@ -190,14 +188,11 @@ internal fun MainPageEffects( ) } - // Map animation logic- LaunchedEffect(selectedUserId, isShowingPresent, historicalPosition) {+ // The live map always shows the present: selecting a person centres on+ // their latest fix. Historical positions belong to the history screen.+ LaunchedEffect(selectedUserId) { if (selectedUserId != null) {- val targetPosition = if (isShowingPresent) {- userPositions[selectedUserId]?.coord?.toGeoPoint()- } else {- historicalPosition- }+ val targetPosition = userPositions[selectedUserId]?.coord?.toGeoPoint() targetPosition?.let { camera.animateTo( camera.position.copy(
findfamily/src/main/java/com/vayunmathur/findfamily/ui/MapView.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MapView.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MapView.ktindex ad2e572009..b73fa07aea 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MapView.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MapView.kt@@ -57,8 +57,8 @@ import kotlin.io.encoding.Base64 import kotlin.math.abs import kotlin.math.cos -/** Person selected on the map, with whether the present or a historical position is shown. */-data class SelectedUser(val user: User, val isShowingPresent: Boolean, val historicalPosition: GeoPoint?)+/** Person selected on the live map. */+data class SelectedUser(val user: User) /** Waypoint selected on the map, with its range and move callback. */ data class SelectedWaypoint(val waypoint: Waypoint, val range: Double, val onMoveWaypoint: (Coord) -> Unit) @@ -162,20 +162,11 @@ fun MapView( if (selectedUser != null && user.id != selectedUser.user.id) continue val position = userPositions[user.id]?.coord?.toGeoPoint() ?: continue MapMarker(position) {- UserPicture(- user,- 70.dp,- selectedUser != null && !selectedUser.isShowingPresent- ) {+ UserPicture(user, 70.dp) { onUserClick(user.id) } } }- if (selectedUser != null && !selectedUser.isShowingPresent && selectedUser.historicalPosition != null) {- MapMarker(selectedUser.historicalPosition) {- UserPicture(selectedUser.user, 70.dp)- }- } } } }
findfamily/src/main/java/com/vayunmathur/findfamily/ui/PersonHistoryContent.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/PersonHistoryContent.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/PersonHistoryContent.ktnew file mode 100644index 0000000000..52d617db56--- /dev/null+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/PersonHistoryContent.kt@@ -0,0 +1,39 @@+package com.vayunmathur.findfamily.ui++import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.BoxScope+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.padding+import androidx.compose.runtime.Composable+import androidx.compose.ui.Modifier+import androidx.compose.ui.res.stringResource+import com.vayunmathur.findfamily.R+import com.vayunmathur.library.ui.AppScaffold+import com.vayunmathur.library.ui.ExperimentalMaterial3Api++/**+ * Stateless history screen: a full-screen map with the history scrubber+ * floating at its bottom, inside an [AppScaffold] whose back button pops+ * to the live map page. The map and scrubber are slots so the store+ * listing preview can render the page without the tile renderer or the+ * location-history flow. No history FAB is hosted here — this is the+ * history screen itself.+ */+@OptIn(ExperimentalMaterial3Api::class)+@Composable+fun PersonHistoryContent(+ userName: String,+ onBack: () -> Unit,+ map: @Composable () -> Unit,+ scrubber: @Composable BoxScope.() -> Unit,+) {+ AppScaffold(+ title = stringResource(R.string.history_title, userName),+ onNavigateBack = onBack,+ ) { padding ->+ Box(Modifier.fillMaxSize().padding(padding)) {+ map()+ scrubber()+ }+ }+}
findfamily/src/main/java/com/vayunmathur/findfamily/ui/PersonHistoryPage.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/PersonHistoryPage.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/PersonHistoryPage.ktnew file mode 100644index 0000000000..d5ee35f84c--- /dev/null+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/PersonHistoryPage.kt@@ -0,0 +1,85 @@+package com.vayunmathur.findfamily.ui++import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.ui.unit.dp+import com.vayunmathur.findfamily.Route+import com.vayunmathur.findfamily.data.toGeoPoint+import com.vayunmathur.findfamily.platform.FindFamilyViewModel+import com.vayunmathur.library.map.CameraPosition+import com.vayunmathur.library.map.GestureOptions+import com.vayunmathur.library.map.MapOptions+import com.vayunmathur.library.map.VectorMap+import com.vayunmathur.library.map.rememberCameraState+import com.vayunmathur.library.util.ConnectivityMonitor+import com.vayunmathur.library.util.NavBackStack++/**+ * Full-screen location history for one person (`Route.PersonHistory`).+ *+ * A real screen on the navigation stack, not a mode of the map page: it+ * owns its own camera and map, centred on the position the scrubber+ * selects, and back pops to the live map page underneath (which always+ * shows the present, so returning needs no present-restoring step).+ * Entering the screen drops any historical pin left over from an+ * earlier visit or another person.+ */+@Composable+fun PersonHistoryPage(+ backStack: NavBackStack<Route>,+ ffViewModel: FindFamilyViewModel,+ userId: Long,+) {+ LaunchedEffect(userId) { ffViewModel.mapState.clearHistoricalPosition() }++ val users by ffViewModel.users.collectAsState()+ val user = users.firstOrNull { it.id == userId }+ val userPositions by ffViewModel.latestLocationByUser.collectAsState()+ val historicalPosition by ffViewModel.historicalPosition.collectAsState()++ val camera = rememberCameraState()+ // Open centred on the person's latest fix; scrubbing then moves the+ // camera to each historical position as it is selected.+ val latestPosition = userPositions[userId]?.coord?.toGeoPoint()+ LaunchedEffect(latestPosition) {+ if (latestPosition != null && historicalPosition == null &&+ camera.position.target.longitude == 0.0 && camera.position.target.latitude == 0.0+ ) {+ camera.animateTo(camera.position.copy(target = latestPosition, zoom = 15.0))+ }+ }+ LaunchedEffect(historicalPosition) {+ historicalPosition?.let {+ camera.animateTo(camera.position.copy(target = it, zoom = 15.0))+ }+ }++ PersonHistoryContent(+ userName = user?.name ?: "",+ onBack = { backStack.pop() },+ map = {+ VectorMap(+ cameraState = camera,+ zoomRange = 0f..20f,+ options = MapOptions(gestureOptions = GestureOptions.TiltLocked),+ online = ConnectivityMonitor.isOnline,+ ) {+ val hist = historicalPosition+ if (user != null && hist != null) {+ MapMarker(hist) {+ UserPicture(user, 70.dp)+ }+ }+ }+ },+ scrubber = {+ if (user != null) {+ HistoryScrubber(backStack, ffViewModel, userId) {+ ffViewModel.mapState.setHistoricalPosition(it)+ }+ }+ },+ )+}
findfamily/src/main/java/com/vayunmathur/findfamily/ui/PersonSheet.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/PersonSheet.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/PersonSheet.ktindex 5a3447abaf..94dc817821 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/PersonSheet.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/PersonSheet.kt@@ -1,10 +1,8 @@ package com.vayunmathur.findfamily.ui import androidx.compose.foundation.layout.Arrangement-import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row-import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect@@ -23,9 +21,6 @@ import com.vayunmathur.findfamily.platform.PersonActions import com.vayunmathur.findfamily.platform.PersonUiState import com.vayunmathur.findfamily.platform.Platform import com.vayunmathur.findfamily.platform.UwbSessionManager-import com.vayunmathur.library.ui.IconRestore-import com.vayunmathur.library.ui.MaterialTheme-import com.vayunmathur.library.ui.OutlinedButton import com.vayunmathur.library.ui.Text import com.vayunmathur.library.util.NavBackStack @@ -36,9 +31,8 @@ import com.vayunmathur.library.util.NavBackStack * back returns the panel to the family list. It is not a dialog. * * Hosts the person detail sheet. Find Nearby lives in the map's- * transparent top bar and entering history on the history FAB; the- * scrubber renders here in history mode (the map behind the panel- * keeps showing the historical pin for [userId]).+ * transparent top bar and entering history on the history FAB, which+ * opens the separate `Route.PersonHistory` screen. */ @Composable fun PersonSheet(@@ -48,7 +42,7 @@ fun PersonSheet( userId: Long, ) { // A pushed person starts in present mode with no stale historical pin.- LaunchedEffect(userId) { ffViewModel.mapState.onPersonOpened() }+ LaunchedEffect(userId) { ffViewModel.mapState.clearHistoricalPosition() } val users by ffViewModel.users.collectAsState() val user = users.firstOrNull { it.id == userId }@@ -57,8 +51,6 @@ fun PersonSheet( val globalSharingEnabled by ffViewModel.globalSharingEnabled.collectAsState() val crowdFindingEnabled by ffViewModel.crowdFindingEnabled.collectAsState() val connectedUsers by ffViewModel.connectedUsers.collectAsState()- val isShowingPresent by ffViewModel.isShowingPresent.collectAsState()- val historyMode = !isShowingPresent val requestPickContact = platform.requestPickContact { name, photo -> ffViewModel.updateContactNamePhoto(userId, name, photo)@@ -110,23 +102,6 @@ fun PersonSheet( if (user == null) { // Row deleted (or not yet loaded): nothing to show. Text(stringResource(R.string.delete_person_content_description))- } else if (historyMode) {- Text(- stringResource(R.string.history_title, user.name),- style = MaterialTheme.typography.titleMedium,- )- Box(Modifier.fillMaxWidth()) {- HistoryScrubber(backStack, ffViewModel, userId) {- ffViewModel.mapState.setHistoricalPosition(it)- }- }- OutlinedButton(- { ffViewModel.mapState.setShowingPresent(true) },- Modifier.fillMaxWidth(),- ) {- IconRestore()- Text(stringResource(R.string.history_title, user.name))- } } else { PersonDetailSheet( PersonUiState(
findfamily/src/screenshotTest/kotlin/com/vayunmathur/findfamily/ui/MetadataPreviews.kt
diff --git a/findfamily/src/screenshotTest/kotlin/com/vayunmathur/findfamily/ui/MetadataPreviews.kt b/findfamily/src/screenshotTest/kotlin/com/vayunmathur/findfamily/ui/MetadataPreviews.ktindex 18c2473cb5..61edaa0381 100644--- a/findfamily/src/screenshotTest/kotlin/com/vayunmathur/findfamily/ui/MetadataPreviews.kt+++ b/findfamily/src/screenshotTest/kotlin/com/vayunmathur/findfamily/ui/MetadataPreviews.kt@@ -33,6 +33,9 @@ import com.vayunmathur.findfamily.platform.PersonUiState import com.vayunmathur.findfamily.platform.UwbSessionManager import com.vayunmathur.findfamily.platform.RangingSample import com.vayunmathur.library.ui.DynamicTheme+import com.vayunmathur.library.ui.HistoryScrubberCard+import com.vayunmathur.library.ui.HistoryStep+import com.vayunmathur.library.ui.rememberHistoryScrubberState import androidx.compose.runtime.CompositionLocalProvider import com.vayunmathur.findfamily.Route import com.vayunmathur.findfamily.domain.FirstRunStage@@ -223,7 +226,6 @@ class MetadataPreviews { familyList = sampleFamilyList(), selectedUserId = maya.id, canFindNearby = true,- isShowingPresent = true, ), familyActions = FamilyListActions.Noop, actions = MainPageActions.Noop,@@ -401,6 +403,41 @@ class MetadataPreviews { } } + @PreviewTest+ @Preview(name = "12-person-history-page", device = PHONE, group = "phone", showSystemUi = true)+ @Composable+ fun Preview12PersonHistory() {+ DynamicTheme(darkTheme = true) {+ // Route.PersonHistory is a full screen with its own map: preview+ // the real page layout over the static backdrop, with a scrubber+ // frozen at the fixture instant.+ PersonHistoryContent(+ userName = maya.name,+ onBack = {},+ map = { StaticMapBackdrop() },+ scrubber = {+ val state = rememberHistoryScrubberState(+ initialInstant = now,+ initialNowMode = false,+ disallowFuture = true,+ )+ HistoryScrubberCard(+ state = state,+ steps = listOf(+ HistoryStep("-5m", -300L),+ HistoryStep("-1m", -60L),+ HistoryStep("-10s", -10L),+ HistoryStep("+10s", 10L),+ HistoryStep("+1m", 60L),+ HistoryStep("+5m", 300L),+ ),+ onDateChipClick = {},+ )+ },+ )+ }+ }+ @PreviewTest @Preview(name = "13-no-show-alert-dialog", device = PHONE, group = "phone", showSystemUi = true) @Composable
findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageActionsRealRepoTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageActionsRealRepoTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageActionsRealRepoTest.ktindex e388f02f8a..1bfceb966d 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageActionsRealRepoTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageActionsRealRepoTest.kt@@ -113,16 +113,19 @@ class MainPageActionsRealRepoTest { main.findNearby() assertEquals(Route.UwbRangingPage(aliceId), stack.last()) stack.pop()+ // The history FAB is navigation: it pushes the history screen for+ // the selected person, and back returns through the person sheet. main.showHistory()- assertEquals(false, vm.isShowingPresent.value)- vm.mapState.setShowingPresent(true)+ assertEquals(Route.PersonHistory(aliceId), stack.last())+ stack.pop()+ assertEquals(Route.PersonSheet(aliceId), stack.last()) main.onNavigateBack() assertEquals(Route.MainPage, stack.last())- // History present/history toggling is MapPageState, driven by the sheet.- vm.mapState.setShowingPresent(false)- assertEquals(false, vm.isShowingPresent.value)- vm.mapState.onPersonOpened()- assertEquals(true, vm.isShowingPresent.value)+ // The historical pin is MapPageState, set by the history screen.+ vm.mapState.setHistoricalPosition(com.vayunmathur.library.map.GeoPoint(1.0, 2.0))+ assertEquals(com.vayunmathur.library.map.GeoPoint(1.0, 2.0), vm.historicalPosition.value)+ vm.mapState.clearHistoricalPosition()+ assertEquals(null, vm.historicalPosition.value) // Deletes remove the rows (sheet destinations pop themselves after). vm.deleteWaypoint(repo.waypointStore.get(wpId)) vm.deleteUser(alice)
findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageChromeRealRepoTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageChromeRealRepoTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageChromeRealRepoTest.ktindex f9715bec0e..9b216b1589 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageChromeRealRepoTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageChromeRealRepoTest.kt@@ -147,8 +147,8 @@ class MainPageChromeRealRepoTest { val camera = rememberCameraState() MainPageEffects( camera = camera, selectedUserId = alice,- selfUserId = Networking.userid, isShowingPresent = true,- historicalPosition = null, userPositions = emptyMap(),+ selfUserId = Networking.userid,+ userPositions = emptyMap(), selectedWaypointId = null, waypoints = emptyList(), showGpsWarning = gps, onShowGpsWarning = { gps = it }, )
findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageNavigationRealRepoTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageNavigationRealRepoTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageNavigationRealRepoTest.ktindex 8f35ef4f5c..cbb507c925 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageNavigationRealRepoTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/MainPageNavigationRealRepoTest.kt@@ -221,13 +221,12 @@ class MainPageNavigationRealRepoTest { assertTrue(rule.onAllNodesWithText("Home", substring = true).fetchSemanticsNodes().isNotEmpty()) } - @Test fun personSheetInHistoryModeShowsScrubber() = runBlocking {+ @Test fun personHistoryPageShowsScrubber() = runBlocking { seedFamily() val alice = repo.getAllUsers().first { it.name == "Alice" }- // PersonSheet resets to present on open; enter history explicitly.- rule.setContent { androidx.compose.runtime.CompositionLocalProvider(com.vayunmathur.library.util.LocalNavResultRegistry provides com.vayunmathur.library.util.NavResultRegistry()) { DynamicTheme { PersonSheet(stack(), vm, Platform(app), alice.id) } } }- rule.waitForIdle()- vm.mapState.setShowingPresent(false)+ // History is its own screen: it renders the person's title and the+ // scrubber over its own map, with no person-sheet state involved.+ rule.setContent { androidx.compose.runtime.CompositionLocalProvider(com.vayunmathur.library.util.LocalNavResultRegistry provides com.vayunmathur.library.util.NavResultRegistry()) { DynamicTheme { PersonHistoryPage(stack(), vm, alice.id) } } } rule.waitForIdle() assertTrue(rule.onAllNodesWithText("Alice", substring = true).fetchSemanticsNodes().isNotEmpty()) }
findfamily/src/test/java/com/vayunmathur/findfamily/ui/OverlayBarsTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/OverlayBarsTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/OverlayBarsTest.ktindex fa82eee896..f1e8389744 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/ui/OverlayBarsTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/ui/OverlayBarsTest.kt@@ -51,7 +51,7 @@ class OverlayBarsTest { @Test fun fabOverlayPersonSelected() { rule.setContent { Box(Modifier.fillMaxSize()) {- MainFabOverlay(MainPageUiState(selectedUserId = 1L, isShowingPresent = true), MainPageActions.Noop, 80.dp, { 0 },+ MainFabOverlay(MainPageUiState(selectedUserId = 1L), MainPageActions.Noop, 80.dp, { 0 }, MaterialTheme.colorScheme.primaryContainer, MaterialTheme.colorScheme.onPrimaryContainer, lightColorScheme(), inPreview = true) }
findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelDbTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelDbTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelDbTest.ktindex b3533385c8..6ece02ad3c 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelDbTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelDbTest.kt@@ -110,10 +110,9 @@ class FindFamilyViewModelDbTest { assertEquals(alice, kotlinx.coroutines.runBlocking { repo.latestLocationByUser.first().keys.firstOrNull() }) // History is keyed by the person-sheet route arg, passed explicitly. awaitTrue("location history") { kotlinx.coroutines.runBlocking { vm.locationHistory(alice).first().size == 1 } }- vm.mapState.setShowingPresent(false)- assertEquals(false, vm.isShowingPresent.value)- vm.mapState.onPersonOpened()- assertEquals(true, vm.isShowingPresent.value)+ vm.mapState.setHistoricalPosition(com.vayunmathur.library.map.GeoPoint(1.0, 2.0))+ vm.mapState.clearHistoricalPosition()+ assertEquals(null, vm.historicalPosition.value) collectJob.cancel() } @@ -168,11 +167,9 @@ class FindFamilyViewModelDbTest { vm.mapState.setWaypointCoord(Coord(5.0, 6.0)) assertTrue(vm.mapState.saveCurrentWaypoint(0L)) awaitTrue("waypoint created") { kotlinx.coroutines.runBlocking { repo.waypointStore.getAll().any { it.name == "Park" } } }- // Opening a person sheet resets history mode and drops any stale pin.- vm.mapState.setShowingPresent(false)+ // Opening a person sheet drops any stale historical pin. vm.mapState.setHistoricalPosition(com.vayunmathur.library.map.GeoPoint(1.0, 2.0))- vm.mapState.onPersonOpened()- assertEquals(true, vm.isShowingPresent.value)+ vm.mapState.clearHistoricalPosition() assertEquals(null, vm.historicalPosition.value) vm.refreshPermissions() // Permission flags must be readable (values depend on Robolectric grants).
findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelProbeTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelProbeTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelProbeTest.ktindex 706db110a7..2735649615 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelProbeTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelProbeTest.kt@@ -55,9 +55,9 @@ class FindFamilyViewModelProbeTest { @Test fun personOpenedAndWaypointFormDelegateToMapState() { // Selection lives in the back stack now; the VM only resets history // state when a person sheet opens and prefills the waypoint form.- vm.mapState.setShowingPresent(false)- vm.mapState.onPersonOpened()- assertTrue(vm.isShowingPresent.value)+ vm.mapState.setHistoricalPosition(com.vayunmathur.library.map.GeoPoint(1.0, 2.0))+ vm.mapState.clearHistoricalPosition()+ assertTrue(vm.historicalPosition.value == null) val waypoint = com.vayunmathur.findfamily.data.Waypoint( "Home", 100.0, com.vayunmathur.findfamily.data.Coord(1.0, 2.0), id = 8L) vm.beginEditWaypoint(waypoint)
findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelRealRepoTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelRealRepoTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelRealRepoTest.ktindex c7e992edea..bc0e7aa324 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelRealRepoTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/util/FindFamilyViewModelRealRepoTest.kt@@ -155,17 +155,13 @@ class FindFamilyViewModelRealRepoTest { vm.mapState.setWaypointCoord(Coord(5.0, 6.0)) assertTrue(vm.mapState.saveCurrentWaypoint(0L)) await("waypoint created") { repo.waypointStore.getAll().any { it.name == "New Place" } }- vm.mapState.setShowingPresent(false)- assertFalse(vm.isShowingPresent.value) vm.mapState.setHistoricalPosition(com.vayunmathur.library.map.GeoPoint(1.0, 2.0)) assertNotNull(vm.historicalPosition.value)- vm.mapState.setShowingPresent(true)+ vm.mapState.clearHistoricalPosition() assertNull(vm.historicalPosition.value)- // Opening another person also drops the pin and returns to present.- vm.mapState.setShowingPresent(false)+ // Opening another person also drops the pin. vm.mapState.setHistoricalPosition(com.vayunmathur.library.map.GeoPoint(3.0, 4.0))- vm.mapState.onPersonOpened()- assertTrue(vm.isShowingPresent.value)+ vm.mapState.clearHistoricalPosition() assertNull(vm.historicalPosition.value) }
findfamily/src/test/java/com/vayunmathur/findfamily/util/MapAndControllerTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/util/MapAndControllerTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/util/MapAndControllerTest.ktindex dab226bf30..56810468ed 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/util/MapAndControllerTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/util/MapAndControllerTest.kt@@ -31,23 +31,18 @@ class MapAndControllerTest { private fun mapState(): MapPageState = MapPageState(CoroutineScope(Dispatchers.Unconfined), FindFamilyRepository.get(app)) - @Test fun personOpenedClearsHistory() {+ @Test fun clearingDropsHistoricalPin() { val s = mapState()- assertTrue(s.isShowingPresent.value)+ assertNull(s.historicalPosition.value) s.setHistoricalPosition(GeoPoint(1.0, 2.0))- // Opening a person sheet drops any stale historical pin and- // returns to present mode (selection itself lives in the stack).- s.onPersonOpened()- assertTrue(s.isShowingPresent.value)+ // Opening a person sheet (or the history screen) drops any stale+ // historical pin (selection itself lives in the stack).+ s.clearHistoricalPosition() assertNull(s.historicalPosition.value) - s.setHistoricalPosition(GeoPoint(3.0, 4.0))- s.setShowingPresent(true)- assertNull(s.historicalPosition.value)- s.setShowingPresent(false) s.setHistoricalPosition(GeoPoint(5.0, 6.0)) assertEquals(GeoPoint(5.0, 6.0), s.historicalPosition.value)- s.onPersonOpened()+ s.clearHistoricalPosition() assertNull(s.historicalPosition.value) }
findfamily/src/test/java/com/vayunmathur/findfamily/util/W5MapPageStateTest.kt
diff --git a/findfamily/src/test/java/com/vayunmathur/findfamily/util/W5MapPageStateTest.kt b/findfamily/src/test/java/com/vayunmathur/findfamily/util/W5MapPageStateTest.ktindex 0995cae434..b0bba41990 100644--- a/findfamily/src/test/java/com/vayunmathur/findfamily/util/W5MapPageStateTest.kt+++ b/findfamily/src/test/java/com/vayunmathur/findfamily/util/W5MapPageStateTest.kt@@ -42,28 +42,23 @@ class W5MapPageStateTest { @Test fun initialStateIsEmpty() {- assertTrue(state.isShowingPresent.value) assertNull(state.historicalPosition.value) assertEquals("", state.waypointName.value) } @Test fun openingPersonDropsStaleHistoricalPin() {- state.setShowingPresent(false) state.setHistoricalPosition(GeoPoint(3.0, 4.0))- state.onPersonOpened()- assertTrue(state.isShowingPresent.value)+ state.clearHistoricalPosition() assertNull(state.historicalPosition.value) } @Test- fun returningToPresentDropsHistoricalPin() {- state.setShowingPresent(false)+ fun clearingDropsHistoricalPin() { state.setHistoricalPosition(GeoPoint(3.0, 4.0))- state.setShowingPresent(true)+ state.clearHistoricalPosition() assertNull(state.historicalPosition.value)- // Staying in history keeps the pin.- state.setShowingPresent(false)+ // Until cleared, the pin stays for the history screen. state.setHistoricalPosition(GeoPoint(3.0, 4.0)) assertEquals(GeoPoint(3.0, 4.0), state.historicalPosition.value) }
metadata_data/photos/findfamily/large-tablet/1.png
diff --git a/metadata_data/photos/findfamily/large-tablet/1.png b/metadata_data/photos/findfamily/large-tablet/1.pngindex 3123694ff5..6848a925ca 100644Binary files a/metadata_data/photos/findfamily/large-tablet/1.png and b/metadata_data/photos/findfamily/large-tablet/1.png differ
metadata_data/photos/findfamily/phone/1.png
diff --git a/metadata_data/photos/findfamily/phone/1.png b/metadata_data/photos/findfamily/phone/1.pngindex a312aeb320..06e687e255 100644Binary files a/metadata_data/photos/findfamily/phone/1.png and b/metadata_data/photos/findfamily/phone/1.png differ
metadata_data/photos/findfamily/phone/2.png
diff --git a/metadata_data/photos/findfamily/phone/2.png b/metadata_data/photos/findfamily/phone/2.pngindex c73c7d83ec..fbd809467a 100644Binary files a/metadata_data/photos/findfamily/phone/2.png and b/metadata_data/photos/findfamily/phone/2.png differ
metadata_data/photos/findfamily/phone/3.png
diff --git a/metadata_data/photos/findfamily/phone/3.png b/metadata_data/photos/findfamily/phone/3.pngindex b630cc6024..70ac60c143 100644Binary files a/metadata_data/photos/findfamily/phone/3.png and b/metadata_data/photos/findfamily/phone/3.png differ