فهرست منبع

Consider downloaded only mode when getting download counts in library

Fixes #8318
arkon 2 سال پیش
والد
کامیت
ad107860b9
1فایلهای تغییر یافته به همراه8 افزوده شده و 6 حذف شده
  1. 8 6
      app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt

+ 8 - 6
app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt

@@ -119,12 +119,9 @@ class LibraryPresenter(
         subscribeLibrary()
     }
 
-    /**
-     * Subscribes to library if needed.
-     */
     fun subscribeLibrary() {
         /**
-         * TODO: Move this to a coroutine world
+         * TODO:
          * - Move filter and sort to getMangaForCategory and only filter and sort the current display category instead of whole library as some has 5000+ items in the library
          * - Create new db view and new query to just fetch the current category save as needed to instance variable
          * - Fetch badges to maps and retrieve as needed instead of fetching all of them at once
@@ -325,13 +322,18 @@ class LibraryPresenter(
             getLibraryManga.subscribe(),
             libraryPreferences.downloadBadge().changes(),
             libraryPreferences.filterDownloaded().changes(),
+            preferences.downloadedOnly().changes(),
             downloadCache.changes,
-        ) { libraryMangaList, downloadBadgePref, filterDownloadedPref, _ ->
+        ) { libraryMangaList, downloadBadgePref, filterDownloadedPref, downloadedOnly, _ ->
             libraryMangaList
                 .map { libraryManga ->
+                    val needsDownloadCounts = downloadBadgePref ||
+                        filterDownloadedPref != State.IGNORE.value ||
+                        downloadedOnly
+
                     // Display mode based on user preference: take it from global library setting or category
                     LibraryItem(libraryManga).apply {
-                        downloadCount = if (downloadBadgePref || filterDownloadedPref != State.IGNORE.value) {
+                        downloadCount = if (needsDownloadCounts) {
                             downloadManager.getDownloadCount(libraryManga.manga).toLong()
                         } else {
                             0