Use SQLDelight for all Chapter related queries (#7440)

This commit is contained in:
Andreas
2022-07-03 00:51:33 +02:00
committed by GitHub
parent 76c0ead1db
commit 29633b64aa
9 changed files with 63 additions and 65 deletions

View File

@@ -540,13 +540,16 @@ class ReaderPresenter(
* Bookmarks the currently active chapter.
*/
fun bookmarkCurrentChapter(bookmarked: Boolean) {
if (getCurrentChapter()?.chapter == null) {
return
val chapter = getCurrentChapter()?.chapter ?: return
chapter.bookmark = bookmarked // Otherwise the bookmark icon doesn't update
launchIO {
updateChapter.await(
ChapterUpdate(
id = chapter.id!!.toLong(),
bookmark = bookmarked,
),
)
}
val chapter = getCurrentChapter()?.chapter!!
chapter.bookmark = bookmarked
db.updateChapterProgress(chapter).executeAsBlocking()
}
/**