Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: run sync based on lastSyncTime

ammarahm-ed30341bea1c94
diff --git a/apps/mobile/app/components/sheets/progress/index.tsx b/apps/mobile/app/components/sheets/progress/index.tsx
index 839e2d00f..d6b44c489 100644
--- a/apps/mobile/app/components/sheets/progress/index.tsx
+++ b/apps/mobile/app/components/sheets/progress/index.tsx
@@ -64,7 +64,7 @@ export const Progress = () => {
width={null}
animated={true}
useNativeDriver
- progress={currentProgress || 0.1}
+ indeterminate
unfilledColor={colors.secondary.background}
color={colors.primary.accent}
borderWidth={0}
@@ -74,7 +74,7 @@ export const Progress = () => {
{progress ? (
<Paragraph color={colors.secondary.paragraph}>
{progress.type?.slice(0, 1).toUpperCase() + progress.type?.slice(1)}
- ing {progress?.current}/{progress?.total}
+ ing {progress?.current}
</Paragraph>
) : null}
</View>
diff --git a/apps/mobile/app/components/side-menu/user-status.js b/apps/mobile/app/components/side-menu/user-status.js
index 6ef28b276..5a1cb3f01 100644
--- a/apps/mobile/app/components/side-menu/user-status.js
+++ b/apps/mobile/app/components/side-menu/user-status.js
@@ -135,7 +135,7 @@ export const UserStatus = () => {
? "Last sync failed, tap to try again"
: syncing
? `Syncing your notes${
- progress ? ` (${progress.current}/${progress.total})` : ""
+ progress ? ` (${progress.current})` : ""
}`
: "Tap here to sync your notes."}
</Paragraph>
diff --git a/apps/mobile/app/hooks/use-app-events.js b/apps/mobile/app/hooks/use-app-events.js
index 22ac94e8d..23e9df912 100644
--- a/apps/mobile/app/hooks/use-app-events.js
+++ b/apps/mobile/app/hooks/use-app-events.js
@@ -167,13 +167,15 @@ const onUserSubscriptionStatusChanged = async (userStatus) => {
useMessageStore.getState().setAnnouncement();
};
-const onRequestPartialSync = async (full, force) => {
+const onRequestPartialSync = async (full, force, lastSyncTime) => {
if (SettingsService.get().disableAutoSync) return;
- DatabaseLogger.info(`onRequestPartialSync full:${full}, force:${force}`);
+ DatabaseLogger.info(
+ `onRequestPartialSync full:${full}, force:${force}, lastSyncTime:${lastSyncTime}`
+ );
if (full || force) {
- await Sync.run("global", force, full);
+ await Sync.run("global", force, full, undefined, lastSyncTime);
} else {
- await Sync.run("global", false, false);
+ await Sync.run("global", false, false, undefined, lastSyncTime);
}
};
@@ -253,7 +255,6 @@ export const useAppEvents = () => {
]);
const syncedOnLaunch = useRef(false);
- const { isDark } = useThemeColors();
const refValues = useRef({
subsriptionSuccessListener: null,
subsriptionErrorListener: null,
diff --git a/apps/mobile/app/services/sync.js b/apps/mobile/app/services/sync.js
index 15d3d5aa2..3971c0e41 100644
--- a/apps/mobile/app/services/sync.js
+++ b/apps/mobile/app/services/sync.js
@@ -39,7 +39,8 @@ const run = async (
context = "global",
forced = false,
full = true,
- onCompleted
+ onCompleted,
+ lastSyncTime
) => {
if (useUserStore.getState().syncing) {
DatabaseLogger.log("Sync in progress");
@@ -68,7 +69,7 @@ const run = async (
try {
let res = await BackgroundSync.doInBackground(async () => {
try {
- await db.sync(full, forced);
+ await db.sync(full, forced, lastSyncTime);
return true;
} catch (e) {
error = e;