From ff87fddece76b20f9d83ae027839b3e8d2196bb1 Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Tue, 5 Nov 2024 11:29:58 +0530 Subject: [PATCH] Displaying the storage selection dialog for configuration if an SD card is available at first download. If only internal storage is available, proceed directly with the ZIM file download, as showing the configuration dialog is unnecessary in this case. --- .../nav/destination/library/OnlineLibraryFragment.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/OnlineLibraryFragment.kt b/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/OnlineLibraryFragment.kt index c1991575d..a619d4f2f 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/OnlineLibraryFragment.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/OnlineLibraryFragment.kt @@ -51,6 +51,7 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import eu.mhutti1.utils.storage.STORAGE_SELECT_STORAGE_TITLE_TEXTVIEW_SIZE import eu.mhutti1.utils.storage.StorageDevice +import eu.mhutti1.utils.storage.StorageDeviceUtils import eu.mhutti1.utils.storage.StorageSelectDialog import org.kiwix.kiwixmobile.R import org.kiwix.kiwixmobile.cachedComponent @@ -530,7 +531,15 @@ class OnlineLibraryFragment : BaseFragment(), FragmentActivityExtensions { } else -> if (sharedPreferenceUtil.showStorageOption) { - showStorageSelectDialog() + // Show the storage selection dialog for configuration if there is an SD card available. + if (StorageDeviceUtils.getWritableStorage(requireActivity()).size > 1) { + showStorageSelectDialog() + } else { + // If only internal storage is available, proceed with the ZIM file download directly. + // Displaying a configuration dialog is unnecessary in this case. + sharedPreferenceUtil.showStorageOption = false + onBookItemClick(item) + } } else if (!requireActivity().isManageExternalStoragePermissionGranted( sharedPreferenceUtil )