Toonkor - fix search (#3952)

This commit is contained in:
Mike 2020-07-29 22:49:44 -04:00 committed by GitHub
parent 39302cafa6
commit ff635bd624
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Toonkor'
pkgNameSuffix = 'ko.toonkor'
extClass = '.Toonkor'
extVersionCode = 1
extVersionCode = 2
libVersion = '1.2'
}

View File

@ -78,10 +78,12 @@ class Toonkor : ConfigurableSource, ParsedHttpSource() {
// Search
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val filterList = if (filters.isEmpty()) getFilterList() else filters
// Webtoons, Manga, or Hentai
val type = filters.findUriPartFilter<TypeFilter>()
val type = filterList.findUriPartFilter<TypeFilter>()
// Popular, Latest, or Completed
val sort = filters.findUriPartFilter<SortFilter>()
val sort = filterList.findUriPartFilter<SortFilter>()
// Hentai doesn't have a "completed" sort, ignore it if it's selected (equivalent to returning popular)
val requestPath = when {
@ -129,7 +131,7 @@ class Toonkor : ConfigurableSource, ParsedHttpSource() {
private val dateFormat by lazy { SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()) }
private fun String.toDate(): Long {
return dateFormat.parse(this).time
return dateFormat.parse(this)?.time ?: 0
}
// Pages