feat: section 5 — MapLibre map with live track and camera follow

Replace SVG TrackView with a real MapLibre map:
- OpenFreeMap liberty tiles (no API key)
- Camera follows user in course mode while recording
- GeoJSONSource + LineLayer renders track polyline updated live
- UserLocation dot shows current GPS position
- Sensors button overlaid with semi-transparent background
This commit is contained in:
Davide Scaini
2026-06-03 09:32:49 +02:00
parent 4e1c2ebef9
commit 9d82084fa1
2 changed files with 43 additions and 63 deletions
+5 -7
View File
@@ -121,11 +121,9 @@ Items below are what remains before v1 is shippable.
- [x] `src/services/batteryOptimization.ts` — Android-only, one-time prompt (dismissed flag in AsyncStorage); uses `REQUEST_IGNORE_BATTERY_OPTIMIZATIONS` intent to open the system dialog for bincio-rec directly; falls back to `IGNORE_BATTERY_OPTIMIZATION_SETTINGS` (general page) on OEMs that block the direct intent; called from `App.tsx` on mount alongside notification permission request
### 5 — Map (optional upgrade)
### 5 — Map
The track view from section 1 already shows the GPX polyline scaled to fit the screen.
MapLibre can be added later for a real basemap (streets/terrain), but is not required for v1.
- [ ] **MapLibre basemap** — replace `TrackView` SVG with `<MapLibreGL.MapView>` + a tile source (e.g. OpenFreeMap); call `MapLibreGL.setAccessToken(null)` for raster-free usage
- [ ] **Camera follow** — add `<MapLibreGL.Camera>` that follows `trackPoints[last]` during recording
- [ ] **Line layer** — replace SVG polyline with `<MapLibreGL.ShapeSource>` + `<MapLibreGL.LineLayer>`
- [x] **MapLibre basemap**`Map` with OpenFreeMap liberty style (`tiles.openfreemap.org`); no API key required; logo and attribution hidden
- [x] **Camera follow**`Camera` with `trackUserLocation="course"` while recording; switches off when idle/paused
- [x] **Live track line**`GeoJSONSource` fed a memoized `LineString` from `trackPoints`; `Layer` with `type="line"` and blue stroke rendered on top of the basemap
- [x] **User location dot**`UserLocation` component shows current position on map