pull/37/head
kunfei 5 years ago
parent f94d9503d7
commit fcac3946c8
  1. 6
      app/src/main/java/io/legado/app/ui/main/MainViewModel.kt

@ -33,13 +33,17 @@ class MainViewModel(application: Application) : BaseViewModel(application) {
} }
WebBook(bookSource).getChapterList(book) WebBook(bookSource).getChapterList(book)
.onSuccess(IO) { .onSuccess(IO) {
synchronized(this) {
updateList.remove(book.bookUrl)
postEvent(Bus.UP_BOOK, book.bookUrl)
}
it?.let { it?.let {
App.db.bookDao().update(book) App.db.bookDao().update(book)
App.db.bookChapterDao().delByBook(book.bookUrl) App.db.bookChapterDao().delByBook(book.bookUrl)
App.db.bookChapterDao().insert(*it.toTypedArray()) App.db.bookChapterDao().insert(*it.toTypedArray())
} }
} }
.onFinally { .onError {
synchronized(this) { synchronized(this) {
updateList.remove(book.bookUrl) updateList.remove(book.bookUrl)
postEvent(Bus.UP_BOOK, book.bookUrl) postEvent(Bus.UP_BOOK, book.bookUrl)

Loading…
Cancel
Save