pull/32/head
kunfei 5 years ago
parent 128a1b6a0b
commit b0492a2138
  1. 16
      app/src/main/java/io/legado/app/ui/changesource/ChangeSourceViewModel.kt

@ -54,16 +54,14 @@ class ChangeSourceViewModel(application: Application) : BaseViewModel(applicatio
WebBook(item).searchBook(name, scope = this@execute)
.timeout(30000L)
.onSuccess(IO) {
it?.let { list ->
for (searchBook in list) {
if (searchBook.name == name && searchBook.author == author) {
if (searchBook.tocUrl.isEmpty()) {
loadBookInfo(searchBook.toBook())
} else {
loadChapter(searchBook.toBook())
}
break
it?.forEach { searchBook ->
if (searchBook.name == name && searchBook.author == author) {
if (searchBook.tocUrl.isEmpty()) {
loadBookInfo(searchBook.toBook())
} else {
loadChapter(searchBook.toBook())
}
return@onSuccess
}
}
}

Loading…
Cancel
Save