From f2d0a0365167a07e8edb2c447976a11bff063492 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Fri, 1 Mar 2024 22:45:55 +0500 Subject: [PATCH] mobile: enable auto sync --- apps/mobile/app/hooks/use-app-events.tsx | 12 +++++------- apps/mobile/app/services/background-sync.ts | 3 +-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/apps/mobile/app/hooks/use-app-events.tsx b/apps/mobile/app/hooks/use-app-events.tsx index 041e2867f..8f073d674 100644 --- a/apps/mobile/app/hooks/use-app-events.tsx +++ b/apps/mobile/app/hooks/use-app-events.tsx @@ -203,13 +203,11 @@ const onRequestPartialSync = async ( `onRequestPartialSync full:${full}, force:${force}, lastSyncTime:${lastSyncTime}` ); - DatabaseLogger.info("Auto sync is disabled"); - - // if (full || force) { - // await Sync.run("global", force, full, undefined, lastSyncTime); - // } else { - // await Sync.run("global", false, false, undefined, lastSyncTime); - // } + if (full || force) { + await Sync.run("global", force, full, undefined, lastSyncTime); + } else { + await Sync.run("global", false, false, undefined, lastSyncTime); + } }; const onLogout = async (reason: string) => { diff --git a/apps/mobile/app/services/background-sync.ts b/apps/mobile/app/services/background-sync.ts index 084ee11e6..5da6a277a 100644 --- a/apps/mobile/app/services/background-sync.ts +++ b/apps/mobile/app/services/background-sync.ts @@ -114,8 +114,7 @@ async function onBackgroundSyncStarted() { } const user = await db.user?.getUser(); if (user) { - // await db.sync(true, false); - DatabaseLogger.info("BACKGROUND SYNC DISABLED"); + await db.sync(true, false); } await Notifications.setupReminders(); DatabaseLogger.info("BACKGROUND SYNC COMPLETE");