remove local_cache_directory and deleteThumbnail

This commit is contained in:
Reinaldo Neto 2023-07-25 13:34:41 -03:00
parent 3ada875384
commit fb576efc51
1 changed files with 0 additions and 13 deletions

View File

@ -15,7 +15,6 @@ const defaultType = {
};
export const LOCAL_DOCUMENT_DIRECTORY = FileSystem.documentDirectory;
export const LOCAL_CACHE_DIRECTORY = FileSystem.cacheDirectory;
const sanitizeString = (value: string) => {
const urlWithoutQueryString = value.split('?')[0];
@ -144,23 +143,11 @@ export const getMediaCache = async ({
}
};
const deleteVideoThumbnails = async () => {
try {
// https://github.com/expo/expo/blob/e8f02c96cf2613c7f3e2ab2b0171eb39da80032b/packages/expo-video-thumbnails/ios/VideoThumbnailsModule.swift#L51
// https://github.com/expo/expo/blob/e8f02c96cf2613c7f3e2ab2b0171eb39da80032b/packages/expo-video-thumbnails/android/src/main/java/expo/modules/videothumbnails/VideoThumbnailsModule.kt#L44C5-L44C5
const videoThumbnailPath = `${LOCAL_CACHE_DIRECTORY}/VideoThumbnails/`;
await FileSystem.deleteAsync(videoThumbnailPath, { idempotent: true });
} catch (error) {
log(error);
}
};
export const deleteMediaFiles = async (serverUrl: string): Promise<void> => {
try {
const serverUrlParsed = serverUrlParsedAsPath(serverUrl);
const path = `${LOCAL_DOCUMENT_DIRECTORY}${serverUrlParsed}`;
await FileSystem.deleteAsync(path, { idempotent: true });
await deleteVideoThumbnails();
} catch (error) {
log(error);
}