Offline-Karten Runde 5: Geraetetest-Feedback (Indikator, Flugmodus-Signal, Ent-Funklochen, Warnungs-Aktualitaet, Routen-Start-Check)
- Indikator links unter die Zoom-Regler (rechts verdeckte Legenden-Chips) - Flugmodus bei offener App -> Position raw als Funkloch-Zone (offline-Event) - Ent-Funklochen: Zonen-Liste im Offline-Modal mit X (removeDeadZone) - Warnungs-Aktualitaet: _mergeStore Bbox-Replace (aufgehobene Giftkoeder/ gefundene Hunde verschwinden; Fetch-Kreis deckt Bbox via sqrt2 ab; fresh=null merged nie) + 24h-Refresh im 50km-Umkreis beim Start - Routen offline nutzbar halten: ensureRouteCorridors beim Start-Check (Stichproben-Verify, Re-Download aus preview_track, Region-Dedupe) - Stub-Tests ins Repo: tests/js/ (r1/r3/r4/r5, alle gruen) Bump v1231
This commit is contained in:
parent
53bc27faa3
commit
6c313aca05
15 changed files with 606 additions and 52 deletions
|
|
@ -7307,14 +7307,13 @@ svg.empty-state-icon {
|
|||
pointer-events: none;
|
||||
letter-spacing: 0.01em;
|
||||
}
|
||||
/* Eingeklappt (5s nach Offline-Gang, boot.js): kleines pulsierendes Icon oben rechts —
|
||||
die Leiste über die volle Breite verdeckte Nav-Elemente (z.B. „← Zurück" in der
|
||||
Routennavigation, Gerätetest 2026-06-07). Sitzt UNTERHALB der Kopfzeilen-Höhe,
|
||||
damit es Buttons (Zentrieren, Legende) nie überlagert. */
|
||||
/* Eingeklappt (5s nach Offline-Gang, boot.js): kleines pulsierendes Icon LINKS unterhalb
|
||||
der Karten-Zoom-Regler (+/−) — rechts verdeckte es die Legenden-Chips, die volle Leiste
|
||||
davor Nav-Elemente (Gerätetests René 2026-06-07/08). */
|
||||
#offline-banner.collapsed {
|
||||
top: calc(env(safe-area-inset-top, 0px) + 54px);
|
||||
left: auto;
|
||||
right: 8px;
|
||||
top: calc(env(safe-area-inset-top, 0px) + 110px);
|
||||
left: 10px;
|
||||
right: auto;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
padding: 0;
|
||||
|
|
|
|||
|
|
@ -86,14 +86,14 @@
|
|||
<title>Ban Yaro</title>
|
||||
|
||||
<!-- Theme + theme-color Statusleiste vor CSS setzen -->
|
||||
<script src="/js/boot-early.js?v=1230"></script>
|
||||
<script src="/js/boot-early.js?v=1231"></script>
|
||||
|
||||
<!-- CSS: Reihenfolge ist wichtig — ?v= zwingt Browser zur Neuladung -->
|
||||
<link rel="stylesheet" href="/css/design-system.css?v=1230">
|
||||
<link rel="stylesheet" href="/css/layout.css?v=1230">
|
||||
<link rel="stylesheet" href="/css/components.css?v=1230">
|
||||
<link rel="stylesheet" href="/css/utilities.css?v=1230">
|
||||
<link rel="stylesheet" href="/css/lists.css?v=1230">
|
||||
<link rel="stylesheet" href="/css/design-system.css?v=1231">
|
||||
<link rel="stylesheet" href="/css/layout.css?v=1231">
|
||||
<link rel="stylesheet" href="/css/components.css?v=1231">
|
||||
<link rel="stylesheet" href="/css/utilities.css?v=1231">
|
||||
<link rel="stylesheet" href="/css/lists.css?v=1231">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
|
@ -612,11 +612,11 @@
|
|||
<div id="modal-container"></div>
|
||||
|
||||
<!-- JS: Reihenfolge ist wichtig — erst Basis, dann Features -->
|
||||
<script src="/js/api.js?v=1230"></script>
|
||||
<script src="/js/ui.js?v=1230"></script>
|
||||
<script src="/js/app.js?v=1230"></script>
|
||||
<script src="/js/worlds.js?v=1230"></script>
|
||||
<script src="/js/offline-indicator.js?v=1230"></script>
|
||||
<script src="/js/api.js?v=1231"></script>
|
||||
<script src="/js/ui.js?v=1231"></script>
|
||||
<script src="/js/app.js?v=1231"></script>
|
||||
<script src="/js/worlds.js?v=1231"></script>
|
||||
<script src="/js/offline-indicator.js?v=1231"></script>
|
||||
|
||||
<!-- Feature-Seiten werden lazy geladen -->
|
||||
|
||||
|
|
@ -626,7 +626,7 @@
|
|||
|
||||
|
||||
<!-- Boot: Offline-Banner + SW-Registration (extrahiert für CSP) -->
|
||||
<script src="/js/boot.js?v=1230"></script>
|
||||
<script src="/js/boot.js?v=1231"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Router, State-Management, Navigation, Initialisierung.
|
||||
============================================================ */
|
||||
|
||||
const APP_VER = '1230'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VER = '1231'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VERSION = '1.6.0'; // ← semantische Version, wird bei make release gesetzt
|
||||
window.APP_VER = APP_VER; // global verfügbar für andere Module (z.B. offline-indicator)
|
||||
window.APP_VERSION = APP_VERSION;
|
||||
|
|
|
|||
|
|
@ -128,17 +128,25 @@ window.MapOffline = (function () {
|
|||
'restaurant', 'bank', 'giftkoeder', 'kotbeutel', 'gefahr', 'parkplatz',
|
||||
'treffpunkt', 'sonstiges', 'hotel'];
|
||||
|
||||
// Frische Liste mit Bestand mergen (per id) — eine zweite Region (Urlaubsort) darf die erste
|
||||
// nicht löschen. Liefert die Anzahl frischer Einträge.
|
||||
function _mergeStore(key, fresh) {
|
||||
if (!fresh || !fresh.length) return Promise.resolve(0);
|
||||
// Frische Liste mit Bestand mergen (per id) — eine zweite Region (Urlaubsort) darf die
|
||||
// erste nicht löschen. WICHTIG für Warnungen (René 2026-06-08): Die Server-Antwort ist
|
||||
// für die geladene Bbox AUTORITATIV — Bestands-Einträge INNERHALB der Bbox, die nicht
|
||||
// mehr geliefert werden (aufgehobener Giftköder, gefundener Hund, wegen Meldungen
|
||||
// ausgeblendeter Marker), werden ENTFERNT. fresh == null (Fetch fehlgeschlagen) merged
|
||||
// NIE — sonst würde ein Offline-Refresh den Bestand wegputzen.
|
||||
function _mergeStore(key, fresh, bbox) {
|
||||
if (fresh == null) return Promise.resolve(0);
|
||||
return _get(key).then(function (old) {
|
||||
var merged = fresh;
|
||||
if (old && old.length) {
|
||||
var seen = {};
|
||||
fresh.forEach(function (p) { seen[p.id] = true; });
|
||||
merged = fresh.concat(old.filter(function (p) { return !seen[p.id]; }));
|
||||
}
|
||||
var seen = {};
|
||||
fresh.forEach(function (p) { seen[p.id] = true; });
|
||||
var keep = (old || []).filter(function (p) {
|
||||
if (seen[p.id]) return false;
|
||||
if (bbox && p.lat >= bbox.south && p.lat <= bbox.north &&
|
||||
p.lon >= bbox.west && p.lon <= bbox.east) return false; // in Bbox, nicht mehr da → weg
|
||||
return true;
|
||||
});
|
||||
var merged = fresh.concat(keep);
|
||||
if (!merged.length && !(old && old.length)) return 0;
|
||||
return _put(key, merged).then(function () { return fresh.length; });
|
||||
});
|
||||
}
|
||||
|
|
@ -150,31 +158,53 @@ window.MapOffline = (function () {
|
|||
south: bbox.south, west: bbox.west, north: bbox.north, east: bbox.east });
|
||||
return fetch('/api/osm/pois?' + params)
|
||||
.then(function (r) { return r.ok ? r.json() : null; })
|
||||
.then(function (fresh) { return _mergeStore('p/' + type, fresh); })
|
||||
.then(function (fresh) { return _mergeStore('p/' + type, fresh, bbox); })
|
||||
.then(function (n) { total += n; })
|
||||
.catch(function () {});
|
||||
});
|
||||
|
||||
// Sicherheitsdaten MÜSSEN offline da sein (René 2026-06-07): Giftköder-Alarme
|
||||
// (/api/poison, Radius in m) + vermisste Hunde (/api/lost, Radius in km) — beide anonym.
|
||||
// Fetch-Radius ×√2: der Kreis muss die Bbox-ECKEN abdecken, sonst räumt der
|
||||
// Bbox-Replace in _mergeStore dort fälschlich Bestand weg.
|
||||
var midLat = (bbox.south + bbox.north) / 2, midLon = (bbox.west + bbox.east) / 2;
|
||||
var radiusKm = Math.max(
|
||||
(bbox.north - bbox.south) * 111 / 2,
|
||||
(bbox.east - bbox.west) * 111 * Math.cos(midLat * Math.PI / 180) / 2, 1);
|
||||
jobs.push(fetch('/api/poison?lat=' + midLat + '&lon=' + midLon + '&radius=' + Math.round(radiusKm * 1000))
|
||||
jobs.push(fetch('/api/poison?lat=' + midLat + '&lon=' + midLon + '&radius=' + Math.round(radiusKm * 1415))
|
||||
.then(function (r) { return r.ok ? r.json() : null; })
|
||||
.then(function (fresh) { return _mergeStore('p/_poison', fresh); })
|
||||
.then(function (fresh) { return _mergeStore('p/_poison', fresh, bbox); })
|
||||
.then(function (n) { total += n; })
|
||||
.catch(function () {}));
|
||||
jobs.push(fetch('/api/lost?lat=' + midLat + '&lon=' + midLon + '&radius_km=' + Math.ceil(radiusKm))
|
||||
jobs.push(fetch('/api/lost?lat=' + midLat + '&lon=' + midLon + '&radius_km=' + Math.ceil(radiusKm * 1.42))
|
||||
.then(function (r) { return r.ok ? r.json() : null; })
|
||||
.then(function (fresh) { return _mergeStore('p/_lost', fresh); })
|
||||
.then(function (fresh) { return _mergeStore('p/_lost', fresh, bbox); })
|
||||
.then(function (n) { total += n; })
|
||||
.catch(function () {}));
|
||||
|
||||
return Promise.all(jobs).then(function () { return total; });
|
||||
}
|
||||
|
||||
// Warnungen aktuell halten (René 2026-06-08: Giftköder können aufgehoben, Hunde gefunden
|
||||
// sein): max. alle 24 h den 50-km-Umkreis der Position frisch laden — der Bbox-Replace
|
||||
// in _mergeStore räumt Aufgehobenes weg. Bbox (~35 km Halbseite) liegt IM Fetch-Kreis.
|
||||
function _refreshAlerts(lat, lon) {
|
||||
return _metaGet('alertsTs').then(function (ts) {
|
||||
if (ts && Date.now() - ts < 86400000) return;
|
||||
var bb = { south: lat - 0.31, north: lat + 0.31, west: lon - 0.47, east: lon + 0.47 };
|
||||
return Promise.all([
|
||||
fetch('/api/poison?lat=' + lat + '&lon=' + lon + '&radius=50000')
|
||||
.then(function (r) { return r.ok ? r.json() : null; })
|
||||
.then(function (f) { return _mergeStore('p/_poison', f, bb); })
|
||||
.catch(function () {}),
|
||||
fetch('/api/lost?lat=' + lat + '&lon=' + lon + '&radius_km=50')
|
||||
.then(function (r) { return r.ok ? r.json() : null; })
|
||||
.then(function (f) { return _mergeStore('p/_lost', f, bb); })
|
||||
.catch(function () {}),
|
||||
]).then(function () { return _metaPut('alertsTs', Date.now()); });
|
||||
}).catch(function () {});
|
||||
}
|
||||
|
||||
// Gespeicherte Sicherheits-Alarme ('poison' | 'lost') im Bbox-Ausschnitt — Offline-Fallback.
|
||||
function alerts(kind, bbox) {
|
||||
return _get('p/_' + kind).then(function (list) {
|
||||
|
|
@ -217,9 +247,12 @@ window.MapOffline = (function () {
|
|||
}
|
||||
|
||||
// Gespeichertes Gebiet in der Regions-Liste verbuchen ('region' = letztes, Back-Compat).
|
||||
// Gleicher Typ + Name (z.B. Korridor derselben Route erneut geladen) ersetzt den Alt-Eintrag.
|
||||
function _addRegion(region) {
|
||||
return _metaGet('regions').then(function (list) {
|
||||
list = list || [];
|
||||
list = (list || []).filter(function (r) {
|
||||
return !(region.name && r.type === region.type && r.name === region.name);
|
||||
});
|
||||
list.push(region);
|
||||
if (list.length > 30) list = list.slice(-30);
|
||||
return _metaPut('regions', list);
|
||||
|
|
@ -430,6 +463,15 @@ window.MapOffline = (function () {
|
|||
markDeadZone(_gps.lat, _gps.lon);
|
||||
}
|
||||
|
||||
// Zone manuell „ent-funklochen" (✕ im Offline-Modal): wird nicht mehr automatisch
|
||||
// geladen; bereits geladene Kacheln bleiben bis „Alles löschen"/Eviction.
|
||||
function removeDeadZone(ts) {
|
||||
return _metaGet('deadzones').then(function (zones) {
|
||||
zones = (zones || []).filter(function (z) { return z.ts !== ts; });
|
||||
return _metaPut('deadzones', zones).then(function () { return zones.length; });
|
||||
});
|
||||
}
|
||||
|
||||
// Funkloch merken (Dedupe: keine zweite Zone im Umkreis von 2 km, Cap 50).
|
||||
function markDeadZone(lat, lon) {
|
||||
return _metaGet('deadzones').then(function (zones) {
|
||||
|
|
@ -459,12 +501,17 @@ window.MapOffline = (function () {
|
|||
if (over) return null; // Speicher-Cap erreicht → kein automatisches Nachladen mehr
|
||||
return _metaGet('deadzones');
|
||||
}).then(function (zones) {
|
||||
if (zones === null || zones === undefined) return 0;
|
||||
if (zones === null) return 0; // expliziter Cap-Abbruch (s.o.)
|
||||
zones = zones || []; // keine Zonen → trotzdem Warnungs-Refresh unten
|
||||
all = zones;
|
||||
var cand = opts.lat == null ? zones.slice() : zones.filter(function (z) {
|
||||
return _distKm(z.lat, z.lon, opts.lat, opts.lon) <= maxKm;
|
||||
});
|
||||
if (!cand.length) return 0;
|
||||
if (!cand.length) {
|
||||
// Keine Zonen in der Nähe — Warnungen trotzdem frisch halten (24-h-Takt).
|
||||
if (opts.lat != null) return _refreshAlerts(opts.lat, opts.lon).then(function () { return 0; });
|
||||
return 0;
|
||||
}
|
||||
// Verify: als gefüllt markierte Zonen ohne lokale Zentrums-Kachel wieder öffnen.
|
||||
var verify = Promise.resolve();
|
||||
cand.forEach(function (z) {
|
||||
|
|
@ -488,6 +535,10 @@ window.MapOffline = (function () {
|
|||
});
|
||||
});
|
||||
return chain.then(function () { return _metaPut('deadzones', all); })
|
||||
.then(function () {
|
||||
// Warnungen im Umkreis frisch halten (24-h-Takt, Bbox-Replace).
|
||||
if (opts.lat != null) return _refreshAlerts(opts.lat, opts.lon);
|
||||
})
|
||||
.then(function () { return filled; });
|
||||
});
|
||||
}).then(function (n) { _autofillActive = false; return n; },
|
||||
|
|
@ -549,6 +600,53 @@ window.MapOffline = (function () {
|
|||
.then(function () { return { tiles: state.stored, bytes: state.bytes, pois: poiCount, capped: state.bytes >= cap }; });
|
||||
}
|
||||
|
||||
// Gespeicherte Routen offline nutzbar halten (René 2026-06-08): beim Start die Korridore
|
||||
// der eigenen Routen in Positionsnähe sicherstellen — Stichproben-Kacheln prüfen, bei
|
||||
// Lücken Korridor (neu) laden. Deckt „Alles löschen" + Eviction ab; preview_track
|
||||
// (~40 Punkte) reicht, der ±1-km-Puffer schluckt die Vereinfachung. Automatischer Pfad → Cap.
|
||||
var _ensureActive = false;
|
||||
function ensureRouteCorridors(routes, opts) {
|
||||
opts = opts || {};
|
||||
var maxKm = opts.maxKm || 50;
|
||||
if (_ensureActive || !navigator.onLine) return Promise.resolve(0);
|
||||
_ensureActive = true;
|
||||
var done = 0;
|
||||
return _overCap().then(function (over) {
|
||||
if (over) return 0;
|
||||
var cand = (routes || []).filter(function (r) {
|
||||
var t = r.preview_track || r.gps_track;
|
||||
if (!t || t.length < 2) return false;
|
||||
if (opts.lat == null) return true;
|
||||
return _distKm(t[0].lat, t[0].lon, opts.lat, opts.lon) <= maxKm;
|
||||
});
|
||||
var chain = Promise.resolve();
|
||||
cand.forEach(function (r) {
|
||||
chain = chain.then(function () {
|
||||
var t = r.preview_track || r.gps_track;
|
||||
var idxs = [0, Math.floor(t.length / 4), Math.floor(t.length / 2),
|
||||
Math.floor(3 * t.length / 4), t.length - 1];
|
||||
var missing = false, v = Promise.resolve();
|
||||
idxs.forEach(function (i) {
|
||||
v = v.then(function () {
|
||||
if (missing) return;
|
||||
var p = t[i];
|
||||
return _get(MAXZOOM + '/' + _x(p.lon, MAXZOOM) + '/' + _y(p.lat, MAXZOOM))
|
||||
.then(function (hit) { if (!hit) missing = true; });
|
||||
});
|
||||
});
|
||||
return v.then(function () {
|
||||
if (!missing) return;
|
||||
return downloadCorridor(t, { bufferKm: 1, name: r.name || ('route-' + r.id) })
|
||||
.then(function (res) { if (res.bytes > 0) done++; })
|
||||
.catch(function () {});
|
||||
});
|
||||
});
|
||||
});
|
||||
return chain.then(function () { return done; });
|
||||
}).then(function (n) { _ensureActive = false; return n; },
|
||||
function () { _ensureActive = false; return 0; });
|
||||
}
|
||||
|
||||
// ---- Bereichsauswahl: sichtbaren Karten-Ausschnitt komplett speichern ---------
|
||||
// bbox = {south,west,north,east} (z.B. aktueller Viewport). Zu-groß-Schutz über
|
||||
// Kachelzahl, Abbruch-Cap über capMB. opts {capMB:40, name, onProgress({bytes,done,total})}.
|
||||
|
|
@ -626,8 +724,11 @@ window.MapOffline = (function () {
|
|||
return _count().then(function (count) {
|
||||
return _metaGet('regions').then(function (regions) {
|
||||
return _metaGet('totalBytes').then(function (totalBytes) {
|
||||
return _metaGet('region').then(function (meta) {
|
||||
return { count: count, meta: meta || null, regions: regions || [], totalBytes: totalBytes || 0 };
|
||||
return _metaGet('deadzones').then(function (deadzones) {
|
||||
return _metaGet('region').then(function (meta) {
|
||||
return { count: count, meta: meta || null, regions: regions || [],
|
||||
totalBytes: totalBytes || 0, deadzones: deadzones || [] };
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -652,8 +753,9 @@ window.MapOffline = (function () {
|
|||
|
||||
return {
|
||||
registerProtocol: registerProtocol, downloadAround: downloadAround, downloadCorridor: downloadCorridor,
|
||||
downloadBbox: downloadBbox, tile: tile, glyph: glyph, pois: pois, alerts: alerts, coverage: coverage,
|
||||
setGps: setGps, markDeadZone: markDeadZone, autoFillDeadZones: autoFillDeadZones,
|
||||
downloadBbox: downloadBbox, ensureRouteCorridors: ensureRouteCorridors,
|
||||
tile: tile, glyph: glyph, pois: pois, alerts: alerts, coverage: coverage,
|
||||
setGps: setGps, markDeadZone: markDeadZone, removeDeadZone: removeDeadZone, autoFillDeadZones: autoFillDeadZones,
|
||||
stats: stats, hasRegion: hasRegion, clear: clear, MAXZOOM: MAXZOOM,
|
||||
};
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -278,9 +278,44 @@ window.OfflineIndicator = (() => {
|
|||
return null;
|
||||
}
|
||||
|
||||
// Funkloch-Zonen automatisch füllen/verifizieren, sobald Netz da ist — das Gerät lernt
|
||||
// selbst, wo Offline-Karten nötig sind. Mit Position werden nur Zonen im Umkreis
|
||||
// (50 km) geladen → Speicher bleibt minimal, ferne Zonen kommen, wenn man dort ist.
|
||||
// Flugmodus/Netzverlust bei OFFENER App = klares Funkloch-Signal (René 2026-06-08):
|
||||
// aktuelle Position direkt als Zone merken — raw in IndexedDB, denn der GL-Stack ist
|
||||
// offline evtl. nicht ladbar. Dedupe 2 km wie MapOffline.markDeadZone; Cap 50.
|
||||
function _markDeadZoneRaw(lat, lon) {
|
||||
try {
|
||||
const r = indexedDB.open('by-offline-tiles', 1);
|
||||
r.onupgradeneeded = () => {
|
||||
const d = r.result;
|
||||
if (!d.objectStoreNames.contains('tiles')) d.createObjectStore('tiles');
|
||||
if (!d.objectStoreNames.contains('meta')) d.createObjectStore('meta');
|
||||
};
|
||||
r.onsuccess = () => {
|
||||
const db = r.result;
|
||||
if (!db.objectStoreNames.contains('meta')) { db.close(); return; }
|
||||
const store = db.transaction('meta', 'readwrite').objectStore('meta');
|
||||
const rq = store.get('deadzones');
|
||||
rq.onsuccess = () => {
|
||||
let zones = rq.result || [];
|
||||
const near = zones.some(z => {
|
||||
const dLat = (z.lat - lat) * 111, dLon = (z.lon - lon) * 111 * Math.cos(lat * Math.PI / 180);
|
||||
return Math.sqrt(dLat * dLat + dLon * dLon) < 2;
|
||||
});
|
||||
if (!near) {
|
||||
zones.push({ lat, lon, ts: Date.now(), filled: false });
|
||||
if (zones.length > 50) zones = zones.slice(-50);
|
||||
store.put(zones, 'deadzones');
|
||||
}
|
||||
db.close();
|
||||
};
|
||||
rq.onerror = () => db.close();
|
||||
};
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
// Start-Check (auch bei Netz-Rückkehr): Funkloch-Zonen UND Routen-Korridore in
|
||||
// Positionsnähe (50 km) füllen/verifizieren — das Gerät hält selbst aktuell, was
|
||||
// offline nötig ist (René 2026-06-08: gespeicherte Routen müssen offline nutzbar
|
||||
// bleiben, auch nach „Alles löschen"/Eviction). Ferne Gebiete kommen, wenn man dort ist.
|
||||
let _autoFillTimer = null;
|
||||
function _scheduleAutoFill(delayMs) {
|
||||
if (!_offlineTilesMode()) return;
|
||||
|
|
@ -288,12 +323,21 @@ window.OfflineIndicator = (() => {
|
|||
_autoFillTimer = setTimeout(async () => {
|
||||
if (!navigator.onLine) return;
|
||||
try {
|
||||
if (!(await _anyDeadZonesStored())) return; // nichts zu tun → GL-Stack nicht laden
|
||||
const hasZones = await _anyDeadZonesStored();
|
||||
let routes = [];
|
||||
try { routes = (await API.routes.list()) || []; } catch {}
|
||||
routes = routes.filter(r => (r.preview_track || []).length >= 2);
|
||||
if (!hasZones && !routes.length) return; // nichts zu tun → GL-Stack nicht laden
|
||||
const pos = await _lastKnownPos();
|
||||
const o = pos ? { lat: pos.lat, lon: pos.lon } : {};
|
||||
await UI.loadMapLibreUI();
|
||||
const n = await window.MapOffline?.autoFillDeadZones?.(pos ? { lat: pos.lat, lon: pos.lon } : {});
|
||||
if (n) {
|
||||
UI.toast?.info(`${n} Funkloch-${n === 1 ? 'Gebiet' : 'Gebiete'} automatisch offline gespeichert.`);
|
||||
const n = await window.MapOffline?.autoFillDeadZones?.(o) || 0;
|
||||
const k = routes.length ? (await window.MapOffline?.ensureRouteCorridors?.(routes, o) || 0) : 0;
|
||||
if (n || k) {
|
||||
const parts = [];
|
||||
if (n) parts.push(`${n} Funkloch-${n === 1 ? 'Gebiet' : 'Gebiete'}`);
|
||||
if (k) parts.push(`${k} Routen-${k === 1 ? 'Korridor' : 'Korridore'}`);
|
||||
UI.toast?.info(`${parts.join(' + ')} automatisch offline gespeichert.`);
|
||||
refresh();
|
||||
}
|
||||
} catch (e) {}
|
||||
|
|
@ -471,6 +515,13 @@ window.OfflineIndicator = (() => {
|
|||
// Funkloch-Zonen nachladen: verzögert beim Start + sobald die Verbindung zurückkommt.
|
||||
_scheduleAutoFill(30_000);
|
||||
window.addEventListener('online', () => _scheduleAutoFill(8_000));
|
||||
// Flugmodus/Netzverlust bei offener App → Standort als Funkloch-Zone merken
|
||||
// (wird beim nächsten Online-Sein automatisch geladen und künftig aktuell gehalten).
|
||||
window.addEventListener('offline', async () => {
|
||||
if (!_offlineTilesMode()) return;
|
||||
const pos = await _lastKnownPos();
|
||||
if (pos) _markDeadZoneRaw(pos.lat, pos.lon);
|
||||
});
|
||||
_checkStorageQuota(); // beim Init prüfen
|
||||
setInterval(() => { _prefetchData(); refresh(); _checkStorageQuota(); }, 60_000);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2276,11 +2276,30 @@ window.Page_map = (() => {
|
|||
</p>
|
||||
${regions.length ? `<button class="btn btn-secondary" id="off-clear" style="color:var(--c-danger)">${UI.icon('trash')} Alles löschen</button>` : ''}
|
||||
</div>
|
||||
${(s.deadzones || []).length ? `
|
||||
<div style="margin-top:var(--space-3)">
|
||||
<div style="font-size:var(--text-xs);font-weight:600;color:var(--c-text-secondary);margin-bottom:2px">
|
||||
Funkloch-Gebiete (${s.deadzones.length}) — werden automatisch aktuell gehalten</div>
|
||||
${s.deadzones.map(z => `
|
||||
<div class="off-zone-row" style="display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:var(--text-xs);padding:4px 0;border-top:1px solid var(--c-border)">
|
||||
<span style="color:var(--c-text-secondary)">📡 ${new Date(z.ts).toLocaleDateString('de-DE')} · ${z.lat.toFixed(3)}, ${z.lon.toFixed(3)} · ${z.filled ? 'geladen' : 'ausstehend'}</span>
|
||||
<button type="button" class="btn btn-secondary off-zone-del" data-ts="${z.ts}"
|
||||
title="Nicht mehr automatisch laden" style="padding:1px 8px;font-size:var(--text-xs)">✕</button>
|
||||
</div>`).join('')}
|
||||
</div>` : ''}
|
||||
`,
|
||||
footer: `<button class="btn btn-secondary" data-modal-close style="width:100%">Schließen</button>`,
|
||||
});
|
||||
document.getElementById('off-dl')?.addEventListener('click', () => { UI.modal.close(); _downloadVectorRegion(); });
|
||||
document.getElementById('off-bbox')?.addEventListener('click', () => { UI.modal.close(); _downloadViewport(); });
|
||||
// Ent-Funklochen: Zone aus dem Gedächtnis nehmen (✕) — lädt nicht mehr automatisch.
|
||||
document.querySelectorAll('.off-zone-del').forEach(b => b.addEventListener('click', async e => {
|
||||
const ts = Number(e.currentTarget.dataset.ts);
|
||||
e.currentTarget.closest('.off-zone-row')?.remove();
|
||||
await MapOffline.removeDeadZone(ts).catch(() => {});
|
||||
UI.toast.success('Funkloch-Gebiet entfernt — wird nicht mehr automatisch geladen.');
|
||||
window.OfflineIndicator?.refresh();
|
||||
}));
|
||||
document.getElementById('off-cov')?.addEventListener('click', async () => { UI.modal.close(); await _setCoverage(!_covOn); });
|
||||
document.getElementById('off-clear')?.addEventListener('click', async e => {
|
||||
const btn = e.currentTarget;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="color-scheme" content="light dark">
|
||||
<script src="/js/landing-init.js?v=1230"></script>
|
||||
<script src="/js/landing-init.js?v=1231"></script>
|
||||
<title>Ban Yaro — Die Hunde-App für Deutschland, Österreich & Schweiz</title>
|
||||
<meta name="description" content="Ban Yaro: Die kostenlose All-in-One Hunde-App für DACH. Tagebuch, Giftköder-Alarm, Training mit KI, Forum, Wurfbörse, Stammbaum, Inzucht-Check — DSGVO-konform, offline-fähig, ohne App Store.">
|
||||
<meta name="keywords" content="Hunde App, Hunde Community, Wurfbörse, Züchter, Welpen kaufen, Stammbaum Hund, Inzuchtkoeffizient, Hundezucht, Impfpass Hund, Giftköder Alarm, Gassi Community, Hundetraining App, Hunde Forum, Hunde KI, Hundefilm Datenbank, Welpen Marktplatz">
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
============================================================ */
|
||||
|
||||
// ← EINZIGE Stelle für die Version — STATIC_ASSETS und CACHE_VERSION leiten sich ab
|
||||
const VER = '1230';
|
||||
const VER = '1231';
|
||||
const CACHE_VERSION = `by-v${VER}`;
|
||||
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
||||
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue