feat: 优化代码

pull/190/head
kunfei 5 years ago
parent c54fc57c42
commit 38dfab637b
  1. 6
      app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt

@ -158,8 +158,10 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
chapters chapters
) )
book.durChapterTitle = chapters[book.durChapterIndex].title book.durChapterTitle = chapters[book.durChapterIndex].title
App.db.bookDao().insert(book) if (inBookshelf) {
App.db.bookChapterDao().insert(*chapters.toTypedArray()) App.db.bookDao().insert(book)
App.db.bookChapterDao().insert(*chapters.toTypedArray())
}
bookData.postValue(book) bookData.postValue(book)
chapterListData.postValue(chapters) chapterListData.postValue(chapters)
} }

Loading…
Cancel
Save