Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: Move canReadFile() method to IO thread. #4040

Merged
merged 16 commits into from
Oct 21, 2024
Merged

Fixed: Move canReadFile() method to IO thread. #4040

merged 16 commits into from
Oct 21, 2024

Conversation

MohitMaliFtechiz
Copy link
Collaborator

@MohitMaliFtechiz MohitMaliFtechiz commented Oct 16, 2024

Fixes #4039

  • Moved the file readability check to the IO thread to prevent ANR.
  • Refactored the code to accommodate this change.
  • Refactored the test cases.
  • Fixed: The search fragment test failed in both the custom and app modules due to a socket exception during the ZIM file download.
  • Improved the search functionality of our application(Since the search was not working properly after this change):
    The article URL was already available in the searchState, but we were redundantly retrieving the article URL from the pageTitle, resulting in an unnecessary extra call to libkiwix. To optimize this, we now directly use the URL provided by libkiwix for the searched item, reducing the additional call.
  • Fixed: test search cancellation sometimes fails in CI.

Copy link

codecov bot commented Oct 17, 2024

Codecov Report

Attention: Patch coverage is 59.28571% with 57 lines in your changes missing coverage. Please review.

Project coverage is 57.83%. Comparing base (5ceb3ce) to head (9861133).
Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
.../kiwix/kiwixmobile/core/main/CoreReaderFragment.kt 40.90% 10 Missing and 3 partials ⚠️
...bile/nav/destination/reader/KiwixReaderFragment.kt 70.58% 4 Missing and 6 partials ⚠️
...java/org/kiwix/kiwixmobile/core/data/Repository.kt 44.44% 10 Missing ⚠️
...r/fileselectView/effects/OpenFileWithNavigation.kt 0.00% 9 Missing ⚠️
.../org/kiwix/kiwixmobile/core/error/ErrorActivity.kt 0.00% 5 Missing ⚠️
...wix/kiwixmobile/core/settings/CorePrefsFragment.kt 0.00% 3 Missing ⚠️
...rg/kiwix/kiwixmobile/core/dao/LibkiwixBookmarks.kt 89.47% 2 Missing ⚠️
.../java/org/kiwix/kiwixmobile/core/dao/NewBookDao.kt 84.61% 1 Missing and 1 partial ⚠️
...kiwixmobile/core/utils/dialog/RateDialogHandler.kt 33.33% 1 Missing and 1 partial ⚠️
...iwix/kiwixmobile/core/extensions/FileExtensions.kt 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4040      +/-   ##
============================================
- Coverage     58.17%   57.83%   -0.35%     
+ Complexity     1510     1496      -14     
============================================
  Files           315      315              
  Lines         13020    13071      +51     
  Branches       1657     1659       +2     
============================================
- Hits           7575     7560      -15     
- Misses         4336     4415      +79     
+ Partials       1109     1096      -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

* Moved the file readability check to the IO thread to prevent ANR.
* Refactored the code to accommodate this change.
…p modules due to a socket exception during the ZIM file download.
* The article URL was already available in the searchState, but we were redundantly retrieving the article URL from the pageTitle, resulting in an unnecessary extra call to libkiwix. To optimize this, we now directly use the URL provided by libkiwix for the searched item, reducing the extra call.
* Refactored some unnecessary code.
…er ZIM file was already opened in the reader. Instead of opening the bookmarked page, it always opens the home page of the current ZIM file.
… loaded page when we click on any searched item.
@MohitMaliFtechiz MohitMaliFtechiz marked this pull request as ready for review October 21, 2024 12:38
@kelson42 kelson42 merged commit 9954193 into main Oct 21, 2024
21 of 22 checks passed
@kelson42 kelson42 deleted the Fixes#4039 branch October 21, 2024 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move canReadFile() method to IO thread.
3 participants