fix auto backups not working

This commit is contained in:
ammarahm-ed
2022-07-26 14:56:54 +05:00
parent 6de384db28
commit e364315bfa
2 changed files with 6 additions and 8 deletions

View File

@@ -117,7 +117,7 @@ const Launcher = React.memo(
if (SettingsService.get().reminder === 'off') {
SettingsService.set({ reminder: 'daily' });
}
if (BackupService.checkBackupRequired()) {
if (await BackupService.checkBackupRequired(SettingsService.get().reminder)) {
sleep(2000).then(() => BackupService.run());
}
}

View File

@@ -210,20 +210,18 @@ async function checkBackupRequired(type) {
return true;
}
lastBackupDate = parseInt(lastBackupDate);
if (type === 'daily' && lastBackupDate + MS_DAY < now) {
console.log('daily');
console.log('daily backup started');
return true;
} else if (type === 'weekly' && lastBackupDate + MS_WEEK < now) {
console.log('weekly');
console.log('weekly backup started');
return true;
} else if (type === 'monthly' && lastBackupDate + MONTH < now) {
console.log('monthly');
console.log('monthly backup started');
return true;
} else {
console.log('no need', lastBackupDate);
return false;
}
console.log('no need', lastBackupDate);
return false;
}
const checkAndRun = async () => {