diff --git a/app/src/main/java/io/legado/app/data/dao/BookDao.kt b/app/src/main/java/io/legado/app/data/dao/BookDao.kt index 06874c7ec..b4dc49846 100644 --- a/app/src/main/java/io/legado/app/data/dao/BookDao.kt +++ b/app/src/main/java/io/legado/app/data/dao/BookDao.kt @@ -30,8 +30,8 @@ interface BookDao { @Query("select * from books where bookUrl = :bookUrl") fun getBook(bookUrl: String): Book? - @Query("select * from books order by durChapterTime desc limit 1") - fun getLastReadBook(): Book? + @get:Query("select * from books order by durChapterTime desc limit 1") + val lastReadBook: Book? @get:Query("SELECT bookUrl FROM books") val allBookUrls: List diff --git a/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt b/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt index c2e70a9ee..358ec885c 100644 --- a/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt @@ -42,7 +42,7 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { val book = if (!bookUrl.isNullOrEmpty()) { App.db.bookDao().getBook(bookUrl) } else { - App.db.bookDao().getLastReadBook() + App.db.bookDao().lastReadBook } book?.let { durChapterIndex = book.durChapterIndex