mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
revert: Revert get library manga with flow
This commit is contained in:
parent
6a2704ff11
commit
50d6f7293d
2 changed files with 14 additions and 9 deletions
|
@ -1384,7 +1384,7 @@ open class LibraryController(
|
||||||
|
|
||||||
private fun onRefresh() {
|
private fun onRefresh() {
|
||||||
showCategories(false)
|
showCategories(false)
|
||||||
presenter.getLibrary(true)
|
presenter.getLibrary()
|
||||||
destroyActionModeIfNeeded()
|
destroyActionModeIfNeeded()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1796,7 +1796,7 @@ open class LibraryController(
|
||||||
val category = (adapter.getItem(position) as? LibraryHeaderItem)?.category ?: return
|
val category = (adapter.getItem(position) as? LibraryHeaderItem)?.category ?: return
|
||||||
if (!category.isDynamic) {
|
if (!category.isDynamic) {
|
||||||
ManageCategoryDialog(category) {
|
ManageCategoryDialog(category) {
|
||||||
presenter.getLibrary(true)
|
presenter.getLibrary()
|
||||||
}.showDialog(router)
|
}.showDialog(router)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ class LibraryPresenter(
|
||||||
private val updateChapter: UpdateChapters by injectLazy()
|
private val updateChapter: UpdateChapters by injectLazy()
|
||||||
private val updateManga: UpdateManga by injectLazy()
|
private val updateManga: UpdateManga by injectLazy()
|
||||||
|
|
||||||
private var libraryManga: List<LibraryManga> = emptyList()
|
//private var libraryManga: List<LibraryManga> = emptyList()
|
||||||
|
|
||||||
private val context = preferences.context
|
private val context = preferences.context
|
||||||
private val viewContext
|
private val viewContext
|
||||||
|
@ -181,12 +181,18 @@ class LibraryPresenter(
|
||||||
lastLibraryItems = null
|
lastLibraryItems = null
|
||||||
lastAllLibraryItems = null
|
lastAllLibraryItems = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
presenterScope.launch {
|
presenterScope.launch {
|
||||||
getLibraryManga.subscribe().collectLatest {
|
getLibraryManga.subscribe().collectLatest {
|
||||||
libraryManga = it.apply { if (groupType > BY_DEFAULT) { distinctBy { it.id } } }
|
libraryManga = it.apply { if (groupType > BY_DEFAULT) { distinctBy { it.id } } }
|
||||||
getLibrary(false)
|
getLibrary()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
getLibrary()
|
||||||
|
|
||||||
if (!preferences.showLibrarySearchSuggestions().isSet()) {
|
if (!preferences.showLibrarySearchSuggestions().isSet()) {
|
||||||
DelayedLibrarySuggestionsJob.setupTask(context, true)
|
DelayedLibrarySuggestionsJob.setupTask(context, true)
|
||||||
} else if (preferences.showLibrarySearchSuggestions().get() &&
|
} else if (preferences.showLibrarySearchSuggestions().get() &&
|
||||||
|
@ -210,7 +216,7 @@ class LibraryPresenter(
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get favorited manga for library and sort and filter it */
|
/** Get favorited manga for library and sort and filter it */
|
||||||
fun getLibrary(forceFetch: Boolean = true) {
|
fun getLibrary() {
|
||||||
presenterScope.launch {
|
presenterScope.launch {
|
||||||
if (categories.isEmpty()) {
|
if (categories.isEmpty()) {
|
||||||
val dbCategories = getCategories.await()
|
val dbCategories = getCategories.await()
|
||||||
|
@ -220,7 +226,7 @@ class LibraryPresenter(
|
||||||
categories = lastCategories ?: getCategories.await().toMutableList()
|
categories = lastCategories ?: getCategories.await().toMutableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
val (library, hiddenItems) = withIOContext { getLibraryFromDB(forceFetch) }
|
val (library, hiddenItems) = withIOContext { getLibraryFromDB() }
|
||||||
setDownloadCount(library)
|
setDownloadCount(library)
|
||||||
setUnreadBadge(library)
|
setUnreadBadge(library)
|
||||||
setSourceLanguage(library)
|
setSourceLanguage(library)
|
||||||
|
@ -776,11 +782,10 @@ class LibraryPresenter(
|
||||||
*
|
*
|
||||||
* @return an list of all the manga in a itemized form.
|
* @return an list of all the manga in a itemized form.
|
||||||
*/
|
*/
|
||||||
private suspend fun getLibraryFromDB(forceFetch: Boolean = false): Pair<List<LibraryItem>, List<LibraryItem>> {
|
private suspend fun getLibraryFromDB(): Pair<List<LibraryItem>, List<LibraryItem>> {
|
||||||
removeArticles = preferences.removeArticles().get()
|
removeArticles = preferences.removeArticles().get()
|
||||||
val categories = getCategories.await().toMutableList()
|
val categories = getCategories.await().toMutableList()
|
||||||
if (forceFetch)
|
val libraryManga = getLibraryManga.await().apply { if (groupType > BY_DEFAULT) { distinctBy { it.id } } }
|
||||||
libraryManga = getLibraryManga.await().apply { if (groupType > BY_DEFAULT) { distinctBy { it.id } } }
|
|
||||||
val showAll = showAllCategories
|
val showAll = showAllCategories
|
||||||
val hiddenItems = mutableListOf<LibraryItem>()
|
val hiddenItems = mutableListOf<LibraryItem>()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue