A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
Check for backups after user has been fetched
ammarahm-edd8f5f3b11e0d
diff --git a/apps/mobile/src/components/AppLoader/index.js b/apps/mobile/src/components/AppLoader/index.jsindex aedfa574c..6e0a6832a 100644--- a/apps/mobile/src/components/AppLoader/index.js+++ b/apps/mobile/src/components/AppLoader/index.js@@ -105,12 +105,6 @@ const AppLoader = ({ onLoad }) => {}if (await checkAppUpdateAvailable()) return;-- let settingsStore = useSettingStore.getState();- if (await Backup.checkBackupRequired(settingsStore.settings.reminder)) {- await Backup.checkAndRun();- return;- }if (await checkForRateAppRequest()) return;if (await checkNeedsBackup()) return;if (await PremiumService.getRemainingTrialDaysStatus()) return;diff --git a/apps/mobile/src/components/GeneralSheet/index.js b/apps/mobile/src/components/GeneralSheet/index.jsindex c9bb5e765..bc8d540af 100644--- a/apps/mobile/src/components/GeneralSheet/index.js+++ b/apps/mobile/src/components/GeneralSheet/index.js@@ -44,7 +44,6 @@ const GeneralSheet = ({ context = 'global' }) => {}setDialogData(data);setVisible(true);- console.log('calling open now');if (data.editor) {editor.current.refocus = false;if (editing.keyboardState) {diff --git a/apps/mobile/src/services/Backup.js b/apps/mobile/src/services/Backup.jsindex 09ea8aaeb..679590b69 100644--- a/apps/mobile/src/services/Backup.js+++ b/apps/mobile/src/services/Backup.js@@ -1,4 +1,5 @@const { MMKV } = require('../utils/MMKV');+import Clipboard from '@react-native-clipboard/clipboard';import { Platform } from 'react-native';import FileViewer from 'react-native-file-viewer';import * as ScopedStorage from 'react-native-scoped-storage';@@ -79,8 +80,9 @@ async function run() {let error;try {backup = await db.backup.export('mobile', SettingsService.get().encryptedBackup);+ if (!backup) throw new Error(`Backup returned empty.`);} catch (e) {- error = true;+ error = e;}if (!error) {@@ -155,7 +157,16 @@ async function run() {heading: 'Backup failed',message: e.message,type: 'error',- context: 'global'+ context: 'global',+ actionText: 'Copy logs',+ func: () => {+ Clipboard.setString(e.stack);+ ToastEvent.show({+ heading: 'Logs copied!',+ type: 'success',+ context: 'global'+ });+ }});}} else {@@ -163,8 +174,18 @@ async function run() {eSendEvent(eCloseProgressDialog);ToastEvent.show({heading: 'Backup failed',+ message: error?.message || '',type: 'error',- context: 'global'+ context: 'global',+ actionText: 'Copy logs',+ func: () => {+ Clipboard.setString(error.stack);+ ToastEvent.show({+ heading: 'Logs copied!',+ type: 'success',+ context: 'global'+ });+ }});return null;diff --git a/apps/mobile/src/services/Sync.js b/apps/mobile/src/services/Sync.jsindex 763ff756b..60c4c4051 100644--- a/apps/mobile/src/services/Sync.js+++ b/apps/mobile/src/services/Sync.js@@ -43,7 +43,7 @@ const run = async (context = 'global', forced) => {heading: 'Sync failed',message: e.message,context: context,- actionText: 'Copy log',+ actionText: 'Copy logs',func: () => {if (errorStack) {Clipboard.setString(errorStack);diff --git a/apps/mobile/src/utils/useAppEvents.js b/apps/mobile/src/utils/useAppEvents.jsindex ddf1b9a45..31a49bfe2 100644--- a/apps/mobile/src/utils/useAppEvents.js+++ b/apps/mobile/src/utils/useAppEvents.js@@ -383,6 +383,8 @@ export const useAppEvents = () => {if (PremiumService.get() && user) {if (SettingsService.get().reminder === 'off') {await SettingsService.set('reminder', 'daily');+ }+ if (Backup.checkBackupRequired()) {sleep(2000).then(() => Backup.checkAndRun());}}