pull/1941/head
kunfei 2 years ago
parent 228ae36668
commit 21d6e950f1
  1. 12
      app/src/main/java/io/legado/app/ui/main/MainViewModel.kt

@ -114,8 +114,7 @@ class MainViewModel(application: Application) : BaseViewModel(application) {
return
}
waitUpTocBooks.remove(bookUrl)
onUpTocBooks.add(bookUrl)
postEvent(EventBus.UP_BOOKSHELF, bookUrl)
upTocAdd(bookUrl)
execute(context = upTocPool) {
val preUpdateJs = source.ruleToc?.preUpdateJs
if (!preUpdateJs.isNullOrBlank()) {
@ -128,7 +127,7 @@ class MainViewModel(application: Application) : BaseViewModel(application) {
if (book.bookUrl == bookUrl) {
appDb.bookDao.update(book)
} else {
onUpTocBooks.add(book.bookUrl)
upTocAdd(book.bookUrl)
appDb.bookDao.insert(book)
}
appDb.bookChapterDao.delByBook(book.bookUrl)
@ -145,10 +144,17 @@ class MainViewModel(application: Application) : BaseViewModel(application) {
}
}
@Synchronized
private fun upTocAdd(bookUrl: String) {
onUpTocBooks.add(bookUrl)
postEvent(EventBus.UP_BOOKSHELF, bookUrl)
}
@Synchronized
private fun upTocCancel(bookUrl: String) {
onUpTocBooks.remove(bookUrl)
waitUpTocBooks.add(bookUrl)
postEvent(EventBus.UP_BOOKSHELF, bookUrl)
}
@Synchronized

Loading…
Cancel
Save