custom novel search fix
This commit is contained in:
parent
e3e3965795
commit
7e5def3a37
3 changed files with 6 additions and 6 deletions
|
@ -314,7 +314,8 @@ class MediaDetailsViewModel : ViewModel() {
|
|||
val novelSources = NovelSources
|
||||
val novelResponses = MutableLiveData<List<ShowResponse>>(null)
|
||||
suspend fun searchNovels(query: String, i: Int) {
|
||||
val source = novelSources[i]
|
||||
val position = if (i >= novelSources.list.size) 0 else i
|
||||
val source = novelSources[position]
|
||||
tryWithSuspend(post = true) {
|
||||
if (source != null) {
|
||||
novelResponses.postValue(source.search(query))
|
||||
|
|
|
@ -247,8 +247,7 @@ class NovelReadFragment : Fragment(),
|
|||
headerAdapter.progress?.visibility = View.VISIBLE
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
if (auto || query == "") model.autoSearchNovels(media)
|
||||
//else model.searchNovels(query, source)
|
||||
else model.autoSearchNovels(media) //testing
|
||||
else model.searchNovels(query, source)
|
||||
}
|
||||
searching = true
|
||||
if (save) {
|
||||
|
|
|
@ -22,10 +22,10 @@ class DynamicNovelParser(extension: NovelExtension.Installed) : NovelParser() {
|
|||
|
||||
override suspend fun search(query: String): List<ShowResponse> {
|
||||
val source = extension.sources.firstOrNull()
|
||||
if (source is NovelInterface) {
|
||||
return source.search(query, client)
|
||||
return if (source is NovelInterface) {
|
||||
source.search(query, client)
|
||||
} else {
|
||||
return emptyList()
|
||||
emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue