add 1 second timeout to fetching chapters after reader transition

shouldn't ever happen but if someone has a reaaaally bad cpu/storage, they wont be stuck
This commit is contained in:
Jays2Kings 2022-04-27 16:01:27 -04:00
parent c05cb6c31a
commit 4ffa72c56f

View file

@ -111,6 +111,7 @@ import eu.kanade.tachiyomi.util.view.toolbarHeight
import eu.kanade.tachiyomi.util.view.withFadeTransaction
import eu.kanade.tachiyomi.widget.LinearLayoutManagerAccurateOffset
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withTimeoutOrNull
import timber.log.Timber
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -578,7 +579,8 @@ class MangaDetailsController :
if (!returningFromReader) return
returningFromReader = false
runBlocking {
val chapters = presenter.getChaptersNow()
val chapters =
withTimeoutOrNull(1000) { presenter.getChaptersNow() } ?: return@runBlocking
tabletAdapter?.notifyItemChanged(0)
adapter?.setChapters(chapters)
addMangaHeader()