|
|
@ -10,6 +10,7 @@ import androidx.compose.ui.unit.dp
|
|
|
|
import androidx.paging.Pager
|
|
|
|
import androidx.paging.Pager
|
|
|
|
import androidx.paging.PagingConfig
|
|
|
|
import androidx.paging.PagingConfig
|
|
|
|
import androidx.paging.cachedIn
|
|
|
|
import androidx.paging.cachedIn
|
|
|
|
|
|
|
|
import androidx.paging.filter
|
|
|
|
import androidx.paging.map
|
|
|
|
import androidx.paging.map
|
|
|
|
import cafe.adriel.voyager.core.model.StateScreenModel
|
|
|
|
import cafe.adriel.voyager.core.model.StateScreenModel
|
|
|
|
import cafe.adriel.voyager.core.model.coroutineScope
|
|
|
|
import cafe.adriel.voyager.core.model.coroutineScope
|
|
|
@ -137,13 +138,14 @@ class BrowseSourceScreenModel(
|
|
|
|
PagingConfig(pageSize = 25),
|
|
|
|
PagingConfig(pageSize = 25),
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
getRemoteManga.subscribe(sourceId, listing.query ?: "", listing.filters)
|
|
|
|
getRemoteManga.subscribe(sourceId, listing.query ?: "", listing.filters)
|
|
|
|
}.flow
|
|
|
|
}.flow.map { pagingData ->
|
|
|
|
.map { pagingData ->
|
|
|
|
pagingData
|
|
|
|
pagingData.map { sManga ->
|
|
|
|
.map { withIOContext { networkToLocalManga.await(it.toDomainManga(sourceId)) } }
|
|
|
|
val dbManga = withIOContext { networkToLocalManga.await(sManga.toDomainManga(sourceId)) }
|
|
|
|
.filter { !sourcePreferences.hideInLibraryItems().get() || !it.favorite }
|
|
|
|
getManga.subscribe(dbManga.url, dbManga.source)
|
|
|
|
.map {
|
|
|
|
|
|
|
|
getManga.subscribe(it.url, it.source)
|
|
|
|
.filterNotNull()
|
|
|
|
.filterNotNull()
|
|
|
|
.onEach { initializeManga(it) }
|
|
|
|
.onEach(::initializeManga)
|
|
|
|
.stateIn(coroutineScope)
|
|
|
|
.stateIn(coroutineScope)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|