From 7d4303cfba37fa1a618896e353fbc14676e42cbe Mon Sep 17 00:00:00 2001 From: Kushdeep Singh Date: Wed, 15 Jan 2025 12:32:07 +0530 Subject: [PATCH 1/2] DMAPP-156: Fix file download issue Details: - Added logic to check if a deleted file exists in the cache. - Removed the file from the cache before downloading the new file. --- src/navigation/screens/chats/helpers/useFileDownload.ts | 8 ++++++++ 1 file changed, 8 insertions(+) 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') { From 53c877cae015a3e96779c3cf04e9720c0f60668b Mon Sep 17 00:00:00 2001 From: Kushdeep Singh Date: Fri, 17 Jan 2025 15:08:59 +0530 Subject: [PATCH 2/2] DMAPP-156: Added native permissions for different android API levels --- android/app/src/main/AndroidManifest.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 @@ - + + + - +