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:
parent
f0703648df
commit
a0e2f12635
@ -613,16 +613,17 @@ class LibraryScreenModel(
|
||||
*/
|
||||
private fun getTrackingFilterFlow(): Flow<Map<Long, Int>> {
|
||||
val loggedServices = trackManager.services.filter { it.isLogged }
|
||||
val a = loggedServices
|
||||
.map { libraryPreferences.filterTracking(it.id.toInt()).changes() }
|
||||
.toTypedArray()
|
||||
if (a.isEmpty()) {
|
||||
return flowOf(emptyMap())
|
||||
}
|
||||
return combine(*a) {
|
||||
loggedServices
|
||||
.mapIndexed { index, trackService -> trackService.id to it[index] }
|
||||
.toMap()
|
||||
return if (loggedServices.isNotEmpty()) {
|
||||
val prefFlows = loggedServices
|
||||
.map { libraryPreferences.filterTracking(it.id.toInt()).changes() }
|
||||
.toTypedArray()
|
||||
combine(*prefFlows) {
|
||||
loggedServices
|
||||
.mapIndexed { index, trackService -> trackService.id to it[index] }
|
||||
.toMap()
|
||||
}
|
||||
} else {
|
||||
flowOf(emptyMap())
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user