Fixed: 3.9.0 Welcome screen does not run, and Kiwix does not prompt for permissions.

* This commit addresses the scenario where, for any reason, shared preferences and the database are retained on the device, and the list of ZIM files is visible in the library. However, the `MANAGE_EXTERNAL_PERMISSION` is not found, and when a user attempts to open a file, the application lacks the necessary permission. To improve this scenario, we now prompt the user for permission if it is not available when opening ZIM files from the library.
* Additionally, enhanced the behavior of the swipe refresh layout if the user clicks on the "NO" button in the permission dialog.
This commit is contained in:
MohitMaliFtechiz 2023-12-18 19:43:05 +05:30 committed by Kelson
parent c6700762ba
commit cc744b2b74

View File

@ -139,7 +139,14 @@ class LocalLibraryFragment : BaseFragment() {
private val bookDelegate: BookOnDiskDelegate.BookDelegate by lazy {
BookOnDiskDelegate.BookDelegate(
sharedPreferenceUtil,
{ offerAction(RequestNavigateTo(it)) },
{
if (!requireActivity().isManageExternalStoragePermissionGranted(sharedPreferenceUtil)) {
@Suppress("NewApi")
showManageExternalStoragePermissionDialog()
} else {
offerAction(RequestNavigateTo(it))
}
},
{ offerAction(RequestMultiSelection(it)) },
{ offerAction(RequestSelect(it)) }
)
@ -266,6 +273,10 @@ class LocalLibraryFragment : BaseFragment() {
if (!requireActivity().isManageExternalStoragePermissionGranted(sharedPreferenceUtil)) {
@Suppress("NewApi")
showManageExternalStoragePermissionDialog()
// Set loading to false since the dialog is currently being displayed.
// If the user clicks on "No" in the permission dialog,
// the loading icon remains visible infinitely.
fragmentDestinationLibraryBinding?.zimSwiperefresh?.isRefreshing = false
} else {
requestFileSystemCheck()
}