fix attachment loading progress

This commit is contained in:
Ammar Ahmed
2022-07-09 17:04:53 +05:00
parent d5246de351
commit 637740bf4e
6 changed files with 10 additions and 5 deletions

View File

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

View File

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

View File

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

View File

@@ -54,5 +54,5 @@ export const useAttachmentStore = create<AttachmentStore>((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 })
}));

View File

@@ -60,6 +60,7 @@ export const useAppEvents = () => {
});
const onLoadingAttachmentProgress = data => {
console.log('loading', data);
useAttachmentStore.getState().setLoading(data.total === data.current ? null : data);
};

View File

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