newtoki: fix crash when changing sort filter (#1464)

* fix crash when changing sort filter

* small touch-up
This commit is contained in:
Secozzi 2024-02-22 18:44:42 +00:00 committed by Draff
parent 9d73eef491
commit 1d6ed34d77
3 changed files with 5 additions and 3 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'NewToki / ManaToki' extName = 'NewToki / ManaToki'
extClass = '.TokiFactory' extClass = '.TokiFactory'
extVersionCode = 30 extVersionCode = 31
isNsfw = true isNsfw = true
} }

View File

@ -57,7 +57,7 @@ object ManaToki : NewToki("ManaToki", "comic", manaTokiPreferences) {
} }
is SearchSortTypeList -> { is SearchSortTypeList -> {
val state = filter.state ?: return@forEach val state = filter.state!!
url.addQueryParameter("sst", arrayOf("wr_datetime", "wr_hit", "wr_good", "as_update")[state.index]) url.addQueryParameter("sst", arrayOf("wr_datetime", "wr_hit", "wr_good", "as_update")[state.index])
url.addQueryParameter("sod", if (state.ascending) "asc" else "desc") url.addQueryParameter("sod", if (state.ascending) "asc" else "desc")
} }
@ -161,6 +161,7 @@ object ManaToki : NewToki("ManaToki", "comic", manaTokiPreferences) {
"추천순", "추천순",
"업데이트순", "업데이트순",
), ),
Selection(0, false),
) )
override fun getFilterList() = FilterList( override fun getFilterList() = FilterList(

View File

@ -23,7 +23,7 @@ object NewTokiWebtoon : NewToki("NewToki", "webtoon", newTokiPreferences) {
} }
is SearchSortTypeList -> { is SearchSortTypeList -> {
val state = filter.state ?: return@forEach val state = filter.state!!
url.addQueryParameter("sst", arrayOf("as_update", "wr_hit", "wr_good")[state.index]) url.addQueryParameter("sst", arrayOf("as_update", "wr_hit", "wr_good")[state.index])
url.addQueryParameter("sod", if (state.ascending) "asc" else "desc") url.addQueryParameter("sod", if (state.ascending) "asc" else "desc")
} }
@ -132,6 +132,7 @@ object NewTokiWebtoon : NewToki("NewToki", "webtoon", newTokiPreferences) {
"인기순", "인기순",
"추천순", "추천순",
), ),
Selection(0, false),
) )
override fun getFilterList() = FilterList( override fun getFilterList() = FilterList(