mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 14:51:49 +01:00
Fix infinite loading when user library is empty (#7602)
- If no manga in library add default category this to remove loading state
This commit is contained in:
parent
aeffb5eeb8
commit
164de67a56
@ -412,14 +412,14 @@ class LibraryPresenter(
|
|||||||
*/
|
*/
|
||||||
private fun getLibraryObservable(): Observable<Library> {
|
private fun getLibraryObservable(): Observable<Library> {
|
||||||
return combine(getCategoriesFlow(), getLibraryMangasFlow()) { dbCategories, libraryManga ->
|
return combine(getCategoriesFlow(), getLibraryMangasFlow()) { dbCategories, libraryManga ->
|
||||||
val categories = if (libraryManga.containsKey(0)) {
|
val categories = if (libraryManga.containsKey(0) || libraryManga.isEmpty()) {
|
||||||
arrayListOf(Category.default(context)) + dbCategories
|
arrayListOf(Category.default(context)) + dbCategories
|
||||||
} else {
|
} else {
|
||||||
dbCategories
|
dbCategories
|
||||||
}
|
}
|
||||||
|
|
||||||
libraryManga.forEach { (categoryId, libraryManga) ->
|
libraryManga.forEach { (categoryId, libraryManga) ->
|
||||||
val category = categories.first { category -> category.id == categoryId.toLong() }
|
val category = categories.first { category -> category.id == categoryId }
|
||||||
libraryManga.forEach { libraryItem ->
|
libraryManga.forEach { libraryItem ->
|
||||||
libraryItem.displayMode = category.displayMode
|
libraryItem.displayMode = category.displayMode
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user