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
mobile: sync quick notes only when online
ammarahm-ed15858db21bed
diff --git a/apps/mobile/app/app.js b/apps/mobile/app/app.jsindex ccb5b3440..a9d752706 100644--- a/apps/mobile/app/app.js+++ b/apps/mobile/app/app.js@@ -31,14 +31,6 @@ import { TipManager } from "./services/tip-manager";import { useUserStore } from "./stores/use-user-store";import { View } from "react-native";import { useState } from "react";-import NetInfo from "@react-native-community/netinfo";-NetInfo.configure({- reachabilityUrl: "https://notesnook.com",- reachabilityTest: (response) => {- if (!response) return false;- return response?.status >= 200 && response?.status < 300;- }-});SettingsService.init();SettingsService.checkOrientation();diff --git a/apps/mobile/app/services/notifications.ts b/apps/mobile/app/services/notifications.tsindex a495fe0ff..4d664065b 100644--- a/apps/mobile/app/services/notifications.ts+++ b/apps/mobile/app/services/notifications.ts@@ -45,6 +45,7 @@ import { sleep } from "../utils/time";import { useRelationStore } from "../stores/use-relation-store";import { useReminderStore } from "../stores/use-reminder-store";import { presentDialog } from "../components/dialog/functions";+import NetInfo from "@react-native-community/netinfo";export type Reminder = {id: string;@@ -193,7 +194,7 @@ const onEvent = async ({ type, detail }: Event) => {case "Hide":unpinQuickNote();break;- case "ReplyInput":+ case "ReplyInput": {displayNotification({title: "Quick note",message: 'Tap on "Take note" to add a note.',@@ -211,9 +212,17 @@ const onEvent = async ({ type, detail }: Event) => {data: `<p>${input} </p>`}});- await db.sync(false, false);+ const status = await NetInfo.fetch();+ if (status.isInternetReachable) {+ try {+ await db.sync(false, false);+ } catch (e) {+ console.log(e, (e as Error).stack);+ }+ }useNoteStore.getState().setNotes();break;+ }}}};diff --git a/apps/mobile/native/index.js b/apps/mobile/native/index.jsindex 8713a1370..ec68efd09 100644--- a/apps/mobile/native/index.js+++ b/apps/mobile/native/index.js@@ -7,6 +7,15 @@ import Config from 'react-native-config';import { SafeAreaProvider } from 'react-native-safe-area-context';import appJson from './app.json';import Notifications from "../app/services/notifications";+import NetInfo from "@react-native-community/netinfo";+NetInfo.configure({+ reachabilityUrl: "https://notesnook.com",+ reachabilityTest: (response) => {+ if (!response) return false;+ return response?.status >= 200 && response?.status < 300;+ }+});+Notifications.init();const appName = appJson.name;diff --git a/apps/mobile/share/share.js b/apps/mobile/share/share.jsindex 8b5cc5743..6979696a6 100644--- a/apps/mobile/share/share.js+++ b/apps/mobile/share/share.js@@ -48,6 +48,7 @@ import { eOnLoadNote } from "../app/utils/events";import { Editor } from "./editor";import { Search } from "./search";import { initDatabase, useShareStore } from "./store";+import NetInfo from "@react-native-community/netinfo";const getLinkPreview = (url) => {return getPreviewData(url, 5000);};@@ -355,7 +356,14 @@ const ShareView = ({ quicknote = false }) => {}}}- await db.sync(false, false);+ const status = await NetInfo.fetch();+ if (status.isInternetReachable) {+ try {+ await db.sync(false, false);+ } catch (e) {+ console.log(e, e.stack);+ }+ }await Storage.write("notesAddedFromIntent", "added");close();setLoading(false);