pull/475/head
gedoor 4 years ago
parent d8867c9cac
commit bd599d6ca9
  1. 14
      app/src/main/java/io/legado/app/service/AudioPlayService.kt

@ -282,10 +282,12 @@ class AudioPlayService : BaseService(),
}
}
private fun loadContent(chapter: BookChapter) = AudioPlay.apply {
book?.let { book ->
webBook?.getContent(book, chapter, scope = this@AudioPlayService)
?.onSuccess { content ->
private fun loadContent(chapter: BookChapter) {
val book = AudioPlay.book
val webBook = AudioPlay.webBook
if (book != null && webBook != null) {
webBook.getContent(book, chapter, scope = this@AudioPlayService)
.onSuccess { content ->
removeLoading(chapter.index)
if (content.isEmpty()) {
withContext(Main) {
@ -294,10 +296,12 @@ class AudioPlayService : BaseService(),
} else {
contentLoadFinish(chapter, content)
}
}?.onError {
}.onError {
contentLoadFinish(chapter, it.localizedMessage ?: toString())
removeLoading(chapter.index)
}
} else {
toast("book or source is null")
}
}

Loading…
Cancel
Save