|
|
@ -49,12 +49,14 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun loadContent(book: Book, index: Int) { |
|
|
|
fun loadContent(book: Book, index: Int) { |
|
|
|
|
|
|
|
execute { |
|
|
|
App.db.bookChapterDao().getChapter(book.bookUrl, index)?.let { chapter -> |
|
|
|
App.db.bookChapterDao().getChapter(book.bookUrl, index)?.let { chapter -> |
|
|
|
BookHelp.getContent(book, chapter)?.let { |
|
|
|
BookHelp.getContent(book, chapter)?.let { |
|
|
|
|
|
|
|
|
|
|
|
} ?: download(book, chapter) |
|
|
|
} ?: download(book, chapter) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun download(book: Book, chapter: BookChapter) { |
|
|
|
private fun download(book: Book, chapter: BookChapter) { |
|
|
|
webBook?.getContent(book, chapter) |
|
|
|
webBook?.getContent(book, chapter) |
|
|
|