|
|
|
@ -46,6 +46,7 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun loadBookInfo(book: Book) { |
|
|
|
|
execute { |
|
|
|
|
isLoadingData.postValue(true) |
|
|
|
|
App.db.bookSourceDao().getBookSource(book.origin)?.let { bookSource -> |
|
|
|
|
WebBook(bookSource).getBookInfo(book, this) |
|
|
|
@ -56,8 +57,10 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
|
} |
|
|
|
|
} ?: toast(R.string.error_no_source) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun loadChapter(book: Book) { |
|
|
|
|
execute { |
|
|
|
|
isLoadingData.postValue(true) |
|
|
|
|
App.db.bookSourceDao().getBookSource(book.origin)?.let { bookSource -> |
|
|
|
|
WebBook(bookSource).getChapterList(book, this) |
|
|
|
@ -76,6 +79,7 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
|
} |
|
|
|
|
} ?: toast(R.string.error_no_source) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun saveBook(success: (() -> Unit)?) { |
|
|
|
|
execute { |
|
|
|
|