From 1e3d9a00f2366919430a8077ad79808c8514d793 Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 9 Jul 2023 09:54:05 -0400 Subject: [PATCH] Handle chapter read status in correct order Fixes #9687 --- .../eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt index 5cd95e5a6..57c6d61df 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt @@ -510,6 +510,12 @@ class ReaderViewModel( readerChapter.requestedPage = pageIndex readerChapter.chapter.last_page_read = pageIndex + if (readerChapter.pages?.lastIndex == pageIndex) { + readerChapter.chapter.read = true + updateTrackChapterRead(readerChapter) + deleteChapterIfNeeded(readerChapter) + } + updateChapter.await( ChapterUpdate( id = readerChapter.chapter.id!!, @@ -518,12 +524,6 @@ class ReaderViewModel( lastPageRead = readerChapter.chapter.last_page_read.toLong(), ), ) - - if (readerChapter.pages?.lastIndex == pageIndex) { - readerChapter.chapter.read = true - updateTrackChapterRead(readerChapter) - deleteChapterIfNeeded(readerChapter) - } } }