From 637740bf4e6f8655cde1f1e6622f4bf1689a3135 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Sat, 9 Jul 2022 17:04:53 +0500 Subject: [PATCH] fix attachment loading progress --- apps/mobile/src/screens/editor/index.tsx | 2 +- apps/mobile/src/screens/editor/progress.js | 1 + apps/mobile/src/screens/editor/tiptap/useEditor.ts | 2 +- apps/mobile/src/stores/useAttachmentStore.ts | 2 +- apps/mobile/src/utils/hooks/useAppEvents.js | 1 + apps/mobile/src/utils/hooks/usePricing.ts | 7 +++++-- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/mobile/src/screens/editor/index.tsx b/apps/mobile/src/screens/editor/index.tsx index 1a244e65f..f4a3ea5c0 100755 --- a/apps/mobile/src/screens/editor/index.tsx +++ b/apps/mobile/src/screens/editor/index.tsx @@ -131,7 +131,7 @@ const Editor = React.memo( allowUniversalAccessFromFileURLs={true} originWhitelist={['*']} source={{ - uri: __DEV__ ? 'http://192.168.10.7:3000/' : EDITOR_URI + uri: __DEV__ ? 'http://localhost:3000/' : EDITOR_URI }} style={style} autoManageStatusBarEnabled={false} diff --git a/apps/mobile/src/screens/editor/progress.js b/apps/mobile/src/screens/editor/progress.js index fbc85ded0..b99533650 100644 --- a/apps/mobile/src/screens/editor/progress.js +++ b/apps/mobile/src/screens/editor/progress.js @@ -17,6 +17,7 @@ export const ProgressBar = () => { useEffect(() => { if (loading) { + console.log(loading); if (loading.current !== loading.total) { setVisible(true); setProg(loading.current / loading.total); diff --git a/apps/mobile/src/screens/editor/tiptap/useEditor.ts b/apps/mobile/src/screens/editor/tiptap/useEditor.ts index 2267b051b..950e6be59 100644 --- a/apps/mobile/src/screens/editor/tiptap/useEditor.ts +++ b/apps/mobile/src/screens/editor/tiptap/useEditor.ts @@ -265,7 +265,7 @@ export const useEditor = ( useEditorStore.getState().setReadonly(item.readonly); loadImages(); await commands.setTags(currentNote.current); - await commands.setSettings(); + commands.setSettings(); overlay(false); } }, diff --git a/apps/mobile/src/stores/useAttachmentStore.ts b/apps/mobile/src/stores/useAttachmentStore.ts index c7dce52f5..7811299bc 100644 --- a/apps/mobile/src/stores/useAttachmentStore.ts +++ b/apps/mobile/src/stores/useAttachmentStore.ts @@ -54,5 +54,5 @@ export const useAttachmentStore = create((set, get) => ({ encryptionProgress: 0, setEncryptionProgress: encryptionProgress => set({ encryptionProgress: encryptionProgress }), loading: { total: 0, current: 0 }, - setLoading: data => set({ loading: data }) + setLoading: data => set({ loading: data ? { ...data } : data }) })); diff --git a/apps/mobile/src/utils/hooks/useAppEvents.js b/apps/mobile/src/utils/hooks/useAppEvents.js index a9c98d633..1f9b8e97d 100644 --- a/apps/mobile/src/utils/hooks/useAppEvents.js +++ b/apps/mobile/src/utils/hooks/useAppEvents.js @@ -60,6 +60,7 @@ export const useAppEvents = () => { }); const onLoadingAttachmentProgress = data => { + console.log('loading', data); useAttachmentStore.getState().setLoading(data.total === data.current ? null : data); }; diff --git a/apps/mobile/src/utils/hooks/usePricing.ts b/apps/mobile/src/utils/hooks/usePricing.ts index 98816f896..00cd75d08 100644 --- a/apps/mobile/src/utils/hooks/usePricing.ts +++ b/apps/mobile/src/utils/hooks/usePricing.ts @@ -14,8 +14,11 @@ type PurchaseInfo = { const skuInfos: { [name: string]: PurchaseInfo | undefined } = {}; export const usePricing = (period: 'monthly' | 'yearly') => { - const [current, setCurrent] = - useState<{ period: string; info?: PurchaseInfo; product?: Subscription }>(); + const [current, setCurrent] = useState<{ + period: string; + info?: PurchaseInfo; + product?: Subscription; + }>(); const getDefaultSku = (period: 'monthly' | 'yearly') => { return period === 'monthly'