🛠️ Small fixes & improvements in Reader loading

* Preventing error from showing (after successful load)
* Removed unnecessary delay
This commit is contained in:
Acclorite 2024-10-07 17:28:28 +03:00
parent 0fb950ff57
commit 5728253988

View file

@ -103,10 +103,10 @@ class ReaderViewModel @Inject constructor(
event.checkForUpdate() event.checkForUpdate()
delay(100)
_state.update { _state.update {
it.copy( it.copy(
loading = false loading = false,
errorMessage = null
) )
} }
@ -526,7 +526,7 @@ class ReaderViewModel @Inject constructor(
} }
clear() clear()
launch { withContext(Dispatchers.Default) {
onEvent( onEvent(
ReaderEvent.OnShowHideMenu( ReaderEvent.OnShowHideMenu(
show = false, show = false,
@ -535,6 +535,8 @@ class ReaderViewModel @Inject constructor(
activity = activity activity = activity
) )
) )
}
onEvent( onEvent(
ReaderEvent.OnLoadText( ReaderEvent.OnLoadText(
checkForUpdate = { checkForUpdate = {
@ -557,7 +559,6 @@ class ReaderViewModel @Inject constructor(
) )
} }
} }
}
@OptIn(FlowPreview::class) @OptIn(FlowPreview::class)
fun onUpdateProgress(refreshList: (Book) -> Unit) { fun onUpdateProgress(refreshList: (Book) -> Unit) {