🛠️ Fix crash in Reader
* Fixed crash in Reader caused by state not being properly initialized
This commit is contained in:
parent
35eadafb9b
commit
896e584e6d
1 changed files with 2 additions and 2 deletions
|
|
@ -562,7 +562,7 @@ class ReaderViewModel @Inject constructor(
|
||||||
|
|
||||||
@OptIn(FlowPreview::class)
|
@OptIn(FlowPreview::class)
|
||||||
fun onUpdateProgress(refreshList: (Book) -> Unit) {
|
fun onUpdateProgress(refreshList: (Book) -> Unit) {
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.Main) {
|
||||||
snapshotFlow {
|
snapshotFlow {
|
||||||
_state.value.listState.firstVisibleItemIndex to _state.value.listState.firstVisibleItemScrollOffset
|
_state.value.listState.firstVisibleItemIndex to _state.value.listState.firstVisibleItemScrollOffset
|
||||||
}
|
}
|
||||||
|
|
@ -589,7 +589,7 @@ class ReaderViewModel @Inject constructor(
|
||||||
|
|
||||||
@OptIn(FlowPreview::class)
|
@OptIn(FlowPreview::class)
|
||||||
fun onUpdateCurrentChapter() {
|
fun onUpdateCurrentChapter() {
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.Main) {
|
||||||
snapshotFlow {
|
snapshotFlow {
|
||||||
_state.value.listState.firstVisibleItemIndex
|
_state.value.listState.firstVisibleItemIndex
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue