From 05891eba03581c7070c6dea7535b55a6db51c4af Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Tue, 26 Nov 2024 21:14:19 +0530 Subject: [PATCH] Fixed: CustomDownloadFragment was not showing if there is no ZIM file available in custom apps. --- .../kiwix/kiwixmobile/custom/main/CustomFileValidator.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/custom/src/main/java/org/kiwix/kiwixmobile/custom/main/CustomFileValidator.kt b/custom/src/main/java/org/kiwix/kiwixmobile/custom/main/CustomFileValidator.kt index 1785e9830..a72543ae3 100644 --- a/custom/src/main/java/org/kiwix/kiwixmobile/custom/main/CustomFileValidator.kt +++ b/custom/src/main/java/org/kiwix/kiwixmobile/custom/main/CustomFileValidator.kt @@ -123,7 +123,13 @@ class CustomFileValidator @Inject constructor(private val context: Context) { directoryList.add(dir) } } - return scanDirs(directoryList.toTypedArray(), "zim") + return scanDirs(directoryList.toTypedArray(), "zim").filterNot { + // Excluding the demo.zim file from the list as it is used for demonstration purposes + // on the ZimHostFragment for hosting the ZIM file on the server. + // Since we are now using the "asset delivery mode", in this we are using the + // assetFileDescriptor instead of a regular file. + it.name.equals("demo.zim", ignoreCase = true) + } } private fun scanDirs(dirs: Array?, extensionToMatch: String): List =