From 1d0545f5de8b90c3700be6487b54d655aaf6c0cd Mon Sep 17 00:00:00 2001 From: Jay Date: Sun, 17 May 2020 23:30:30 -0400 Subject: [PATCH] Logic fixes to library Fixed trying to update with special groupings Fixed special groups duplicating manga in a list --- .../eu/kanade/tachiyomi/ui/library/LibraryController.kt | 8 +++++--- .../eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt index de57bcb732..550d74df13 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt @@ -385,12 +385,14 @@ class LibraryController( swipe_refresh.isRefreshing = false if (!LibraryUpdateService.isRunning()) { when { - !presenter.showAllCategories || presenter.groupType != BY_DEFAULT -> { - presenter.categories.find { it.id == presenter.currentCategory }?.let { + !presenter.showAllCategories && presenter.groupType == BY_DEFAULT -> { + presenter.allCategories.find { it.id == presenter.currentCategory }?.let { updateLibrary(it) } } - presenter.allCategories.size <= 1 -> updateLibrary() + presenter.allCategories.size <= 1 || presenter.groupType > BY_DEFAULT -> { + updateLibrary() + } preferences.updateOnRefresh().getOrDefault() == -1 -> { MaterialDialog(activity!!).title(R.string.what_should_update) .negativeButton(android.R.string.cancel) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt index 400054092f..aa606f8707 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt @@ -435,7 +435,7 @@ class LibraryPresenter( val categories = db.getCategories().executeAsBlocking().toMutableList() var libraryManga = db.getLibraryMangas().executeAsBlocking() val showAll = showAllCategories - if (groupType <= BY_DEFAULT || !libraryIsGrouped) { + if (groupType > BY_DEFAULT) { libraryManga = libraryManga.distinctBy { it.id } }