|
|
@ -120,11 +120,11 @@ class ChangeSourceViewModel(application: Application) : BaseViewModel(applicatio |
|
|
|
.onSuccess(IO) { |
|
|
|
.onSuccess(IO) { |
|
|
|
it.forEach { searchBook -> |
|
|
|
it.forEach { searchBook -> |
|
|
|
if (searchBook.name == name && searchBook.author == author) { |
|
|
|
if (searchBook.name == name && searchBook.author == author) { |
|
|
|
if (context.getPrefBoolean(PreferKey.changeSourceLoadToc)) { |
|
|
|
if (searchBook.latestChapterTitle.isNullOrEmpty()) { |
|
|
|
if (searchBook.tocUrl.isEmpty()) { |
|
|
|
if (context.getPrefBoolean(PreferKey.changeSourceLoadInfo) || context.getPrefBoolean(PreferKey.changeSourceLoadToc)) { |
|
|
|
loadBookInfo(searchBook.toBook()) |
|
|
|
loadBookInfo(searchBook.toBook()) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
loadChapter(searchBook.toBook()) |
|
|
|
searchFinish(searchBook) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
searchFinish(searchBook) |
|
|
|
searchFinish(searchBook) |
|
|
@ -156,7 +156,14 @@ class ChangeSourceViewModel(application: Application) : BaseViewModel(applicatio |
|
|
|
App.db.bookSourceDao().getBookSource(book.origin)?.let { bookSource -> |
|
|
|
App.db.bookSourceDao().getBookSource(book.origin)?.let { bookSource -> |
|
|
|
WebBook(bookSource).getBookInfo(book, this) |
|
|
|
WebBook(bookSource).getBookInfo(book, this) |
|
|
|
.onSuccess { |
|
|
|
.onSuccess { |
|
|
|
|
|
|
|
if (context.getPrefBoolean(PreferKey.changeSourceLoadToc)) { |
|
|
|
loadChapter(it) |
|
|
|
loadChapter(it) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
//从详情页里获取最新章节 |
|
|
|
|
|
|
|
book.latestChapterTitle = it.latestChapterTitle |
|
|
|
|
|
|
|
val searchBook = book.toSearchBook() |
|
|
|
|
|
|
|
searchFinish(searchBook) |
|
|
|
|
|
|
|
} |
|
|
|
}.onError { |
|
|
|
}.onError { |
|
|
|
debug { context.getString(R.string.error_get_book_info) } |
|
|
|
debug { context.getString(R.string.error_get_book_info) } |
|
|
|
} |
|
|
|
} |
|
|
|