mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-09 18:48:55 +01:00
Always update fresh data from source if manga isn't favorited
This commit is contained in:
@@ -113,11 +113,9 @@ class BrowseSourceScreenModel(
|
||||
getRemoteManga.subscribe(sourceId, listing.query ?: "", listing.filters)
|
||||
}.flow.map { pagingData ->
|
||||
pagingData.map {
|
||||
val networkManga = it.toDomainManga(sourceId)
|
||||
networkToLocalManga.await(networkManga)
|
||||
networkToLocalManga.await(it.toDomainManga(sourceId))
|
||||
.let { localManga -> getManga.subscribe(localManga.url, localManga.source) }
|
||||
.filterNotNull()
|
||||
.map { manga -> manga.shouldUseNetworkMangaInfo(networkManga) }
|
||||
.stateIn(ioCoroutineScope)
|
||||
}
|
||||
.filter { !hideInLibraryItems || !it.value.favorite }
|
||||
|
||||
@@ -166,9 +166,7 @@ abstract class SearchScreenModel(
|
||||
}
|
||||
|
||||
val titles = page.mangas.map {
|
||||
val networkManga = it.toDomainManga(source.id)
|
||||
networkToLocalManga.await(networkManga)
|
||||
.shouldUseNetworkMangaInfo(networkManga)
|
||||
networkToLocalManga.await(it.toDomainManga(source.id))
|
||||
}
|
||||
|
||||
if (isActive) {
|
||||
|
||||
@@ -15,7 +15,6 @@ import kotlinx.coroutines.flow.update
|
||||
import tachiyomi.core.common.util.lang.launchIO
|
||||
import tachiyomi.domain.chapter.interactor.GetChapterByUrlAndMangaId
|
||||
import tachiyomi.domain.chapter.model.Chapter
|
||||
import tachiyomi.domain.manga.interactor.GetMangaByUrlAndSourceId
|
||||
import tachiyomi.domain.manga.interactor.NetworkToLocalManga
|
||||
import tachiyomi.domain.manga.model.Manga
|
||||
import tachiyomi.domain.source.service.SourceManager
|
||||
@@ -27,7 +26,6 @@ class DeepLinkScreenModel(
|
||||
private val sourceManager: SourceManager = Injekt.get(),
|
||||
private val networkToLocalManga: NetworkToLocalManga = Injekt.get(),
|
||||
private val getChapterByUrlAndMangaId: GetChapterByUrlAndMangaId = Injekt.get(),
|
||||
private val getMangaByUrlAndSourceId: GetMangaByUrlAndSourceId = Injekt.get(),
|
||||
private val syncChaptersWithSource: SyncChaptersWithSource = Injekt.get(),
|
||||
) : StateScreenModel<DeepLinkScreenModel.State>(State.Loading) {
|
||||
|
||||
@@ -74,9 +72,7 @@ class DeepLinkScreenModel(
|
||||
}
|
||||
|
||||
private suspend fun getMangaFromSManga(sManga: SManga, sourceId: Long): Manga {
|
||||
val networkManga = sManga.toDomainManga(sourceId)
|
||||
return networkToLocalManga.await(networkManga)
|
||||
.shouldUseNetworkMangaInfo(networkManga)
|
||||
return networkToLocalManga.await(sManga.toDomainManga(sourceId))
|
||||
}
|
||||
|
||||
sealed interface State {
|
||||
|
||||
Reference in New Issue
Block a user