From 902e6b8602537900a63fff53e8bb2c9434f1e7f5 Mon Sep 17 00:00:00 2001 From: rene Date: Fri, 15 May 2026 18:28:50 +0200 Subject: [PATCH] Feature: Einmaliger Offline-Hinweis 'App im Vordergrund lassen' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Beim ersten offline-Event pro Session erscheint ein blauer Info-Toast (8s): 'App im Vordergrund lassen — so bleiben Offline-Funktionen wie GPS und Datenspeicherung aktiv.' sessionStorage-Guard verhindert Wiederholung. SW by-v997, APP_VER 997 --- backend/main.py | 2 +- backend/static/index.html | 10 ++++++++++ backend/static/js/app.js | 2 +- backend/static/js/pages/routes.js | 1 + backend/static/sw.js | 2 +- 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/backend/main.py b/backend/main.py index 624a637..57280f3 100644 --- a/backend/main.py +++ b/backend/main.py @@ -410,7 +410,7 @@ async def serve_media(path: str, request: _Request): raise _HE(404, "Nicht gefunden.") return _media_response(filepath) -APP_VER = "996" # muss mit APP_VER in app.js übereinstimmen +APP_VER = "997" # muss mit APP_VER in app.js übereinstimmen @app.get("/.well-known/assetlinks.json") async def assetlinks(): diff --git a/backend/static/index.html b/backend/static/index.html index c829570..c6653b5 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -625,6 +625,16 @@ } window.addEventListener('offline', function() { _updateBanner(); + // Einmaliger Hinweis pro Session: App im Vordergrund lassen + if (!sessionStorage.getItem('by_offline_hint_shown')) { + sessionStorage.setItem('by_offline_hint_shown', '1'); + setTimeout(function() { + window.UI?.toast?.info( + 'App im Vordergrund lassen — so bleiben Offline-Funktionen wie GPS und Datenspeicherung aktiv.', + 8000 + ); + }, 800); + } // Queue-Count abfragen if (navigator.serviceWorker) { navigator.serviceWorker.ready.then(function(reg) { diff --git a/backend/static/js/app.js b/backend/static/js/app.js index 5e5a60e..d4a02cb 100644 --- a/backend/static/js/app.js +++ b/backend/static/js/app.js @@ -3,7 +3,7 @@ Router, State-Management, Navigation, Initialisierung. ============================================================ */ -const APP_VER = '996'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '997'; // ← 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 diff --git a/backend/static/js/pages/routes.js b/backend/static/js/pages/routes.js index 7ccce1a..b09e4fb 100644 --- a/backend/static/js/pages/routes.js +++ b/backend/static/js/pages/routes.js @@ -780,6 +780,7 @@ window.Page_routes = (() => { setTimeout(() => banner.remove(), 9000); } + const ctrl = document.getElementById('rk-rec-ctrl'); ctrl.innerHTML = `