|
|
@ -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) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|