MangaScreenModel: Start downloads in IO dispatcher (#10241)

pull/10238/head
Ivan Iskandar 9 months ago committed by GitHub
parent c6356fe4b2
commit 09531e7f5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

Loading…
Cancel
Save