Avoid preload download check if chapter is already loaded or loading

Maybe fixes #8953, #9060

(cherry picked from commit d522d6d545bfbd4e4f8f60975bddcd5f6bcc69ac)
(cherry picked from commit b42c5b58ea6fe1ee8121143d0f53fd9adf1e7f3d)
This commit is contained in:
arkon 2023-02-12 16:03:24 -05:00 committed by Jobobby04
parent ed73a1b818
commit c93a0e8f93

View File

@ -448,6 +448,10 @@ class ReaderViewModel(
* that the user doesn't have to wait too long to continue reading.
*/
private suspend fun preload(chapter: ReaderChapter) {
if (chapter.state is ReaderChapter.State.Loaded || chapter.state == ReaderChapter.State.Loading) {
return
}
if (chapter.pageLoader is HttpPageLoader) {
val manga = manga ?: return
val dbChapter = chapter.chapter