mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-16 14:09:17 +01:00
Move reader preloading to IO scope
Maybe fixes #8440
(cherry picked from commit e052bdef96
)
This commit is contained in:
parent
0ea3ac9807
commit
d61db5931e
@ -871,7 +871,7 @@ class ReaderActivity : BaseActivity() {
|
|||||||
* the viewer is reaching the beginning or end of a chapter or the transition page is active.
|
* the viewer is reaching the beginning or end of a chapter or the transition page is active.
|
||||||
*/
|
*/
|
||||||
fun requestPreloadChapter(chapter: ReaderChapter) {
|
fun requestPreloadChapter(chapter: ReaderChapter) {
|
||||||
lifecycleScope.launch { viewModel.preloadChapter(chapter) }
|
lifecycleScope.launchIO { viewModel.preloadChapter(chapter) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -388,20 +388,17 @@ class ReaderViewModel(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
logcat { "Preloading ${chapter.chapter.url}" }
|
|
||||||
|
|
||||||
val loader = loader ?: return
|
val loader = loader ?: return
|
||||||
withIOContext {
|
try {
|
||||||
try {
|
logcat { "Preloading ${chapter.chapter.url}" }
|
||||||
loader.loadChapter(chapter)
|
loader.loadChapter(chapter)
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
if (e is CancellationException) {
|
if (e is CancellationException) {
|
||||||
throw e
|
throw e
|
||||||
}
|
|
||||||
return@withIOContext
|
|
||||||
}
|
}
|
||||||
eventChannel.trySend(Event.ReloadViewerChapters)
|
return
|
||||||
}
|
}
|
||||||
|
eventChannel.trySend(Event.ReloadViewerChapters)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user