@ -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<String>
@ -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