MangaScreenModel: Start downloads in IO dispatcher (#10241)

This commit is contained in:
Ivan Iskandar 2023-12-17 21:55:54 +07:00 committed by GitHub
parent c6356fe4b2
commit 09531e7f5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -636,8 +636,9 @@ class MangaScreenModel(
) {
val successState = successState ?: return
screenModelScope.launchNonCancellable {
if (startNow) {
val chapterId = chapters.singleOrNull()?.id ?: return
val chapterId = chapters.singleOrNull()?.id ?: return@launchNonCancellable
downloadManager.startDownloadNow(chapterId)
} else {
downloadChapters(chapters)
@ -647,7 +648,6 @@ class MangaScreenModel(
updateSuccessState { state ->
state.copy(hasPromptedToAddBefore = true)
}
screenModelScope.launch {
val result = snackbarHostState.showSnackbar(
message = context.stringResource(MR.strings.snack_add_to_library),
actionLabel = context.stringResource(MR.strings.action_add),