Logic fixes to library

Fixed trying to update with special groupings
Fixed special groups duplicating manga in a list
This commit is contained in:
Jay 2020-05-17 23:30:30 -04:00
parent 3d0f72d50b
commit 1d0545f5de
2 changed files with 6 additions and 4 deletions

View File

@ -385,12 +385,14 @@ class LibraryController(
swipe_refresh.isRefreshing = false swipe_refresh.isRefreshing = false
if (!LibraryUpdateService.isRunning()) { if (!LibraryUpdateService.isRunning()) {
when { when {
!presenter.showAllCategories || presenter.groupType != BY_DEFAULT -> { !presenter.showAllCategories && presenter.groupType == BY_DEFAULT -> {
presenter.categories.find { it.id == presenter.currentCategory }?.let { presenter.allCategories.find { it.id == presenter.currentCategory }?.let {
updateLibrary(it) updateLibrary(it)
} }
} }
presenter.allCategories.size <= 1 -> updateLibrary() presenter.allCategories.size <= 1 || presenter.groupType > BY_DEFAULT -> {
updateLibrary()
}
preferences.updateOnRefresh().getOrDefault() == -1 -> { preferences.updateOnRefresh().getOrDefault() == -1 -> {
MaterialDialog(activity!!).title(R.string.what_should_update) MaterialDialog(activity!!).title(R.string.what_should_update)
.negativeButton(android.R.string.cancel) .negativeButton(android.R.string.cancel)

View File

@ -435,7 +435,7 @@ class LibraryPresenter(
val categories = db.getCategories().executeAsBlocking().toMutableList() val categories = db.getCategories().executeAsBlocking().toMutableList()
var libraryManga = db.getLibraryMangas().executeAsBlocking() var libraryManga = db.getLibraryMangas().executeAsBlocking()
val showAll = showAllCategories val showAll = showAllCategories
if (groupType <= BY_DEFAULT || !libraryIsGrouped) { if (groupType > BY_DEFAULT) {
libraryManga = libraryManga.distinctBy { it.id } libraryManga = libraryManga.distinctBy { it.id }
} }