Don't start at last read page if chapter is completely marked as read
Fixes #8737 (cherry picked from commit 90db3acefd6290310c8cf8bab2563b3413a8cf4a)
This commit is contained in:
parent
33b054edfa
commit
7a3b7f4daa
@ -86,6 +86,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
|||||||
import kotlinx.coroutines.flow.asStateFlow
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
import kotlinx.coroutines.flow.catch
|
import kotlinx.coroutines.flow.catch
|
||||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||||
|
import kotlinx.coroutines.flow.filterNotNull
|
||||||
import kotlinx.coroutines.flow.first
|
import kotlinx.coroutines.flow.first
|
||||||
import kotlinx.coroutines.flow.firstOrNull
|
import kotlinx.coroutines.flow.firstOrNull
|
||||||
import kotlinx.coroutines.flow.launchIn
|
import kotlinx.coroutines.flow.launchIn
|
||||||
@ -250,11 +251,12 @@ class ReaderViewModel(
|
|||||||
// To save state
|
// To save state
|
||||||
state.map { it.viewerChapters?.currChapter }
|
state.map { it.viewerChapters?.currChapter }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
.filterNotNull()
|
||||||
.onEach { currentChapter ->
|
.onEach { currentChapter ->
|
||||||
if (currentChapter != null) {
|
if (!currentChapter.chapter.read) {
|
||||||
currentChapter.requestedPage = currentChapter.chapter.last_page_read
|
currentChapter.requestedPage = currentChapter.chapter.last_page_read
|
||||||
chapterId = currentChapter.chapter.id!!
|
|
||||||
}
|
}
|
||||||
|
chapterId = currentChapter.chapter.id!!
|
||||||
}
|
}
|
||||||
.launchIn(viewModelScope)
|
.launchIn(viewModelScope)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user