Skip to content

Commit 50d6f72

Browse files
committed
revert: Revert get library manga with flow
1 parent 6a2704f commit 50d6f72

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,7 @@ open class LibraryController(
13841384

13851385
private fun onRefresh() {
13861386
showCategories(false)
1387-
presenter.getLibrary(true)
1387+
presenter.getLibrary()
13881388
destroyActionModeIfNeeded()
13891389
}
13901390

@@ -1796,7 +1796,7 @@ open class LibraryController(
17961796
val category = (adapter.getItem(position) as? LibraryHeaderItem)?.category ?: return
17971797
if (!category.isDynamic) {
17981798
ManageCategoryDialog(category) {
1799-
presenter.getLibrary(true)
1799+
presenter.getLibrary()
18001800
}.showDialog(router)
18011801
}
18021802
}

app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt

+12-7
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class LibraryPresenter(
9595
private val updateChapter: UpdateChapters by injectLazy()
9696
private val updateManga: UpdateManga by injectLazy()
9797

98-
private var libraryManga: List<LibraryManga> = emptyList()
98+
//private var libraryManga: List<LibraryManga> = emptyList()
9999

100100
private val context = preferences.context
101101
private val viewContext
@@ -181,12 +181,18 @@ class LibraryPresenter(
181181
lastLibraryItems = null
182182
lastAllLibraryItems = null
183183
}
184+
185+
/*
184186
presenterScope.launch {
185187
getLibraryManga.subscribe().collectLatest {
186188
libraryManga = it.apply { if (groupType > BY_DEFAULT) { distinctBy { it.id } } }
187-
getLibrary(false)
189+
getLibrary()
188190
}
189191
}
192+
*/
193+
194+
getLibrary()
195+
190196
if (!preferences.showLibrarySearchSuggestions().isSet()) {
191197
DelayedLibrarySuggestionsJob.setupTask(context, true)
192198
} else if (preferences.showLibrarySearchSuggestions().get() &&
@@ -210,7 +216,7 @@ class LibraryPresenter(
210216
}
211217

212218
/** Get favorited manga for library and sort and filter it */
213-
fun getLibrary(forceFetch: Boolean = true) {
219+
fun getLibrary() {
214220
presenterScope.launch {
215221
if (categories.isEmpty()) {
216222
val dbCategories = getCategories.await()
@@ -220,7 +226,7 @@ class LibraryPresenter(
220226
categories = lastCategories ?: getCategories.await().toMutableList()
221227
}
222228

223-
val (library, hiddenItems) = withIOContext { getLibraryFromDB(forceFetch) }
229+
val (library, hiddenItems) = withIOContext { getLibraryFromDB() }
224230
setDownloadCount(library)
225231
setUnreadBadge(library)
226232
setSourceLanguage(library)
@@ -776,11 +782,10 @@ class LibraryPresenter(
776782
*
777783
* @return an list of all the manga in a itemized form.
778784
*/
779-
private suspend fun getLibraryFromDB(forceFetch: Boolean = false): Pair<List<LibraryItem>, List<LibraryItem>> {
785+
private suspend fun getLibraryFromDB(): Pair<List<LibraryItem>, List<LibraryItem>> {
780786
removeArticles = preferences.removeArticles().get()
781787
val categories = getCategories.await().toMutableList()
782-
if (forceFetch)
783-
libraryManga = getLibraryManga.await().apply { if (groupType > BY_DEFAULT) { distinctBy { it.id } } }
788+
val libraryManga = getLibraryManga.await().apply { if (groupType > BY_DEFAULT) { distinctBy { it.id } } }
784789
val showAll = showAllCategories
785790
val hiddenItems = mutableListOf<LibraryItem>()
786791

0 commit comments

Comments
 (0)