Fix all in one manga page being blank after clicking a button
This commit is contained in:
parent
1713dd4ea0
commit
5886cb7406
@ -467,7 +467,7 @@ class MangaAllInOneController :
|
|||||||
if (manga.initialized) {
|
if (manga.initialized) {
|
||||||
// Update view.
|
// Update view.
|
||||||
setMangaInfo(manga, source, chapters)
|
setMangaInfo(manga, source, chapters)
|
||||||
if (fromSource && !presenter.hasRequested) {
|
if (fromSource && !presenter.hasRequested && chapters.isNullOrEmpty()) {
|
||||||
fetchMangaFromSource(fetchManga = false)
|
fetchMangaFromSource(fetchManga = false)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -134,7 +134,9 @@ class MangaAllInOnePresenter(
|
|||||||
scope.launch(Dispatchers.IO) {
|
scope.launch(Dispatchers.IO) {
|
||||||
updateChapters()
|
updateChapters()
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
controller.onNextManga(manga, source, chapters)
|
Observable.just(manga)
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribeLatestCache({ view, manga -> view.onNextManga(manga, source, chapters) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,23 +151,33 @@ class MangaAllInOnePresenter(
|
|||||||
|
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
// set chapter count
|
// set chapter count
|
||||||
controller.setChapterCount(chapterCount)
|
Observable.just(chapterCount)
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribeLatestCache({ view, chapterCount -> view.setChapterCount(chapterCount) })
|
||||||
// update last update date
|
// update last update date
|
||||||
controller.setLastUpdateDate(lastUpdateDate)
|
Observable.just(lastUpdateDate)
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribeLatestCache({ view, lastUpdateDate -> view.setLastUpdateDate(lastUpdateDate) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateManga() {
|
private fun updateManga(updateInfo: Boolean = true) {
|
||||||
scope.launch(Dispatchers.IO) {
|
scope.launch(Dispatchers.IO) {
|
||||||
val manga = db.getManga(manga.url, manga.source).executeAsBlocking()!!
|
var manga2: Manga? = null
|
||||||
updateChapters()
|
if (updateInfo) {
|
||||||
updateChapterInfo()
|
manga2 = db.getManga(manga.url, manga.source).executeAsBlocking()!!
|
||||||
|
updateChapters()
|
||||||
|
updateChapterInfo()
|
||||||
|
}
|
||||||
|
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
controller.onNextManga(
|
if (manga2 != null) {
|
||||||
manga, source, chapters
|
Observable.just(manga2)
|
||||||
)
|
} else {
|
||||||
|
Observable.just(manga)
|
||||||
|
}.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribeLatestCache({ view, manga -> view.onNextManga(manga, source, chapters) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -210,7 +222,7 @@ class MangaAllInOnePresenter(
|
|||||||
updateChapterInfo()
|
updateChapterInfo()
|
||||||
}
|
}
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
controller.onNextManga(this@MangaAllInOnePresenter.manga, this@MangaAllInOnePresenter.source, this@MangaAllInOnePresenter.chapters)
|
updateManga(updateInfo = false)
|
||||||
controller.onFetchMangaDone()
|
controller.onFetchMangaDone()
|
||||||
}
|
}
|
||||||
} catch (e: java.lang.Exception) {
|
} catch (e: java.lang.Exception) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user