mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-10 20:57:24 +01:00
Fix for perpetually loading chapters (#2718)
* Fix for perpetually loading chapters * Removed page count check
This commit is contained in:
parent
124f0e7093
commit
cd867f800e
@ -26,7 +26,7 @@ class ChapterLoader(
|
|||||||
* completes if the chapter is already loaded.
|
* completes if the chapter is already loaded.
|
||||||
*/
|
*/
|
||||||
fun loadChapter(chapter: ReaderChapter): Completable {
|
fun loadChapter(chapter: ReaderChapter): Completable {
|
||||||
if (chapter.state is ReaderChapter.State.Loaded) {
|
if (chapterIsReady(chapter)) {
|
||||||
return Completable.complete()
|
return Completable.complete()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,6 +61,13 @@ class ChapterLoader(
|
|||||||
.doOnError { chapter.state = ReaderChapter.State.Error(it) }
|
.doOnError { chapter.state = ReaderChapter.State.Error(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks [chapter] to be loaded based on present pages and loader in addition to state.
|
||||||
|
*/
|
||||||
|
private fun chapterIsReady(chapter: ReaderChapter): Boolean {
|
||||||
|
return chapter.state is ReaderChapter.State.Loaded && chapter.pageLoader != null
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the page loader to use for this [chapter].
|
* Returns the page loader to use for this [chapter].
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user