remove local_cache_directory and deleteThumbnail
This commit is contained in:
parent
3ada875384
commit
fb576efc51
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue