mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
fix(manga): Group currentManga setup together
This commit is contained in:
parent
60fe907cc0
commit
4a0f578211
1 changed files with 10 additions and 9 deletions
|
@ -200,6 +200,14 @@ class MangaDetailsPresenter(
|
|||
val controller = view ?: return
|
||||
|
||||
isLockedFromSearch = controller.shouldLockIfNeeded && SecureActivityDelegate.shouldBeLocked()
|
||||
|
||||
presenterScope.launchUI {
|
||||
currentManga.collectLatest {
|
||||
if (it == null) return@collectLatest
|
||||
|
||||
controller.updateHeader()
|
||||
}
|
||||
}
|
||||
if (currentManga.value == null) runBlocking { refreshMangaFromDb() }
|
||||
syncData()
|
||||
|
||||
|
@ -218,13 +226,6 @@ class MangaDetailsPresenter(
|
|||
presenterScope.launchIO {
|
||||
downloadManager.queueState.collectLatest(::onQueueUpdate)
|
||||
}
|
||||
presenterScope.launchUI {
|
||||
currentManga.collectLatest {
|
||||
if (it == null) return@collectLatest
|
||||
|
||||
controller.updateHeader()
|
||||
}
|
||||
}
|
||||
presenterScope.launchIO {
|
||||
currentChapters.collectLatest { chapters ->
|
||||
allChapters = if (!isScanlatorFiltered()) chapters else getChapter.awaitAll(mangaId, false).map { it.toModel() }
|
||||
|
@ -258,7 +259,7 @@ class MangaDetailsPresenter(
|
|||
.onEach { onUpdateManga() }
|
||||
.launchIn(presenterScope)
|
||||
|
||||
val updateMangaNeeded = !manga.initialized
|
||||
val updateMangaNeeded = currentManga.value?.initialized != true
|
||||
val updateChaptersNeeded = runBlocking { setAndGetChapters() }.isEmpty()
|
||||
|
||||
presenterScope.launch {
|
||||
|
@ -496,7 +497,7 @@ class MangaDetailsPresenter(
|
|||
.build()
|
||||
|
||||
if (preferences.context.imageLoader.execute(request) is SuccessResult) {
|
||||
withContext(Dispatchers.Main) {
|
||||
withUIContext {
|
||||
view?.setPaletteColor()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue