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
|
val controller = view ?: return
|
||||||
|
|
||||||
isLockedFromSearch = controller.shouldLockIfNeeded && SecureActivityDelegate.shouldBeLocked()
|
isLockedFromSearch = controller.shouldLockIfNeeded && SecureActivityDelegate.shouldBeLocked()
|
||||||
|
|
||||||
|
presenterScope.launchUI {
|
||||||
|
currentManga.collectLatest {
|
||||||
|
if (it == null) return@collectLatest
|
||||||
|
|
||||||
|
controller.updateHeader()
|
||||||
|
}
|
||||||
|
}
|
||||||
if (currentManga.value == null) runBlocking { refreshMangaFromDb() }
|
if (currentManga.value == null) runBlocking { refreshMangaFromDb() }
|
||||||
syncData()
|
syncData()
|
||||||
|
|
||||||
|
@ -218,13 +226,6 @@ class MangaDetailsPresenter(
|
||||||
presenterScope.launchIO {
|
presenterScope.launchIO {
|
||||||
downloadManager.queueState.collectLatest(::onQueueUpdate)
|
downloadManager.queueState.collectLatest(::onQueueUpdate)
|
||||||
}
|
}
|
||||||
presenterScope.launchUI {
|
|
||||||
currentManga.collectLatest {
|
|
||||||
if (it == null) return@collectLatest
|
|
||||||
|
|
||||||
controller.updateHeader()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
presenterScope.launchIO {
|
presenterScope.launchIO {
|
||||||
currentChapters.collectLatest { chapters ->
|
currentChapters.collectLatest { chapters ->
|
||||||
allChapters = if (!isScanlatorFiltered()) chapters else getChapter.awaitAll(mangaId, false).map { it.toModel() }
|
allChapters = if (!isScanlatorFiltered()) chapters else getChapter.awaitAll(mangaId, false).map { it.toModel() }
|
||||||
|
@ -258,7 +259,7 @@ class MangaDetailsPresenter(
|
||||||
.onEach { onUpdateManga() }
|
.onEach { onUpdateManga() }
|
||||||
.launchIn(presenterScope)
|
.launchIn(presenterScope)
|
||||||
|
|
||||||
val updateMangaNeeded = !manga.initialized
|
val updateMangaNeeded = currentManga.value?.initialized != true
|
||||||
val updateChaptersNeeded = runBlocking { setAndGetChapters() }.isEmpty()
|
val updateChaptersNeeded = runBlocking { setAndGetChapters() }.isEmpty()
|
||||||
|
|
||||||
presenterScope.launch {
|
presenterScope.launch {
|
||||||
|
@ -496,7 +497,7 @@ class MangaDetailsPresenter(
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
if (preferences.context.imageLoader.execute(request) is SuccessResult) {
|
if (preferences.context.imageLoader.execute(request) is SuccessResult) {
|
||||||
withContext(Dispatchers.Main) {
|
withUIContext {
|
||||||
view?.setPaletteColor()
|
view?.setPaletteColor()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue