Skip to content

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

add monthly backup option

ammarahm-ed49e285b380d5
diff --git a/apps/mobile/src/services/Backup.js b/apps/mobile/src/services/Backup.js
index c0a532df0..f0bc37ceb 100644
--- a/apps/mobile/src/services/Backup.js
+++ b/apps/mobile/src/services/Backup.js
@@ -13,6 +13,7 @@ import SettingsService from './SettingsService';
const MS_DAY = 86400000;
const MS_WEEK = MS_DAY * 7;
+const MONTH = MS_DAY * 30;
async function getDirectoryAndroid() {
let folder = await ScopedStorage.openDocumentTree(true);
@@ -30,7 +31,7 @@ async function getDirectoryAndroid() {
return subfolder;
}
-async function checkBackupDirExists(reset=false) {
+async function checkBackupDirExists(reset = false) {
if (Platform.OS === 'ios') return true;
let dir = await MMKV.getItem('backupStorageDir');
if (reset) dir = null;
@@ -52,7 +53,7 @@ async function checkBackupDirExists(reset=false) {
presentDialog({
title: 'Select backup folder',
paragraph:
- 'Daily backups are turned on. Please select a folder where you would like to store backup files. You can change or disable automatic backups in settings however we highly recommend that you keep them on.',
+ 'Please select a folder where you would like to store backup files. You can change or disable automatic backups in settings however we highly recommend that you keep them on.',
positivePress: async () => {
resolve(await getDirectoryAndroid());
},
@@ -186,6 +187,9 @@ async function checkBackupRequired(type) {
} else if (type === 'weekly' && lastBackupDate + MS_WEEK < now) {
console.log('weekly');
return true;
+ } else if (type === 'monthly' && lastBackupDate + MONTH < now) {
+ console.log('monthly');
+ return true;
} else {
console.log('no need', lastBackupDate);
return false;
@@ -208,6 +212,5 @@ export default {
run,
checkAndRun,
getDirectoryAndroid,
- checkBackupDirExists,
-
+ checkBackupDirExists
};