remove the custom hook for autoDownload
This commit is contained in:
parent
acb280fa36
commit
7108e35ae7
|
@ -1,5 +1,4 @@
|
|||
import NetInfo, { NetInfoStateType } from '@react-native-community/netinfo';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import {
|
||||
IMAGES_PREFERENCE_DOWNLOAD,
|
||||
|
@ -26,18 +25,3 @@ export const isAutoDownloadEnabled = async (mediaType: TMediaType, { author, use
|
|||
author?._id === user.id
|
||||
);
|
||||
};
|
||||
|
||||
export const useAutoDownloadEnabled = (mediaType: TMediaType, { author, user }: IUsersParam) => {
|
||||
const [enabled, setEnabled] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const handleAutoDownload = async () => {
|
||||
const result = await isAutoDownloadEnabled(mediaType, { author, user });
|
||||
console.log('🚀 ~ file: autoDownloadPreference.ts:38 ~ handleAutoDownload ~ result:', result);
|
||||
setEnabled(result);
|
||||
};
|
||||
handleAutoDownload();
|
||||
}, []);
|
||||
|
||||
return enabled;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue