android: enable offline sync and hide theme toggle in Tauri app
All checks were successful
CI / update (push) Successful in 2m2s
All checks were successful
CI / update (push) Successful in 2m2s
Detect Tauri via __TAURI__ in pwaStore so the offline recipe sync, image caching, and auto-sync activate in the Android shell.
This commit is contained in:
@@ -30,10 +30,13 @@ function createPWAStore() {
|
|||||||
|
|
||||||
let autoSyncInterval: ReturnType<typeof setInterval> | null = null;
|
let autoSyncInterval: ReturnType<typeof setInterval> | null = null;
|
||||||
|
|
||||||
// Check if running as installed PWA (standalone mode)
|
// Check if running as installed PWA or Tauri app
|
||||||
function checkStandaloneMode(): boolean {
|
function checkStandaloneMode(): boolean {
|
||||||
if (!browser) return false;
|
if (!browser) return false;
|
||||||
|
|
||||||
|
// Check Tauri Android shell
|
||||||
|
if ('__TAURI__' in window) return true;
|
||||||
|
|
||||||
// Check display-mode media query (works on most browsers)
|
// Check display-mode media query (works on most browsers)
|
||||||
const standaloneQuery = window.matchMedia('(display-mode: standalone)');
|
const standaloneQuery = window.matchMedia('(display-mode: standalone)');
|
||||||
if (standaloneQuery.matches) return true;
|
if (standaloneQuery.matches) return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user