|
|
|
@ -77,24 +77,17 @@ object CacheBook { |
|
|
|
|
downloadMap[book.bookUrl]?.add(chapter.index) |
|
|
|
|
webBook.getContent(book, chapter) |
|
|
|
|
.onSuccess(IO) { content -> |
|
|
|
|
if (ReadBook.book?.bookUrl == book.bookUrl) { |
|
|
|
|
if (content.isEmpty()) { |
|
|
|
|
ReadBook.contentLoadFinish( |
|
|
|
|
book, |
|
|
|
|
chapter, |
|
|
|
|
App.INSTANCE.getString(R.string.content_empty), |
|
|
|
|
resetPageOffset = resetPageOffset |
|
|
|
|
) |
|
|
|
|
} else { |
|
|
|
|
if (content.isNotBlank()) { |
|
|
|
|
BookHelp.saveContent(book, chapter, content) |
|
|
|
|
} |
|
|
|
|
if (ReadBook.book?.bookUrl == book.bookUrl) { |
|
|
|
|
ReadBook.contentLoadFinish( |
|
|
|
|
book, |
|
|
|
|
chapter, |
|
|
|
|
content, |
|
|
|
|
content.ifBlank { App.INSTANCE.getString(R.string.content_empty) }, |
|
|
|
|
resetPageOffset = resetPageOffset |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}.onError { |
|
|
|
|
if (ReadBook.book?.bookUrl == book.bookUrl) { |
|
|
|
|
ReadBook.contentLoadFinish( |
|
|
|
|