kiwix / kiwix-android

Kiwix for Android
https://android.kiwix.org
GNU General Public License v3.0
892 stars 448 forks source link

Fixed: Opening the zim file with kiwix fails to open(not showing the copy/move dialog). #4006

Closed MohitMaliFtechiz closed 1 month ago

MohitMaliFtechiz commented 1 month ago

Fixes #3941 Fixes #3997

Reference APK https://drive.google.com/file/d/16uwwoKWdF00rwhvAvR5musunKse4bBwD/view?usp=sharing https://drive.google.com/file/d/16uwwoKWdF00rwhvAvR5musunKse4bBwD/view?usp=sharing you can try this APK and confirms the behaviours of this functionality.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 62.16216% with 14 lines in your changes missing coverage. Please review.

Project coverage is 58.13%. Comparing base (a959978) to head (05eecc2). Report is 18 commits behind head on main.

Files with missing lines Patch % Lines
...va/org/kiwix/kiwixmobile/main/KiwixMainActivity.kt 73.68% 3 Missing and 2 partials :warning:
...le/nav/destination/library/LocalLibraryFragment.kt 58.33% 1 Missing and 4 partials :warning:
...ile/nav/destination/library/CopyMoveFileHandler.kt 33.33% 1 Missing and 3 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #4006 +/- ## ============================================ + Coverage 57.86% 58.13% +0.27% + Complexity 1602 1599 -3 ============================================ Files 314 314 Lines 13109 13083 -26 Branches 1666 1659 -7 ============================================ + Hits 7585 7606 +21 + Misses 4417 4373 -44 + Partials 1107 1104 -3 ``` | [Flag](https://app.codecov.io/gh/kiwix/kiwix-android/pull/4006/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kiwix) | Coverage Δ | | |---|---|---| | [](https://app.codecov.io/gh/kiwix/kiwix-android/pull/4006/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kiwix) | `58.13% <62.16%> (+0.27%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kiwix#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

kelson42 commented 1 month ago

@MohitMaliFtechiz It works! But why my tablet behaves differently than other android 14?

MohitMaliFtechiz commented 1 month ago

@MohitMaliFtechiz It works! But why my tablet behave differently than other Android 14?

@kelson42 Tablet Uris are different than normal phones. I have checked with another real tablet and found the same issue there. These download URIs are different in tablets to make them compatible with scoped storage.

In tablets: For example, if I open a zim file directly from the opera browser then it returns the URI like this: content://com.opera.browser.DownloadProvider/downloads/beer.stackexchange.com_en_all_2023-05.zim?hash=w4A3vMuc7l1FPQwk23rmbgvfPGJfhcj5FujW37NApdA%3D&mt=application%2Foctet-stream which opera gives with its own file provider.

When I directly open the downloaded zim file from the file manager it gives us this URI: content://com.android.providers.downloads.documents/document/msf%3A1000000057.

In phones:

Chrome Uri: content://media/external/downloads/2825

File Manager Uri: content://com.android.providers.downloads.documents/100059.

kelson42 commented 1 month ago

@MohitMaliFtechiz Please test this then for both tablet and phone within the CI. This very super basic should 100% work.

3 scenarios:

In mean obviously: testing in CI