feat: auto-sync recipes and show sync button only in PWA mode

- Auto-sync recipes every 30 minutes when online in PWA mode
- Only show offline sync button when running as installed PWA
- Detect standalone mode via display-mode media query and iOS check
- Trigger initial sync on PWA install (appinstalled event)
- Listen for online event to sync when coming back online
- Store last sync time in localStorage to track sync intervals
This commit is contained in:
2026-01-29 09:58:01 +01:00
parent c86a734da0
commit 86f28fa1b7
2 changed files with 137 additions and 4 deletions

View File

@@ -19,7 +19,8 @@
onMount(async () => {
mounted = true;
await pwaStore.checkAvailability();
// Initialize PWA store (checks standalone mode, starts auto-sync if needed)
await pwaStore.initialize();
});
async function handleSync() {
@@ -147,7 +148,7 @@
}
</style>
{#if mounted}
{#if mounted && pwaStore.isStandalone}
<div class="offline-sync">
<button
class="sync-button"