mirror of
https://github.com/MadeBaruna/paimon-moe.git
synced 2025-03-23 23:29:35 +01:00
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
This commit is contained in:
parent
2c10c11dee
commit
a47cc7b480
1 changed files with 5 additions and 1 deletions
|
@ -201,8 +201,12 @@
|
||||||
const localSave = await getLocalSaveJson();
|
const localSave = await getLocalSaveJson();
|
||||||
const localSize = new Blob([localSave]).size / 1000;
|
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]);
|
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!');
|
console.log('DRIVE SYNC CONFLICT!');
|
||||||
openModal(
|
openModal(
|
||||||
SyncConflictModal,
|
SyncConflictModal,
|
||||||
|
|
Loading…
Add table
Reference in a new issue