From 473dc688f0bbb9732e3d75d137bc7025418d9bcf Mon Sep 17 00:00:00 2001 From: Ivan Iskandar <12537387+ivaniskandar@users.noreply.github.com> Date: Tue, 19 Jul 2022 03:22:49 +0700 Subject: [PATCH] Fix download status not updated properly after starting batch download (#7561) --- .../main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt | 4 ++-- .../eu/kanade/tachiyomi/ui/recent/updates/UpdatesPresenter.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt index 2bc4596dc..06463c5ab 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt @@ -417,7 +417,7 @@ class MangaPresenter( downloadManager.queue.getStatusAsFlow() .filter { it.manga.id == successState?.manga?.id } .catch { error -> logcat(LogPriority.ERROR, error) } - .collectLatest { + .collect { withUIContext { updateDownloadState(it) } @@ -429,7 +429,7 @@ class MangaPresenter( downloadManager.queue.getProgressAsFlow() .filter { it.manga.id == successState?.manga?.id } .catch { error -> logcat(LogPriority.ERROR, error) } - .collectLatest { + .collect { withUIContext { updateDownloadState(it) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesPresenter.kt index 4b43498b1..6e34daeb5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesPresenter.kt @@ -157,7 +157,7 @@ class UpdatesPresenter( observeDownloadsStatusJob = presenterScope.launchIO { downloadManager.queue.getStatusAsFlow() .catch { error -> logcat(LogPriority.ERROR, error) } - .collectLatest { + .collect { withUIContext { updateDownloadState(it) } @@ -168,7 +168,7 @@ class UpdatesPresenter( observeDownloadsPageJob = presenterScope.launchIO { downloadManager.queue.getProgressAsFlow() .catch { error -> logcat(LogPriority.ERROR, error) } - .collectLatest { + .collect { withUIContext { updateDownloadState(it) }