diff --git a/app/detekt_baseline.xml b/app/detekt_baseline.xml index 22d856fb2d..db84623e8a 100644 --- a/app/detekt_baseline.xml +++ b/app/detekt_baseline.xml @@ -12,7 +12,7 @@ MagicNumber:ZimManageViewModel.kt$ZimManageViewModel$5 MagicNumber:ZimManageViewModel.kt$ZimManageViewModel$500 MagicNumber:LocalFileTransferFragment.kt$LocalFileTransferFragment$500 - NestedBlockDepth:LocalLibraryFragment.kt$LocalLibraryFragment$private fun checkPermissions() + NestedBlockDepth:LocalLibraryFragment.kt$LocalLibraryFragment$private fun checkManageExternalStoragePermission() NestedBlockDepth:PeerGroupHandshake.kt$PeerGroupHandshake$private fun readHandshakeAndExchangeMetaData(): InetAddress? NestedBlockDepth:ReceiverHandShake.kt$ReceiverHandShake$override fun exchangeFileTransferMetadata(inputStream: InputStream, outputStream: OutputStream) PackageNaming:AvailableSpaceCalculator.kt$package diff --git a/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/LocalLibraryFragment.kt b/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/LocalLibraryFragment.kt index d0ca9e4162..3782bc6ae3 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/LocalLibraryFragment.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/LocalLibraryFragment.kt @@ -430,33 +430,37 @@ class LocalLibraryFragment : BaseFragment() { ) ) } else { - requestFileSystemCheck() + checkManageExternalStoragePermission() } } else { - if (sharedPreferenceUtil.isPlayStoreBuild) { - requestFileSystemCheck() - } else { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { - if (Environment.isExternalStorageManager()) { - // We already have permission!! - requestFileSystemCheck() - } else { - if (sharedPreferenceUtil.manageExternalFilesPermissionDialog) { - // We should only ask for first time, If the users wants to revoke settings - // then they can directly toggle this feature from settings screen - sharedPreferenceUtil.manageExternalFilesPermissionDialog = false - // Show Dialog and Go to settings to give permission - dialogShower.show( - KiwixDialog.ManageExternalFilesPermissionDialog, - { - this.activity?.let(FragmentActivity::navigateToSettings) - } - ) - } - } - } else { + checkManageExternalStoragePermission() + } + } + + private fun checkManageExternalStoragePermission() { + if (sharedPreferenceUtil.isPlayStoreBuild) { + requestFileSystemCheck() + } else { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + if (Environment.isExternalStorageManager()) { + // We already have permission!! requestFileSystemCheck() + } else { + if (sharedPreferenceUtil.manageExternalFilesPermissionDialog) { + // We should only ask for first time, If the users wants to revoke settings + // then they can directly toggle this feature from settings screen + sharedPreferenceUtil.manageExternalFilesPermissionDialog = false + // Show Dialog and Go to settings to give permission + dialogShower.show( + KiwixDialog.ManageExternalFilesPermissionDialog, + { + this.activity?.let(FragmentActivity::navigateToSettings) + } + ) + } } + } else { + requestFileSystemCheck() } } }