-
-
Notifications
You must be signed in to change notification settings - Fork 500
Introduced the category filter on "Download" screen. #4436
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
base: main
Are you sure you want to change the base?
Conversation
a8b6f32 to
719f223
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4436 +/- ##
============================================
+ Coverage 58.42% 58.75% +0.33%
- Complexity 1455 1473 +18
============================================
Files 328 337 +9
Lines 17016 17405 +389
Branches 2101 2151 +50
============================================
+ Hits 9941 10227 +286
- Misses 5669 5730 +61
- Partials 1406 1448 +42 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
How does this filter behaves when device if offline? Where does the category list com from then? How work the caching (I wonder why you need one!)? |
@kelson42 We have implemented the caching to store the category in Initially, it needs to fetch the category from an online source once, and then it will save that in shared preferences. After that, if there is no internet connection available or any error in fetching the category in the next app lifecycle, then it shows the cached category from the shared preferences. If in the next app lifecycle it fetches the category from an online source, then it saves the updated category in SharedPreferences. We need the caching to avoid the unnecessary API calls. As it is a separate dialog screen with a viewmodel, in that viewmodel, we fetch the category, and the viewmodel keeps that category data until that screen(dialog) is dismissed. After dismissing the view model, it's clear when the screen is no longer available to free up the resource. If the user again opens this dialog for selecting a different category, then it again fetches the category, so to avoid this fetching, we need this caching. Since keeping this data on the activity level is not good. |
* Showing category in a dialog on "Download" screen. * Saving the selected category in sharedPreference so that it will automatically applied when user came back to the application same as language filter. * Fetched the category list from online source. * Applied the category filter while fetching the online content.
* Implemented caching of the category list in the application to avoid unnecessary API calls. * Created `OnlineCategoryDialog` to separately handle the UI and all logic related to the category filter.
…eTest` unit test cases to cover the entire category filter functionality. * Refactored `ZimManageViewModelTest` to include category filter scenarios. * Added `OnlineCategoryTest` UI test.
…e source. Previously, the request could fail due to connection timeouts on slow networks or when the network changed. The retry mechanism is now implemented similarly to the one used for fetching the online library.
b55465e to
79a5d07
Compare
Fixes #4343
CategoryViewModelto manage UI-related data and user actions.OnlineCategoryDialogto separately handle the UI and all logic related to the category filter.ZimManageViewModelTestto include category filter scenarios.CategoryFilterInDownloadScreen.mp4