Browse Source

Handle chapter read status in correct order

Fixes #9687
arkon 1 year ago
parent
commit
1e3d9a00f2

+ 6 - 6
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)
-            }
         }
     }