mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-24 15:39:44 +01:00
Merge branch 'develop' of https://github.com/streetwriters/notesnook-mobile into develop
This commit is contained in:
@@ -271,11 +271,6 @@ const ShareView = ({ quicknote = false }) => {
|
||||
setLoadingExtension(false);
|
||||
loadData();
|
||||
useShareStore.getState().restoreAppendNote();
|
||||
sleep(50).then(() => {
|
||||
sleep(500).then(r => {
|
||||
Storage.write('shareExtensionOpened', 'opened');
|
||||
});
|
||||
});
|
||||
})();
|
||||
}, []);
|
||||
|
||||
@@ -291,7 +286,10 @@ const ShareView = ({ quicknote = false }) => {
|
||||
};
|
||||
|
||||
const onLoad = editor => {
|
||||
if (editor) return loadData();
|
||||
if (editor) {
|
||||
Storage.write('shareExtensionOpened', 'opened');
|
||||
return loadData();
|
||||
}
|
||||
eSendEvent(eOnLoadNote + 'shareEditor', {
|
||||
id: null,
|
||||
content: {
|
||||
|
||||
@@ -154,9 +154,6 @@ export const TabsHolder = React.memo(
|
||||
}, 2500);
|
||||
} else {
|
||||
setDeviceMode('mobile', size);
|
||||
setTimeout(() => {
|
||||
tabBarRef.current?.closeDrawer();
|
||||
}, 2500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import { Platform, ViewStyle } from 'react-native';
|
||||
import WebView from 'react-native-webview';
|
||||
import { ShouldStartLoadRequest } from 'react-native-webview/lib/WebViewTypes';
|
||||
import { notesnook } from '../../../e2e/test.ids';
|
||||
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/event-manager';
|
||||
import { useEditorStore } from '../../stores/use-editor-store';
|
||||
import { getElevation } from '../../utils';
|
||||
import { db } from '../../utils/database';
|
||||
@@ -84,8 +85,10 @@ const Editor = React.memo(
|
||||
|
||||
useEffect(() => {
|
||||
onLoad && onLoad();
|
||||
eSubscribeEvent('webview_reset', onError);
|
||||
EV.subscribe(EVENTS.mediaAttachmentDownloaded, onMediaDownloaded);
|
||||
return () => {
|
||||
eUnSubscribeEvent('webview_reset', onError);
|
||||
EV.unsubscribe(EVENTS.mediaAttachmentDownloaded, onMediaDownloaded);
|
||||
};
|
||||
}, []);
|
||||
@@ -96,10 +99,11 @@ const Editor = React.memo(
|
||||
}
|
||||
|
||||
const onError = () => {
|
||||
console.log('RENDER PROCESS GONE!!!');
|
||||
editor.setLoading(true);
|
||||
setTimeout(() => editor.setLoading(false), 10);
|
||||
};
|
||||
|
||||
console.log(editor.loading, 'loading editor');
|
||||
return editor.loading ? null : (
|
||||
<>
|
||||
<WebView
|
||||
|
||||
@@ -95,6 +95,7 @@ export const useEditor = (
|
||||
|
||||
const onReady = useCallback(async () => {
|
||||
if (!(await isEditorLoaded(editorRef, sessionIdRef.current))) {
|
||||
console.log('ON READY CALLED');
|
||||
overlay(true);
|
||||
setLoading(true);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ import {
|
||||
} from '../../services/event-manager';
|
||||
import { useEditorStore } from '../../stores/use-editor-store';
|
||||
import { useDragState } from '../../screens/settings/editor/state';
|
||||
import { sleep } from '../time';
|
||||
|
||||
const SodiumEventEmitter = new NativeEventEmitter(NativeModules.Sodium);
|
||||
export const useAppEvents = () => {
|
||||
@@ -418,6 +419,7 @@ export const useAppEvents = () => {
|
||||
}
|
||||
|
||||
async function checkIntentState() {
|
||||
console.log(checkIntentState, 'CHECK INTENT STATE');
|
||||
try {
|
||||
let notesAddedFromIntent = MMKV.getString('notesAddedFromIntent');
|
||||
let shareExtensionOpened = MMKV.getString('shareExtensionOpened');
|
||||
@@ -432,14 +434,12 @@ export const useAppEvents = () => {
|
||||
initialize();
|
||||
eSendEvent(refreshNotesPage);
|
||||
}
|
||||
console.log('CHECK INTENT STATE', notesAddedFromIntent || shareExtensionOpened);
|
||||
if (notesAddedFromIntent || shareExtensionOpened) {
|
||||
let id = useEditorStore.getState().currentEditingNote;
|
||||
let note = id && db.notes.note(id).data;
|
||||
eSendEvent('loadingNote', note);
|
||||
editorController.current?.setLoading(true);
|
||||
setTimeout(() => {
|
||||
editorController.current?.setLoading(false);
|
||||
}, 100);
|
||||
eSendEvent('webview_reset');
|
||||
MMKV.removeItem('shareExtensionOpened');
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user