From fc6740e4eb6f06fd819727730d887541c7644258 Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Fri, 8 Dec 2023 15:03:06 +0530 Subject: [PATCH] Fixed version `3.8.1` from Google Play cannot find zim on SD card that are copied to app-specific directory. * Scan the app-specific directory as well because we have limitations in scanning all directories on Android 11 and above in the Play Store variant. If a user copies the ZIM file to the app-specific directory on the SD card, the scanning of the app-specific directory on the SD card has not been added, resulting in the copied files not being displayed on the library screen. Therefore, we need to explicitly include the app-specific directory for scanning. --- .../java/eu/mhutti1/utils/storage/StorageDeviceUtils.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/src/main/java/eu/mhutti1/utils/storage/StorageDeviceUtils.kt b/core/src/main/java/eu/mhutti1/utils/storage/StorageDeviceUtils.kt index b182b8a6b..d950840a1 100644 --- a/core/src/main/java/eu/mhutti1/utils/storage/StorageDeviceUtils.kt +++ b/core/src/main/java/eu/mhutti1/utils/storage/StorageDeviceUtils.kt @@ -36,6 +36,14 @@ object StorageDeviceUtils { add(environmentDevices(context)) addAll(externalMountPointDevices()) addAll(externalFilesDirsDevices(context, false)) + // Scan the app-specific directory as well because we have limitations in scanning + // all directories on Android 11 and above in the Play Store variant. + // If a user copies the ZIM file to the app-specific directory on the SD card, + // the scanning of the app-specific directory on the SD card has not been added, + // resulting in the copied files not being displayed on the library screen. + // Therefore, we need to explicitly include the app-specific directory for scanning. + // See https://github.com/kiwix/kiwix-android/issues/3579 + addAll(externalFilesDirsDevices(context, true)) } return validate(storageDevices, false) }