Probably fix bookmarks breaking reading progress

This commit is contained in:
Jobobby04 2022-01-16 11:40:49 -05:00
parent cccf956fae
commit 992679e470
2 changed files with 5 additions and 5 deletions

View File

@ -322,7 +322,7 @@ class ReaderPresenter(
ReaderChapterItem(
it.chapter,
manga!!,
it.chapter == currentChapter?.chapter,
it.chapter.id == currentChapter?.chapter?.id,
context,
preferences.dateFormat(),
decimalFormat
@ -585,10 +585,10 @@ class ReaderPresenter(
}
// SY -->
fun toggleBookmark(chapter: Chapter) {
chapter.bookmark = !chapter.bookmark
fun toggleBookmark(chapterId: Long, bookmarked: Boolean) {
val chapter = chapterList.find { it.chapter.id == chapterId }?.chapter ?: return
chapter.bookmark = bookmarked
db.updateChapterProgress(chapter).executeAsBlocking()
chapterList.firstOrNull { it.chapter.id == chapter.id }?.let { it.chapter.bookmark == !chapter.bookmark }
}
// SY <--

View File

@ -69,7 +69,7 @@ class ReaderChapterDialog(private val activity: ReaderActivity) : ReaderChapterA
}
override fun bookmarkChapter(chapter: Chapter) {
presenter.toggleBookmark(chapter)
presenter.toggleBookmark(chapter.id!!, !chapter.bookmark)
refreshList(scroll = false)
}
}