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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user