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
allow syncing to be forced
ammarahm-edf625f622b1d1
diff --git a/apps/mobile/AppRootEvents.js b/apps/mobile/AppRootEvents.jsindex 8af52c38d..a13e8183a 100644--- a/apps/mobile/AppRootEvents.js+++ b/apps/mobile/AppRootEvents.js@@ -145,14 +145,7 @@ export const AppRootEvents = React.memo(const onSessionExpired = async () => {await Storage.write('loginSessionHasExpired', 'expired');- return new Promise((res, rej) => {- eSendEvent(eOpenLoginDialog, 4);- let onsuccess = () => {- res({result: true});- eUnSubscribeEvent('reLoginSuccess', onsuccess);- };- eSubscribeEvent('reLoginSuccess', onsuccess);- });+ eSendEvent(eOpenLoginDialog, 4);};const onNoteRemoved = async id => {diff --git a/apps/mobile/src/components/LoginDialog/index.js b/apps/mobile/src/components/LoginDialog/index.jsindex 28095e6f7..7b04d84b1 100644--- a/apps/mobile/src/components/LoginDialog/index.js+++ b/apps/mobile/src/components/LoginDialog/index.js@@ -179,11 +179,6 @@ const LoginDialog = () => {MMKV.getItem('loginSessionHasExpired').then(r => {if (r === 'expired') {open(MODES.sessionExpired);- let onsuccess = () => {- eSendEvent('userLoggedIn');- eUnSubscribeEvent('reLoginSuccess', onsuccess);- };- eSubscribeEvent('reLoginSuccess', onsuccess);}});eSubscribeEvent(eOpenLoginDialog, open);@@ -250,18 +245,16 @@ const LoginDialog = () => {context: 'local',});close();- if (MODES.sessionExpired !== mode) {- await sleep(300);- eSendEvent('userLoggedIn', true);- eSendEvent(eOpenProgressDialog, {- title: 'Syncing your data',- paragraph: 'Please wait while we sync all your data.',- noProgress: false,- });- } else {+ if (MODES.sessionExpired === mode) {await MMKV.removeItem('loginSessionHasExpired');- eSendEvent('reLoginSuccess');}+ await sleep(300);+ eSendEvent('userLoggedIn', true);+ eSendEvent(eOpenProgressDialog, {+ title: 'Syncing your data',+ paragraph: 'Please wait while we sync all your data.',+ noProgress: false,+ });} catch (e) {setLoading(false);setStatus(null);diff --git a/apps/mobile/src/services/Sync.js b/apps/mobile/src/services/Sync.jsindex 1866d1a29..f0200686b 100644--- a/apps/mobile/src/services/Sync.js+++ b/apps/mobile/src/services/Sync.js@@ -5,7 +5,7 @@ import {db} from '../utils/DB';import {eOpenLoginDialog} from '../utils/Events';import {eSendEvent, ToastEvent} from './EventManager';-const run = async (context = 'global') => {+const run = async (context = 'global',forced) => {updateEvent({type: Actions.SYNCING,syncing: true,@@ -14,7 +14,7 @@ const run = async (context = 'global') => {try {let res = await doInBackground(async () => {try {- await db.sync();+ await db.sync(true,forced);return true;} catch (e) {return e.message;diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.jsindex 3b0ef5069..f19f3c297 100644--- a/apps/mobile/src/views/Settings/index.js+++ b/apps/mobile/src/views/Settings/index.js@@ -41,6 +41,7 @@ import {import Navigation from '../../services/Navigation';import PremiumService from '../../services/PremiumService';import SettingsService from '../../services/SettingsService';+import Sync from '../../services/Sync';import {AndroidModule,APP_VERSION,@@ -839,7 +840,7 @@ const SettingsUserSection = () => {</View>{[{- name: 'Save Data Recovery Key',+ name: 'Save data recovery key',func: async () => {if (BiometricService.isBiometryAvailable() === false) {eSendEvent(eOpenRecoveryKeyDialog);@@ -857,12 +858,20 @@ const SettingsUserSection = () => {'Recover your data using the recovery key if your password is lost.',},{- name: 'Change Password',+ name: 'Change password',func: async () => {eSendEvent(eOpenLoginDialog, 3);},desc: 'Setup a new password for your account.',},+ {+ name: 'Having problems with syncing?',+ func: async () => {+ await Sync.run("global",true);+ },+ desc: 'Try force sync to resolve errors with syncing.',+ },+].map(item => (<CustomButtonkey={item.name}