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
fix some issues with intent opening
ammarahm-ed95b86ffbb01e
diff --git a/apps/mobile/App.js b/apps/mobile/App.jsindex d771ac354..eb462b787 100644--- a/apps/mobile/App.js+++ b/apps/mobile/App.js@@ -35,6 +35,11 @@ import {sortSettings} from './src/utils';let firstLoad = true;let note = null;+let prevIntent = {+ text: null,+ weblink: null,+};+const App = () => {const [, dispatch] = useTracked(),[init, setInit] = useState(false),@@ -163,7 +168,6 @@ const App = () => {dispatch({type: Actions.ALL});setInit(true);backupData().then((r) => r);- checkForIntent();setTimeout(() => {if (error) {@@ -171,14 +175,16 @@ const App = () => {ToastEvent.show('Error initializing database.');}SplashScreen.hide();+ checkForIntent();}, 500);});}, []);const checkForIntent = () => {+ console.log('check for intent called');ReceiveSharingIntent.getReceivedFiles((d) => {- console.log(d, 'DATA');+ console.log(d,"DATA");let data = d[0];if (data.text || data.weblink) {let text = data.text;@@ -186,15 +192,19 @@ const App = () => {let delta = null;if (weblink && text) {- delta = {ops: [{insert: `${data.text + ' ' + data.weblink}`}]};+ delta = {ops: [{insert: `${text + ' ' + weblink}`}]};text = data.text + ' ' + data.weblink;} else if (text && !weblink) {- delta = {ops: [{insert: `${data.text}`}]};+ delta = {ops: [{insert: `${text}`}]};text = data.text;} else if (weblink) {- delta = {ops: [{insert: `${data.weblink}`}]};- text = data.weblink;+ console.log('putting link')+ delta = {ops: [{insert: `${weblink}`}]};+ text = weblink}+ console.log(text,weblink,"HERE SHOWING",delta);+ prevIntent.text = text;+ prevIntent.weblink = weblink;eSendEvent(eOnLoadNote, {type: 'intent',data: delta,diff --git a/apps/mobile/src/views/Editor/Functions.js b/apps/mobile/src/views/Editor/Functions.jsindex 311a61654..206515d71 100644--- a/apps/mobile/src/views/Editor/Functions.js+++ b/apps/mobile/src/views/Editor/Functions.js@@ -30,6 +30,8 @@ let title = null;let saveCounter = 0;let canSave = false;let timer = null;+let webviewInit = false;+let intent = false;export function isNotedEdited() {return noteEdited;@@ -121,12 +123,14 @@ export async function loadNote(item) {clearNote();canSave = true;id = null;+ intent = true;content = {delta: item.data,text: item.text,};- post('delta', content.delta);- await saveNote();+ if (webviewInit) {+ await loadNoteInEditor();+ }} else {await setNote(item);canSave = false;@@ -305,27 +309,29 @@ export async function saveNote() {export async function onWebViewLoad(noMenu, premium, colors) {EditorWebView.current?.injectJavaScript(INJECTED_JAVASCRIPT(premium, false));-- await loadNoteInEditor();if (!checkNote()) {post('blur');Platform.OS === 'android' ? EditorWebView.current?.requestFocus() : null;}post('blur');-await sleep(1000);let theme = {...colors, factor: normalize(1)};post('theme', theme);+ await loadNoteInEditor();+ webviewInit = true;}const loadNoteInEditor = async () => {saveCounter = 0;- if (note?.id) {+ if (intent) {+ await saveNote();+ intent = false;+ post('delta', content.delta);+ } else if (note?.id) {post('dateEdited', timeConverter(note.dateEdited));await sleep(50);post('title', title);post('delta', content.delta);- console.log(content.delta);} else {post('focusTitle');}