From a47cc7b480ea6924b048d0fe073c2e32c84532aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= <17336611+fdeblic@users.noreply.github.com> Date: Mon, 19 Feb 2024 14:03:10 +0100 Subject: [PATCH] Update compareLocalSave(): ignore sync conflict if only locale present Problem: there's always a Google Drive sync conflict modal opening when connecting because the user's locale is saved from the start Solution implemented: if the local save only consists of the user's locale, ignores the sync conflict --- src/components/DataSync.svelte | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/DataSync.svelte b/src/components/DataSync.svelte index 716c98ac6..b8be0b0f0 100644 --- a/src/components/DataSync.svelte +++ b/src/components/DataSync.svelte @@ -201,8 +201,12 @@ const localSave = await getLocalSaveJson(); const localSize = new Blob([localSave]).size / 1000; + const negligibleKeys = ['converted', 'locale']; + const localSaveKeys = Object.keys(JSON.parse(localSave)); + const isLocalSaveNegligible = localSaveKeys.every(key => negligibleKeys.includes(key)); + const remoteTime = dayjs(data[UPDATE_TIME_KEY]); - if ($updateTime !== null && remoteTime.diff($updateTime) !== 0) { + if ($updateTime !== null && !isLocalSaveNegligible && remoteTime.diff($updateTime) !== 0) { console.log('DRIVE SYNC CONFLICT!'); openModal( SyncConflictModal,