This commit is contained in:
ammarahm-ed
2022-07-11 22:23:12 +05:00
5 changed files with 14 additions and 14 deletions

View File

@@ -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: {

View File

@@ -154,9 +154,6 @@ export const TabsHolder = React.memo(
}, 2500);
} else {
setDeviceMode('mobile', size);
setTimeout(() => {
tabBarRef.current?.closeDrawer();
}, 2500);
}
}

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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) {