Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
cov/c3 ▾

Modern-Apps.git / maps / AGENTS.md

AGENTS.md9.8 KiBRenderedCodeRaw
1# AGENTS.md — maps/ (':maps')
2
3> Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `maps/` + allowed shared modules. Do not root-scan.
4
5_Install: ./install maps (dev by default)._
6<!-- last-reviewed: 2026-10-16 -->
7- Gradle: :maps / dir: maps/
8- Package roots present: ui, data, intents
9- Entry files: MainActivity.kt (no Route.kt — `Route` + `Navigation` are inline)
10- Deps: :library:map, :library:image, :library:network, :library:downloadservice
11- Metadata: metadata_data/maps.md (present)
12- Rust: yes / screenshotTest: yes
13
14## Overview
15**Purpose:** A fast open-source map + navigation app on OpenStreetMap, with all routing on device. Internet only for new tiles, search, traffic, and transit delays.
16**Key features:**
17- On-device routing (drive/walk/bike/transit) over a single packed `.mamaps` archive, downloaded once on first launch; viewed areas keep working offline
18- Turn-by-turn navigation with voice (TTS), lane guidance, speed-limit widget, and elevation; Android Auto via `car/`
19- Place details, saved places, transit departure boards, Street View, parking, and POI search (Google + offline index)
20- Handles external `geo:` / `google.navigation:` / Google-Maps links from other apps
21**Architecture / data-flow:** `ui/` map surface + sheets over per-concern `util/` ViewModels (`SelectedFeatureViewModel`, `MapsSearchViewModel`, `SavedPlacesViewModel`, …) → `data/` stores/parsers + `util/OfflineRouter*` routing against the memory-mapped archive; guidance runs in the `util/NavigationService` foreground service via `NavigationSessionManager`. `onCreateBeforeContent`: `NetworkClient.init(FIRST_PARTY)` → delete the legacy `world_z0-6.pmtiles` → route the cold-start deep link; `Content()` gates on the `.mamaps` download before the map renders.
22**Entry points + reading order:** `Route` (`MapPage` / `SavedPlacesPage` / `SettingsPage`, inline) → `MainActivity.kt` (`handleIntent`, `navigateTo`) → `ui/MapPage.kt` → `util/SelectedFeatureViewModel.kt` → `util/OfflineRouterRoadRoutes.kt`.
23**Gotchas:**
24- The `.mamaps` gate hosts app start — the archive URL must be live before a version ships; `adb push` the file to sideload a locally built archive
25- `singleTop` warm-start geo/navigation links arrive via `onNewIntent`, not a fresh `onCreate`
26- The map itself never splits panes (list/detail metadata only for settings/saved); its expanded side panel is separate inside `MapPage`
27- Extra non-conforming dirs (`car/`, `ipc/`, `util/`) hold real code — closed-roots migration pending
28
29## Key files
30### Root — entry + inline navigation
31- com/vayunmathur/maps/MainActivity.kt — Route, Navigation, geo-link handling, archive gate
32### car/ — Android Auto surface
33- com/vayunmathur/maps/car/MapsCarAppService.kt
34- com/vayunmathur/maps/car/MapsSession.kt
35- com/vayunmathur/maps/car/NavMapScreen.kt
36- com/vayunmathur/maps/car/CarMapRenderer.kt
37- com/vayunmathur/maps/car/CarManeuvers.kt
38- com/vayunmathur/maps/car/CarSearchScreen.kt
39### data/ — prefs, places, POI + transit sources
40- com/vayunmathur/maps/data/MapPreferences.kt
41- com/vayunmathur/maps/data/MapLinkParser.kt — external geo/maps URL parsing
42- com/vayunmathur/maps/data/GeoJson.kt
43- com/vayunmathur/maps/data/SpecificFeature.kt
44- com/vayunmathur/maps/data/OpeningHours.kt
45- com/vayunmathur/maps/data/OsmMaxspeed.kt
46- com/vayunmathur/maps/data/SavedPlace.kt
47- com/vayunmathur/maps/data/SavedPlaceStore.kt
48- com/vayunmathur/maps/data/RecentSearchStore.kt
49- com/vayunmathur/maps/data/ParkingStore.kt
50- com/vayunmathur/maps/data/google/GoogleSearchDataSource.kt
51- com/vayunmathur/maps/data/google/GooglePoiDataSource.kt
52- com/vayunmathur/maps/data/google/GooglePoiDiscovery.kt
53- com/vayunmathur/maps/data/google/GooglePoiModels.kt
54- com/vayunmathur/maps/data/google/GooglePoiMapModels.kt
55- com/vayunmathur/maps/data/google/GoogleResponse.kt
56- com/vayunmathur/maps/data/google/GoogleTrafficSource.kt
57- com/vayunmathur/maps/data/google/StreetViewDataSource.kt
58- com/vayunmathur/maps/data/google/StreetViewModels.kt
59- com/vayunmathur/maps/data/google/ReviewsWebParser.kt
60- com/vayunmathur/maps/data/google/WebReviewsFetcher.kt
61- com/vayunmathur/maps/data/transit/TransitousDataSource.kt
62- com/vayunmathur/maps/data/transit/TransitousModels.kt
63### intents/ — assistant IPC
64- com/vayunmathur/maps/intents/DirectionsIntent.kt
65### ipc/ — cross-app estimate/lookup clients
66- com/vayunmathur/maps/ipc/RideEstimateClient.kt — launches taxi intents
67- com/vayunmathur/maps/ipc/OrderLookupClient.kt — launches fooddelivery intents
68- com/vayunmathur/maps/ipc/FamilyLocationClient.kt
69- com/vayunmathur/maps/ipc/FamilyLocationProtocol.kt
70- com/vayunmathur/maps/ipc/IntentLaunch.kt
71### ui/ — pages, sheets, layers
72- com/vayunmathur/maps/ui/MapPage.kt
73- com/vayunmathur/maps/ui/MapPageScope.kt
74- com/vayunmathur/maps/ui/MapContentBox.kt
75- com/vayunmathur/maps/ui/MapSearchActions.kt
76- com/vayunmathur/maps/ui/MapSheets.kt
77- com/vayunmathur/maps/ui/MapSheetEffects.kt
78- com/vayunmathur/maps/ui/MapSidePanel.kt
79- com/vayunmathur/maps/ui/MapWideHost.kt
80- com/vayunmathur/maps/ui/MapWideLayout.kt
81- com/vayunmathur/maps/ui/BottomSheetContent.kt
82- com/vayunmathur/maps/ui/BottomSheetHeader.kt
83- com/vayunmathur/maps/ui/SearchSheet.kt
84- com/vayunmathur/maps/ui/PlaceSheet.kt
85- com/vayunmathur/maps/ui/PlaceSheetHeader.kt
86- com/vayunmathur/maps/ui/PlaceSheetHours.kt
87- com/vayunmathur/maps/ui/PlaceActionRow.kt
88- com/vayunmathur/maps/ui/ContactAddressButton.kt
89- com/vayunmathur/maps/ui/SearchResultLayer.kt
90- com/vayunmathur/maps/ui/RouteSheet.kt
91- com/vayunmathur/maps/ui/RouteSheetTabs.kt
92- com/vayunmathur/maps/ui/TripSheet.kt
93- com/vayunmathur/maps/ui/NavigationOverlay.kt
94- com/vayunmathur/maps/ui/DeparturesSheet.kt
95- com/vayunmathur/maps/ui/DepartureTime.kt
96- com/vayunmathur/maps/ui/CategoryChips.kt
97- com/vayunmathur/maps/ui/LayersButton.kt
98- com/vayunmathur/maps/ui/LayersSheet.kt
99- com/vayunmathur/maps/ui/CompassButton.kt
100- com/vayunmathur/maps/ui/MapScaleBar.kt
101- com/vayunmathur/maps/ui/VoiceSearchButton.kt
102- com/vayunmathur/maps/ui/SavedPlacesPage.kt
103- com/vayunmathur/maps/ui/SavedPlacesLayer.kt
104- com/vayunmathur/maps/ui/FamilyLocationLayer.kt
105- com/vayunmathur/maps/ui/ParkingLayer.kt
106- com/vayunmathur/maps/ui/ParkingSheet.kt
107- com/vayunmathur/maps/ui/RoadsLayer.kt
108- com/vayunmathur/maps/ui/SafetyLayer.kt
109- com/vayunmathur/maps/ui/SatelliteLayer.kt
110- com/vayunmathur/maps/ui/TransitStopsLayer.kt
111- com/vayunmathur/maps/ui/PoiEnrichment.kt
112- com/vayunmathur/maps/ui/RestaurantItem.kt
113- com/vayunmathur/maps/ui/LineBadge.kt
114- com/vayunmathur/maps/ui/ManeuverIcon.kt
115### ui/map/ — surface, camera, overlays
116- com/vayunmathur/maps/ui/map/MapSurface.kt
117- com/vayunmathur/maps/ui/map/MapSurfaceHelpers.kt
118- com/vayunmathur/maps/ui/map/MapCamera.kt
119- com/vayunmathur/maps/ui/map/MapChrome.kt
120- com/vayunmathur/maps/ui/map/MapChromeState.kt
121- com/vayunmathur/maps/ui/map/MapFabStack.kt
122- com/vayunmathur/maps/ui/map/MapLayers.kt
123- com/vayunmathur/maps/ui/map/MapOverlays.kt
124- com/vayunmathur/maps/ui/map/MapFeaturePicker.kt
125- com/vayunmathur/maps/ui/map/MapPinFeatures.kt
126- com/vayunmathur/maps/ui/map/RouteOverlayBuilder.kt
127- com/vayunmathur/maps/ui/map/RailLines.kt
128- com/vayunmathur/maps/ui/map/TransitVehicles.kt
129- com/vayunmathur/maps/ui/map/TrafficPrefetchEffect.kt
130- com/vayunmathur/maps/ui/map/WaypointList.kt
131### ui/nav/ — guidance widgets
132- com/vayunmathur/maps/ui/nav/ManeuverBanner.kt
133- com/vayunmathur/maps/ui/nav/LaneGuidance.kt
134- com/vayunmathur/maps/ui/nav/SpeedWidget.kt
135- com/vayunmathur/maps/ui/nav/RouteShield.kt
136- com/vayunmathur/maps/ui/nav/ArrivalSummary.kt
137- com/vayunmathur/maps/ui/nav/StepsSheet.kt
138- com/vayunmathur/maps/ui/nav/ElevationChart.kt
139### ui/streetview/ + ui/settings/ + ui/theme/
140- com/vayunmathur/maps/ui/streetview/StreetViewScreen.kt
141- com/vayunmathur/maps/ui/streetview/StreetViewPegman.kt
142- com/vayunmathur/maps/ui/streetview/StreetViewArrows.kt
143- com/vayunmathur/maps/ui/settings/MapSettingsPage.kt
144- com/vayunmathur/maps/ui/theme/MapTokens.kt
145- com/vayunmathur/maps/ui/theme/BasemapPalette.kt
146- com/vayunmathur/maps/ui/theme/MapChromeMetrics.kt
147### util/ — ViewModels, offline router, navigation service (migration pending)
148- com/vayunmathur/maps/util/SelectedFeatureViewModel.kt
149- com/vayunmathur/maps/util/MapsSearchViewModel.kt
150- com/vayunmathur/maps/util/MapsUiContract.kt
151- com/vayunmathur/maps/util/SavedPlacesViewModel.kt
152- com/vayunmathur/maps/util/MapSettingsViewModel.kt
153- com/vayunmathur/maps/util/PlacePanelState.kt
154- com/vayunmathur/maps/util/GooglePoiMapViewModel.kt
155- com/vayunmathur/maps/util/TransitStopsViewModel.kt
156- com/vayunmathur/maps/util/TransitClock.kt
157- com/vayunmathur/maps/util/ParkingViewModel.kt
158- com/vayunmathur/maps/util/MapTileCache.kt — `.mamaps` archive access
159- com/vayunmathur/maps/util/OfflineRouter.kt
160- com/vayunmathur/maps/util/OfflineRouterRoadRoutes.kt
161- com/vayunmathur/maps/util/OfflineRouterRouteBuilder.kt
162- com/vayunmathur/maps/util/OfflineRouterTraffic.kt
163- com/vayunmathur/maps/util/OfflineRouterTransit.kt
164- com/vayunmathur/maps/util/RouteService.kt
165- com/vayunmathur/maps/util/NavigationService.kt — foreground guidance service
166- com/vayunmathur/maps/util/NavigationSessionManager.kt
167- com/vayunmathur/maps/util/NavigationTts.kt
168- com/vayunmathur/maps/util/PolylineProgress.kt
169- com/vayunmathur/maps/util/GTFSProvider.kt
170- com/vayunmathur/maps/util/PoiArchive.kt
171- com/vayunmathur/maps/util/PoiIndex.kt
172- com/vayunmathur/maps/util/PoiIndexAttrs.kt
173- com/vayunmathur/maps/util/PoiIndexSpatial.kt
174- com/vayunmathur/maps/util/PoiIndexWords.kt
175- com/vayunmathur/maps/util/PoiCategories.kt
176- com/vayunmathur/maps/util/SpatialKey.kt
177- com/vayunmathur/maps/util/RegionalUnits.kt
178- com/vayunmathur/maps/util/ItineraryWording.kt
179- com/vayunmathur/maps/util/Wikidata.kt
180- com/vayunmathur/maps/util/CameraBounds.kt
181- com/vayunmathur/maps/util/ContactLookup.kt
182- com/vayunmathur/maps/util/FrameworkLocationManager.kt
183
184## Verify (this module only)
185```
186./gradlew :maps:compileDevKotlin
187./gradlew :maps:lint
188./gradlew :maps:checkMetadata
189```