Skip to content

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

fix internet is reachable for ios

ammarahm-ed7725274e7985
diff --git a/apps/mobile/src/services/sync.js b/apps/mobile/src/services/sync.js
index 3f29d26e8..e03706604 100644
--- a/apps/mobile/src/services/sync.js
+++ b/apps/mobile/src/services/sync.js
@@ -6,9 +6,15 @@ import { doInBackground } from '../utils';
import { db } from '../utils/database';
import { ToastEvent } from './event-manager';
import { DatabaseLogger } from '../utils/database/index';
+import Navigation from './navigation';
+import { initAfterSync } from '../stores/index';
NetInfo.configure({
- reachabilityUrl: 'https://bing.com'
+ reachabilityUrl: 'https://bing.com',
+ reachabilityTest: response => {
+ if (!response) return false;
+ return response?.status >= 200 && response?.status < 300;
+ }
});
export const ignoredMessages = [
@@ -26,7 +32,7 @@ const run = async (context = 'global', forced = false, full = true) => {
DatabaseLogger.warn('Internet not reachable');
}
if (!user || !status.isInternetReachable) {
- initialize();
+ initAfterSync();
return true;
}
userstore.setSyncing(true);
@@ -45,7 +51,7 @@ const run = async (context = 'global', forced = false, full = true) => {
}
});
if (!res) {
- initialize();
+ initAfterSync();
return false;
}
if (typeof res === 'string') throw error;