pull/32/head
kunfei 5 years ago
parent 2d1ef9fd6a
commit 54333ffc4f
  1. 12
      app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfViewModel.kt

@ -35,8 +35,10 @@ class BookshelfViewModel(application: Application) : BaseViewModel(application)
if (book.origin != BookType.local) {
val bookSource = App.db.bookSourceDao().getBookSource(book.origin)
bookSource?.let {
updateList.add(book.bookUrl)
postEvent(Bus.UP_BOOK, book.bookUrl)
synchronized(this) {
updateList.add(book.bookUrl)
postEvent(Bus.UP_BOOK, book.bookUrl)
}
WebBook(bookSource).getChapterList(book).onSuccess(IO) {
it?.let {
App.db.bookDao().update(book)
@ -45,8 +47,10 @@ class BookshelfViewModel(application: Application) : BaseViewModel(application)
}
}
}.onFinally {
updateList.remove(book.bookUrl)
postEvent(Bus.UP_BOOK, book.bookUrl)
synchronized(this) {
updateList.remove(book.bookUrl)
postEvent(Bus.UP_BOOK, book.bookUrl)
}
}
}
}

Loading…
Cancel
Save