mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-27 16:26:29 +03:00
parent
d522d6d545
commit
e052bdef96
2 changed files with 9 additions and 12 deletions
|
@ -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,21 +388,18 @@ 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
|
return
|
||||||
}
|
}
|
||||||
eventChannel.trySend(Event.ReloadViewerChapters)
|
eventChannel.trySend(Event.ReloadViewerChapters)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called every time a page changes on the reader. Used to mark the flag of chapters being
|
* Called every time a page changes on the reader. Used to mark the flag of chapters being
|
||||||
|
|
Loading…
Reference in a new issue