[MangaDex] Speed up large chapters list loading (hotfix)
This commit is contained in:
@@ -247,7 +247,7 @@ internal class MangaDexParser(override val context: MangaLoaderContext) : MangaP
|
||||
val json = context.httpGet(url).parseJson()
|
||||
if (json.getString("result") == "ok") {
|
||||
return Chapters(
|
||||
data = json.optJSONArray("data")?.filterIsInstance<JSONObject>().orEmpty(),
|
||||
data = json.optJSONArray("data")?.toJSONList().orEmpty(),
|
||||
total = json.getInt("total"),
|
||||
)
|
||||
} else {
|
||||
|
||||
@@ -136,4 +136,8 @@ fun JSONArray?.isNullOrEmpty(): Boolean {
|
||||
}
|
||||
|
||||
return this == null || this.length() == 0
|
||||
}
|
||||
|
||||
fun JSONArray.toJSONList(): List<JSONObject> {
|
||||
return List(length()) { i -> getJSONObject(i) }
|
||||
}
|
||||
Reference in New Issue
Block a user