mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-29 11:08:53 +03:00
MangaScreenModel: Start downloads in IO dispatcher (#10241)
This commit is contained in:
parent
c6356fe4b2
commit
09531e7f5a
1 changed files with 11 additions and 11 deletions
|
@ -636,8 +636,9 @@ class MangaScreenModel(
|
||||||
) {
|
) {
|
||||||
val successState = successState ?: return
|
val successState = successState ?: return
|
||||||
|
|
||||||
|
screenModelScope.launchNonCancellable {
|
||||||
if (startNow) {
|
if (startNow) {
|
||||||
val chapterId = chapters.singleOrNull()?.id ?: return
|
val chapterId = chapters.singleOrNull()?.id ?: return@launchNonCancellable
|
||||||
downloadManager.startDownloadNow(chapterId)
|
downloadManager.startDownloadNow(chapterId)
|
||||||
} else {
|
} else {
|
||||||
downloadChapters(chapters)
|
downloadChapters(chapters)
|
||||||
|
@ -647,7 +648,6 @@ class MangaScreenModel(
|
||||||
updateSuccessState { state ->
|
updateSuccessState { state ->
|
||||||
state.copy(hasPromptedToAddBefore = true)
|
state.copy(hasPromptedToAddBefore = true)
|
||||||
}
|
}
|
||||||
screenModelScope.launch {
|
|
||||||
val result = snackbarHostState.showSnackbar(
|
val result = snackbarHostState.showSnackbar(
|
||||||
message = context.stringResource(MR.strings.snack_add_to_library),
|
message = context.stringResource(MR.strings.snack_add_to_library),
|
||||||
actionLabel = context.stringResource(MR.strings.action_add),
|
actionLabel = context.stringResource(MR.strings.action_add),
|
||||||
|
|
Loading…
Reference in a new issue