this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Attempt to fix theme-color bug

+26
+26
src/app.jsx
··· 187 187 // ); 188 188 })(); 189 189 190 + // Possible fix for iOS PWA theme-color bug 191 + // It changes when loading web pages in "webview" 192 + const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent); 193 + if (isIOS) { 194 + document.addEventListener('visibilitychange', () => { 195 + if (document.visibilityState === 'visible') { 196 + // Get current color scheme 197 + const colorScheme = window.matchMedia('(prefers-color-scheme: dark)') 198 + .matches 199 + ? 'dark' 200 + : 'light'; 201 + // Get current theme-color 202 + const $meta = document.querySelector( 203 + `meta[name="theme-color"][media*="${colorScheme}"]`, 204 + ); 205 + const color = $meta?.getAttribute('content'); 206 + if (color) { 207 + $meta.content = ''; 208 + setTimeout(() => { 209 + $meta.content = color; 210 + }, 10); 211 + } 212 + } 213 + }); 214 + } 215 + 190 216 subscribe(states, (changes) => { 191 217 for (const [action, path, value, prevValue] of changes) { 192 218 // Change #app dataset based on settings.shortcutsViewMode