pull/32/head
kunfei 5 years ago
parent 2d1ef9fd6a
commit 54333ffc4f
  1. 4
      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) { if (book.origin != BookType.local) {
val bookSource = App.db.bookSourceDao().getBookSource(book.origin) val bookSource = App.db.bookSourceDao().getBookSource(book.origin)
bookSource?.let { bookSource?.let {
synchronized(this) {
updateList.add(book.bookUrl) updateList.add(book.bookUrl)
postEvent(Bus.UP_BOOK, book.bookUrl) postEvent(Bus.UP_BOOK, book.bookUrl)
}
WebBook(bookSource).getChapterList(book).onSuccess(IO) { WebBook(bookSource).getChapterList(book).onSuccess(IO) {
it?.let { it?.let {
App.db.bookDao().update(book) App.db.bookDao().update(book)
@ -45,11 +47,13 @@ class BookshelfViewModel(application: Application) : BaseViewModel(application)
} }
} }
}.onFinally { }.onFinally {
synchronized(this) {
updateList.remove(book.bookUrl) updateList.remove(book.bookUrl)
postEvent(Bus.UP_BOOK, book.bookUrl) postEvent(Bus.UP_BOOK, book.bookUrl)
} }
} }
} }
}
delay(50) delay(50)
} }
} }

Loading…
Cancel
Save