|
|
@ -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 { |
|
|
|
updateList.add(book.bookUrl) |
|
|
|
synchronized(this) { |
|
|
|
postEvent(Bus.UP_BOOK, book.bookUrl) |
|
|
|
updateList.add(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,8 +47,10 @@ class BookshelfViewModel(application: Application) : BaseViewModel(application) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}.onFinally { |
|
|
|
}.onFinally { |
|
|
|
updateList.remove(book.bookUrl) |
|
|
|
synchronized(this) { |
|
|
|
postEvent(Bus.UP_BOOK, book.bookUrl) |
|
|
|
updateList.remove(book.bookUrl) |
|
|
|
|
|
|
|
postEvent(Bus.UP_BOOK, book.bookUrl) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|