diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 82900570a..9a1142941 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -14,14 +14,16 @@ - + + + - + diff --git a/src/navigation/screens/chats/helpers/useFileDownload.ts b/src/navigation/screens/chats/helpers/useFileDownload.ts index 82277df9b..5cc6fc7f2 100644 --- a/src/navigation/screens/chats/helpers/useFileDownload.ts +++ b/src/navigation/screens/chats/helpers/useFileDownload.ts @@ -88,6 +88,14 @@ const useFileDownload = ( ? `${androidDownloadDir}/${fileName}` // Public Downloads on Android : `${RNBlobUtil.fs.dirs.CacheDir}/${fileName}`; // Documents directory on iOS + // Check if the file exists + const fileExists = await RNBlobUtil.fs.exists(filePath); + + if (fileExists) { + // Delete the file if it exists + await RNBlobUtil.fs.unlink(filePath); + } + // Write the file await RNBlobUtil.fs.writeFile(filePath, base64Data, 'base64'); if (Platform.OS === 'ios') {