Fix: Offline-UX — 📡 statt 🚧 bei offline-Seiten, schnellerer Warm-up, mehr Endpoints gecacht (SW by-v989)
This commit is contained in:
parent
8ad3ca8a74
commit
f0c1ee3386
4 changed files with 26 additions and 16 deletions
|
|
@ -3,7 +3,7 @@
|
|||
Router, State-Management, Navigation, Initialisierung.
|
||||
============================================================ */
|
||||
|
||||
const APP_VER = '988'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VER = '989'; // ← 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
|
||||
|
|
@ -266,10 +266,13 @@ const App = (() => {
|
|||
page.module = {}; // verhindert erneutes Laden
|
||||
}
|
||||
} catch {
|
||||
const _offline = !navigator.onLine;
|
||||
container.innerHTML = UI.emptyState({
|
||||
icon: '🚧',
|
||||
icon: _offline ? '📡' : '🚧',
|
||||
title: pages[pageId].title,
|
||||
text: 'Diese Seite ist noch in Entwicklung.',
|
||||
text: _offline
|
||||
? 'Diese Seite ist offline nicht verfügbar. Bitte öffne sie einmal mit Internetverbindung, damit sie gecacht wird.'
|
||||
: 'Diese Seite ist noch in Entwicklung.',
|
||||
});
|
||||
page.module = {};
|
||||
} finally {
|
||||
|
|
@ -1141,17 +1144,19 @@ const App = (() => {
|
|||
window.App = App; // Worlds kann App.navigate() aufrufen
|
||||
|
||||
// App starten
|
||||
// Prioritäts-Seiten im Hintergrund vorladen (3s nach Start, damit Hauptinhalt nicht blockiert)
|
||||
// Prioritäts-Seiten im Hintergrund vorladen (1s nach Start)
|
||||
window.addEventListener('load', () => {
|
||||
setTimeout(() => {
|
||||
if (!('caches' in window)) return;
|
||||
['admin','erste-hilfe','diary','map','walks','routes','poison','lost'].forEach(page => {
|
||||
if (!navigator.onLine) return;
|
||||
// Page-Scripts cachen
|
||||
[
|
||||
'admin','erste-hilfe','diary','map','walks','routes','poison','lost',
|
||||
'expenses','wetter','forum','health','uebungen','trainingsplaene','notes',
|
||||
].forEach(page => {
|
||||
const key = `Page_${page.replace(/-/g,'_')}`;
|
||||
if (!window[key]) {
|
||||
fetch(`/js/pages/${page}.js?v=${APP_VER}`).catch(() => {});
|
||||
}
|
||||
if (!window[key]) fetch(`/js/pages/${page}.js?v=${APP_VER}`).catch(() => {});
|
||||
});
|
||||
}, 3000);
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
|
|
|||
|
|
@ -668,7 +668,8 @@ window.Page_routes = (() => {
|
|||
if (!_appState.user) { UI.toast.warning('Bitte anmelden.'); return; }
|
||||
if (_recOvl) return;
|
||||
|
||||
await UI.loadLeaflet?.() ?? Promise.resolve();
|
||||
try { await (UI.loadLeaflet?.() ?? Promise.resolve()); }
|
||||
catch { UI.toast.warning('Karte offline nicht verfügbar — GPS-Aufzeichnung läuft trotzdem.'); }
|
||||
|
||||
const ovl = document.createElement('div');
|
||||
ovl.id = 'rk-rec-ovl';
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Offline-Cache + Push Notifications + Tile-Cache
|
||||
============================================================ */
|
||||
|
||||
const CACHE_VERSION = 'by-v988';
|
||||
const CACHE_VERSION = 'by-v989';
|
||||
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
|
||||
|
|
@ -140,10 +140,14 @@ const _CACHEABLE_GET = [
|
|||
/^\/api\/training\/plan-progress/,
|
||||
/^\/api\/wiki\/rassen/,
|
||||
/^\/api\/dogs\/\d+\/diary\/stats/,
|
||||
/^\/api\/routes$/,
|
||||
/^\/api\/places$/,
|
||||
/^\/api\/breeder\/map-markers$/,
|
||||
/^\/api\/routes/,
|
||||
/^\/api\/places/,
|
||||
/^\/api\/breeder\/map-markers/,
|
||||
/^\/api\/gassi-zeiten/,
|
||||
/^\/api\/poison/,
|
||||
/^\/api\/walks/,
|
||||
/^\/api\/lost/,
|
||||
/^\/api\/expenses/,
|
||||
// Drei Welten — offline-fähig
|
||||
/^\/api\/streak\/\d+/,
|
||||
/^\/api\/forum\/threads/,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue