mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 02:01:48 +01:00
parent
a24afa9a76
commit
01553b1ed8
@ -145,7 +145,7 @@ abstract class TrackService(val id: Long) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
suspend fun setRemoteLastChapterRead(track: Track, chapterNumber: Int) {
|
suspend fun setRemoteLastChapterRead(track: Track, chapterNumber: Int) {
|
||||||
if (track.last_chapter_read == 0F && track.last_chapter_read < chapterNumber && track.status != getRereadingStatus()) {
|
if (track.last_chapter_read == 0f && track.last_chapter_read < chapterNumber && track.status != getRereadingStatus()) {
|
||||||
track.status = getReadingStatus()
|
track.status = getReadingStatus()
|
||||||
}
|
}
|
||||||
track.last_chapter_read = chapterNumber.toFloat()
|
track.last_chapter_read = chapterNumber.toFloat()
|
||||||
|
@ -402,7 +402,7 @@ class ReaderViewModel(
|
|||||||
|
|
||||||
// Save last page read and mark as read if needed
|
// Save last page read and mark as read if needed
|
||||||
viewModelScope.launchNonCancellable {
|
viewModelScope.launchNonCancellable {
|
||||||
updateChapterProgress(selectedChapter, page.index)
|
updateChapterProgress(selectedChapter, page)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedChapter != getCurrentChapter()) {
|
if (selectedChapter != getCurrentChapter()) {
|
||||||
@ -482,13 +482,15 @@ class ReaderViewModel(
|
|||||||
* Saves the chapter progress (last read page and whether it's read)
|
* Saves the chapter progress (last read page and whether it's read)
|
||||||
* if incognito mode isn't on.
|
* if incognito mode isn't on.
|
||||||
*/
|
*/
|
||||||
private suspend fun updateChapterProgress(readerChapter: ReaderChapter, pageIndex: Int) {
|
private suspend fun updateChapterProgress(readerChapter: ReaderChapter, page: Page) {
|
||||||
|
val pageIndex = page.index
|
||||||
|
|
||||||
mutableState.update {
|
mutableState.update {
|
||||||
it.copy(currentPage = pageIndex + 1)
|
it.copy(currentPage = pageIndex + 1)
|
||||||
}
|
}
|
||||||
|
readerChapter.requestedPage = pageIndex
|
||||||
|
|
||||||
if (!incognitoMode) {
|
if (!incognitoMode && page.status != Page.State.ERROR) {
|
||||||
readerChapter.requestedPage = pageIndex
|
|
||||||
readerChapter.chapter.last_page_read = pageIndex
|
readerChapter.chapter.last_page_read = pageIndex
|
||||||
|
|
||||||
if (readerChapter.pages?.lastIndex == pageIndex) {
|
if (readerChapter.pages?.lastIndex == pageIndex) {
|
||||||
@ -501,7 +503,6 @@ class ReaderViewModel(
|
|||||||
ChapterUpdate(
|
ChapterUpdate(
|
||||||
id = readerChapter.chapter.id!!,
|
id = readerChapter.chapter.id!!,
|
||||||
read = readerChapter.chapter.read,
|
read = readerChapter.chapter.read,
|
||||||
bookmark = readerChapter.chapter.bookmark,
|
|
||||||
lastPageRead = readerChapter.chapter.last_page_read.toLong(),
|
lastPageRead = readerChapter.chapter.last_page_read.toLong(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user