Offline-Karten Follow-ups: Staging-Default AN, Karten-Download-Button, Glyph-Persistenz

- by_offline_tiles Default AN auf staging.banyaro.app (localStorage/?tilesoffline=1/0 uebersteuert)
- Speed-Dial 'Karte offline speichern': GL -> MapOffline.downloadAround(Kartenmitte, 5km),
  Leaflet -> alter Raster-Prefetch (_cacheTiles war seit FAB-Redesign verwaist)
- Glyphs in IndexedDB (Key-Praefix f/) + byt://f/-Protokoll: ueberlebt App-Updates
- OSM-Raster-Prefetch im Offline-Tiles-Modus uebersprungen (GL nutzt das Raster nicht)
- Button-Sichtbarkeit gated: GL ohne Offline-Flag (= Production) zeigt ihn nicht
This commit is contained in:
rene 2026-06-06 11:03:46 +02:00
parent 30e82b7931
commit 70a1f5856a
5 changed files with 109 additions and 16 deletions

View file

@ -12,10 +12,16 @@
var TILES_VER = '20260605';
function tilesUrl() { return window.location.origin + '/tiles/' + TILES_FILE + '?v=' + TILES_VER; }
// Offline-Tiles-Modus (byt://-Quelle). Opt-in via localStorage by_offline_tiles='1' bzw. ?tilesoffline=1.
// Default AUS, bis auf Gerät verifiziert — dann hier auf Staging-Default umstellen (analog by_map_gl).
// Offline-Tiles-Modus (byt://-Quelle). localStorage by_offline_tiles bzw. ?tilesoffline=1/0 übersteuert.
// Staging-Default AN seit 2026-06-06 (Gerätetest); Production bleibt AUS bis Freigabe (dann analog by_map_gl).
// ACHTUNG: Default-Logik synchron halten mit offline-indicator.js _offlineTilesMode().
function _offlineEnabled() {
try { return localStorage.getItem('by_offline_tiles') === '1'; } catch (e) { return false; }
try {
var flag = localStorage.getItem('by_offline_tiles');
if (flag === '1') return true;
if (flag === '0') return false;
return location.hostname === 'staging.banyaro.app';
} catch (e) { return false; }
}
var THEMES = {
@ -52,7 +58,11 @@
: { type: 'vector', url: 'pmtiles://' + tilesUrl() };
return {
version: 8,
glyphs: window.location.origin + '/fonts/{fontstack}/{range}.pbf',
// Offline-Modus: Glyphs übers byt://f/-Protokoll (IndexedDB-first, remote-Fallback) —
// der SW-Cache für /fonts wird bei App-Updates gepurged, IndexedDB nicht.
glyphs: useOffline
? 'byt://f/{fontstack}/{range}'
: window.location.origin + '/fonts/{fontstack}/{range}.pbf',
sources: {
by: src,
},