|
|
@ -65,17 +65,15 @@ class BookshelfViewModel(application: Application) : BaseViewModel(application) |
|
|
|
origin = bookSource.bookSourceUrl, |
|
|
|
origin = bookSource.bookSourceUrl, |
|
|
|
originName = bookSource.bookSourceName |
|
|
|
originName = bookSource.bookSourceName |
|
|
|
) |
|
|
|
) |
|
|
|
suspend { |
|
|
|
WebBook(bookSource).getBookInfo(book, this) |
|
|
|
WebBook(bookSource).getBookInfo(book, this) |
|
|
|
.onSuccess(IO) { |
|
|
|
.onSuccess(IO) { |
|
|
|
it?.let { book -> |
|
|
|
it?.let { book -> |
|
|
|
App.db.bookDao().insert(book) |
|
|
|
App.db.bookDao().insert(book) |
|
|
|
successCount++ |
|
|
|
successCount++ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}.onError { |
|
|
|
|
|
|
|
throw Exception(it.localizedMessage) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}.onError { |
|
|
|
|
|
|
|
throw Exception(it.localizedMessage) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}.onSuccess { |
|
|
|
}.onSuccess { |
|
|
|