Fix: Routen-Aufzeichnung offline — Dim-Screen + WakeLock + GPS funktionieren

_startRecInOvl() crashte bei null _recMap auf L.polyline().addTo(_recMap) →
WakeLock, watchPosition, _resetRecInactTimer() wurden nie erreicht → Dim-Screen
wurde nie aktiviert, GPS-Track lief nicht.

- L.polyline nur erstellen wenn _recMap && window.L vorhanden
- watchPosition-Callback: _recPolyline?.addLatLng, _recLocMarker?.setLatLng,
  _recMap?.setView alle mit Optional Chaining gesichert
- SW by-v996, APP_VER 996
This commit is contained in:
rene 2026-05-15 18:19:55 +02:00
parent c59326af17
commit 1d67d6307e
4 changed files with 9 additions and 7 deletions

View file

@ -3,7 +3,7 @@
Router, State-Management, Navigation, Initialisierung.
============================================================ */
const APP_VER = '995'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
const APP_VER = '996'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
const APP_VERSION = '1.6.0'; // ← semantische Version, wird bei make release gesetzt
const IS_STAGING = location.hostname === 'staging.banyaro.app';
// Cache-Bust-Parameter nach Update-Reload sofort entfernen

View file

@ -821,7 +821,9 @@ window.Page_routes = (() => {
btn.addEventListener('pointercancel', cancelHold);
document.getElementById('rk-rec-stats-bar').style.display = '';
_recPolyline = L.polyline([], { color: '#ef4444', weight: 5, opacity: 0.9 }).addTo(_recMap);
if (_recMap && window.L) {
_recPolyline = L.polyline([], { color: '#ef4444', weight: 5, opacity: 0.9 }).addTo(_recMap);
}
await _recAcquireWakeLock();
document.addEventListener('visibilitychange', _recOnVisibility);
@ -836,9 +838,9 @@ window.Page_routes = (() => {
_recDistKm += d;
}
_recTrack.push({ lat, lon, ...(alt !== null ? { alt: Math.round(alt) } : {}) });
_recPolyline.addLatLng([lat, lon]);
_recLocMarker.setLatLng([lat, lon]);
if (_recTrack.length === 1) _recMap.setView([lat, lon], 16);
_recPolyline?.addLatLng([lat, lon]);
_recLocMarker?.setLatLng([lat, lon]);
if (_recTrack.length === 1) _recMap?.setView([lat, lon], 16);
_updateRecStats();
}, () => {}, { enableHighAccuracy: true, maximumAge: 2000 });

View file

@ -3,7 +3,7 @@
Offline-Cache + Push Notifications + Tile-Cache
============================================================ */
const CACHE_VERSION = 'by-v995';
const CACHE_VERSION = 'by-v996';
const CACHE_STATIC = `${CACHE_VERSION}-static`;
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache