Skip to content

Commit

Permalink
Displaying the storage selection dialog for configuration if an SD ca…
Browse files Browse the repository at this point in the history
…rd 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.
  • Loading branch information
MohitMaliDeveloper committed Nov 5, 2024
1 parent 9573253 commit f9e4c29
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Check warning on line 541 in app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/OnlineLibraryFragment.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/OnlineLibraryFragment.kt#L540-L541

Added lines #L540 - L541 were not covered by tests
}
} else if (!requireActivity().isManageExternalStoragePermissionGranted(
sharedPreferenceUtil
)
Expand Down

0 comments on commit f9e4c29

Please sign in to comment.