Launch the download warning toast in the UI thread

Co-authored-by: jobobby04 <jobobby04@users.noreply.github.com>
This commit is contained in:
arkon 2021-10-23 17:05:22 -04:00
parent ccd7c8df53
commit 7cd54dc8f0

View File

@ -20,6 +20,7 @@ import eu.kanade.tachiyomi.util.lang.RetryWithDelay
import eu.kanade.tachiyomi.util.lang.launchIO import eu.kanade.tachiyomi.util.lang.launchIO
import eu.kanade.tachiyomi.util.lang.launchNow import eu.kanade.tachiyomi.util.lang.launchNow
import eu.kanade.tachiyomi.util.lang.plusAssign import eu.kanade.tachiyomi.util.lang.plusAssign
import eu.kanade.tachiyomi.util.lang.withUIContext
import eu.kanade.tachiyomi.util.storage.DiskUtil import eu.kanade.tachiyomi.util.storage.DiskUtil
import eu.kanade.tachiyomi.util.storage.saveTo import eu.kanade.tachiyomi.util.storage.saveTo
import eu.kanade.tachiyomi.util.system.ImageUtil import eu.kanade.tachiyomi.util.system.ImageUtil
@ -267,8 +268,10 @@ class Downloader(
if (autoStart && wasEmpty) { if (autoStart && wasEmpty) {
val maxDownloadsFromSource = queue.groupBy { it.source }.maxOf { it.value.size } val maxDownloadsFromSource = queue.groupBy { it.source }.maxOf { it.value.size }
if (maxDownloadsFromSource > CHAPTERS_PER_SOURCE_QUEUE_WARNING_THRESHOLD) { if (maxDownloadsFromSource > CHAPTERS_PER_SOURCE_QUEUE_WARNING_THRESHOLD) {
withUIContext {
context.toast(R.string.download_queue_size_warning, Toast.LENGTH_LONG) context.toast(R.string.download_queue_size_warning, Toast.LENGTH_LONG)
} }
}
DownloadService.start(context) DownloadService.start(context)
} }
} }