Fix library not loading when not logged in to any tracker (#8629)

(cherry picked from commit 217b03a292457b648ab8abd7c2d264382ddb3023)

# Conflicts:
#	app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt
This commit is contained in:
Ivan Iskandar 2022-11-27 09:37:22 +07:00 committed by Jobobby04
parent f0703648df
commit a0e2f12635

View File

@ -613,16 +613,17 @@ class LibraryScreenModel(
*/ */
private fun getTrackingFilterFlow(): Flow<Map<Long, Int>> { private fun getTrackingFilterFlow(): Flow<Map<Long, Int>> {
val loggedServices = trackManager.services.filter { it.isLogged } val loggedServices = trackManager.services.filter { it.isLogged }
val a = loggedServices return if (loggedServices.isNotEmpty()) {
.map { libraryPreferences.filterTracking(it.id.toInt()).changes() } val prefFlows = loggedServices
.toTypedArray() .map { libraryPreferences.filterTracking(it.id.toInt()).changes() }
if (a.isEmpty()) { .toTypedArray()
return flowOf(emptyMap()) combine(*prefFlows) {
} loggedServices
return combine(*a) { .mapIndexed { index, trackService -> trackService.id to it[index] }
loggedServices .toMap()
.mapIndexed { index, trackService -> trackService.id to it[index] } }
.toMap() } else {
flowOf(emptyMap())
} }
} }