From d1bf8570797c891876b0c5fa2d9c210dc883f8a7 Mon Sep 17 00:00:00 2001 From: arkon Date: Tue, 28 Mar 2023 18:16:43 -0400 Subject: [PATCH] Remove unnecessary withIOContext --- .../source/browse/BrowseSourceScreenModel.kt | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreenModel.kt index e4ee7aebb2..f0c84dc505 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreenModel.kt @@ -9,7 +9,6 @@ import androidx.compose.ui.unit.dp import androidx.paging.Pager import androidx.paging.PagingConfig import androidx.paging.cachedIn -import androidx.paging.filter import androidx.paging.map import cafe.adriel.voyager.core.model.StateScreenModel import cafe.adriel.voyager.core.model.coroutineScope @@ -32,7 +31,6 @@ import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.firstOrNull -import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.flow.update @@ -41,7 +39,6 @@ import logcat.LogPriority import tachiyomi.core.preference.CheckboxState import tachiyomi.core.preference.mapAsCheckboxState import tachiyomi.core.util.lang.launchIO -import tachiyomi.core.util.lang.withIOContext import tachiyomi.core.util.system.logcat import tachiyomi.domain.category.interactor.GetCategories import tachiyomi.domain.category.interactor.SetMangaCategories @@ -120,17 +117,15 @@ class BrowseSourceScreenModel( getRemoteManga.subscribe(sourceId, listing.query ?: "", listing.filters) }.flow.map { pagingData -> pagingData.map { - withIOContext { - networkToLocalManga.await(it.toDomainManga(sourceId)) - .let { localManga -> - getManga.subscribe(localManga.url, localManga.source) - } - .filterNotNull() - .filter { localManga -> - !sourcePreferences.hideInLibraryItems().get() || !localManga.favorite - } - .stateIn(coroutineScope) - } + networkToLocalManga.await(it.toDomainManga(sourceId)) + .let { localManga -> + getManga.subscribe(localManga.url, localManga.source) + } + .filterNotNull() + .filter { localManga -> + !sourcePreferences.hideInLibraryItems().get() || !localManga.favorite + } + .stateIn(coroutineScope) } } .cachedIn(coroutineScope)