🛠️ Fix issues with book loading

* Fixed issue with infinite loading if you open the book two times in a row
* Fixed issue with checking for update cancellation
This commit is contained in:
Acclorite 2024-10-22 19:41:39 +03:00
parent 6017f887e1
commit 343e5bc8bd

View file

@ -439,6 +439,9 @@ class ReaderViewModel @Inject constructor(
yield()
val result = checkForTextUpdate.execute(bookId = _state.value.book.id)
yield()
when (result) {
is Resource.Success -> {
if (result.data == null) {
@ -601,7 +604,6 @@ class ReaderViewModel @Inject constructor(
}
eventJob.cancel()
eventJob.join()
eventJob = SupervisorJob()
}
}
@ -673,9 +675,8 @@ class ReaderViewModel @Inject constructor(
return show || !fullscreenMode
}
private suspend fun clear() {
private fun clear() {
eventJob.cancel()
eventJob.join()
eventJob = SupervisorJob()
}
}