Fix: theme-color JS-Fallback für Samsung, Wischgesten-Tipp in Settings, _syncThemeColor bei init (SW by-v811)
This commit is contained in:
parent
480a343ec0
commit
1fdd7d4ed0
5 changed files with 25 additions and 14 deletions
|
|
@ -3,7 +3,7 @@
|
|||
Router, State-Management, Navigation, Initialisierung.
|
||||
============================================================ */
|
||||
|
||||
const APP_VER = '810'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VER = '811'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VERSION = '1.5.0'; // ← semantische Version, wird bei make release gesetzt
|
||||
const IS_STAGING = location.hostname === 'staging.banyaro.app';
|
||||
// Cache-Bust-Parameter nach Update-Reload sofort entfernen
|
||||
|
|
@ -612,11 +612,21 @@ const App = (() => {
|
|||
|
||||
function _applyUserTheme(user) {
|
||||
const theme = user?.preferred_theme;
|
||||
if (!theme || theme === 'system') return; // System-Einstellung: nichts tun
|
||||
if (!theme || theme === 'system') { _syncThemeColor(); return; }
|
||||
localStorage.setItem('by_theme', theme);
|
||||
const html = document.documentElement;
|
||||
if (theme === 'dark') html.setAttribute('data-theme', 'dark');
|
||||
else if (theme === 'light') html.setAttribute('data-theme', 'light');
|
||||
_syncThemeColor();
|
||||
}
|
||||
|
||||
function _syncThemeColor() {
|
||||
// Fallback für Browser die media-Queries auf theme-color meta nicht unterstützen (Samsung)
|
||||
const isDark = document.documentElement.getAttribute('data-theme') === 'dark'
|
||||
|| (window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
&& document.documentElement.getAttribute('data-theme') !== 'light');
|
||||
const color = isDark ? '#0f1623' : '#C4843A';
|
||||
document.querySelector('meta[name="theme-color"]')?.setAttribute('content', color);
|
||||
}
|
||||
|
||||
function _showVerifyBanner() {
|
||||
|
|
@ -857,6 +867,7 @@ const App = (() => {
|
|||
// INITIALISIERUNG
|
||||
// ----------------------------------------------------------
|
||||
async function init() {
|
||||
_syncThemeColor(); // Statusleisten-Farbe sofort setzen
|
||||
// Spezielle Hash-Parameter → in App bleiben (kein /info-Redirect)
|
||||
const _rawHash = location.hash.replace('#', '');
|
||||
const _hashQuery = _rawHash.split('?')[1] || '';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue