Dependency updates. OkHttp nullability changes

This commit is contained in:
len
2017-05-23 20:39:02 +02:00
parent 72ea256906
commit 211f7b591b
22 changed files with 40 additions and 45 deletions

View File

@@ -171,7 +171,7 @@ class YamlHttpSource(mappings: Map<*, *>) : HttpSource() {
}
override fun pageListParse(response: Response): List<Page> {
val body = response.body().string()
val body = response.body()!!.string()
val url = response.request().url().toString()
val pages = mutableListOf<Page>()
@@ -216,7 +216,7 @@ class YamlHttpSource(mappings: Map<*, *>) : HttpSource() {
}
override fun imageUrlParse(response: Response): String {
val body = response.body().string()
val body = response.body()!!.string()
val url = response.request().url().toString()
with(map.pages) {

View File

@@ -85,7 +85,7 @@ class Batoto : ParsedHttpSource(), LoginSource {
override fun latestUpdatesNextPageSelector() = "#show_more_row"
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = HttpUrl.parse("$baseUrl/search_ajax").newBuilder()
val url = HttpUrl.parse("$baseUrl/search_ajax")!!.newBuilder()
if (!query.isEmpty()) url.addQueryParameter("name", query).addQueryParameter("name_cond", "c")
var genres = ""
filters.forEach { filter ->
@@ -162,7 +162,7 @@ class Batoto : ParsedHttpSource(), LoginSource {
}
override fun chapterListParse(response: Response): List<SChapter> {
val body = response.body().string()
val body = response.body()!!.string()
val matcher = staffNotice.matcher(body)
if (matcher.find()) {
@Suppress("DEPRECATION")
@@ -271,7 +271,7 @@ class Batoto : ParsedHttpSource(), LoginSource {
}
override fun isAuthenticationSuccessful(response: Response) =
response.priorResponse() != null && response.priorResponse().code() == 302
response.priorResponse() != null && response.priorResponse()!!.code() == 302
override fun isLogged(): Boolean {
return network.cookies.get(URI(baseUrl)).any { it.name() == "pass_hash" }

View File

@@ -115,13 +115,13 @@ class Kissmanga : ParsedHttpSource() {
override fun pageListRequest(chapter: SChapter) = POST(baseUrl + chapter.url, headers)
override fun pageListParse(response: Response): List<Page> {
val body = response.body().string()
val body = response.body()!!.string()
val pages = mutableListOf<Page>()
// Kissmanga now encrypts the urls, so we need to execute these two scripts in JS.
val ca = client.newCall(GET("$baseUrl/Scripts/ca.js", headers)).execute().body().string()
val lo = client.newCall(GET("$baseUrl/Scripts/lo.js", headers)).execute().body().string()
val ca = client.newCall(GET("$baseUrl/Scripts/ca.js", headers)).execute().body()!!.string()
val lo = client.newCall(GET("$baseUrl/Scripts/lo.js", headers)).execute().body()!!.string()
Duktape.create().use {
it.evaluate(ca)

View File

@@ -55,7 +55,7 @@ class Mangafox : ParsedHttpSource() {
override fun latestUpdatesNextPageSelector() = "a:has(span.next)"
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = HttpUrl.parse("$baseUrl/search.php?name_method=cw&author_method=cw&artist_method=cw&advopts=1").newBuilder().addQueryParameter("name", query)
val url = HttpUrl.parse("$baseUrl/search.php?name_method=cw&author_method=cw&artist_method=cw&advopts=1")!!.newBuilder().addQueryParameter("name", query)
(if (filters.isEmpty()) getFilterList() else filters).forEach { filter ->
when (filter) {
is Status -> url.addQueryParameter(filter.id, filter.state.toString())

View File

@@ -57,7 +57,7 @@ class Mangahere : ParsedHttpSource() {
override fun latestUpdatesNextPageSelector() = "div.next-page > a.next"
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = HttpUrl.parse("$baseUrl/search.php?name_method=cw&author_method=cw&artist_method=cw&advopts=1").newBuilder().addQueryParameter("name", query)
val url = HttpUrl.parse("$baseUrl/search.php?name_method=cw&author_method=cw&artist_method=cw&advopts=1")!!.newBuilder().addQueryParameter("name", query)
(if (filters.isEmpty()) getFilterList() else filters).forEach { filter ->
when (filter) {
is Status -> url.addQueryParameter("is_completed", arrayOf("", "1", "0")[filter.state])

View File

@@ -54,7 +54,7 @@ class Mangasee : ParsedHttpSource() {
override fun searchMangaSelector() = "div.requested > div.row"
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = HttpUrl.parse("$baseUrl/search/request.php").newBuilder()
val url = HttpUrl.parse("$baseUrl/search/request.php")!!.newBuilder()
if (!query.isEmpty()) url.addQueryParameter("keyword", query)
val genres = mutableListOf<String>()
val genresNo = mutableListOf<String>()
@@ -84,7 +84,7 @@ class Mangasee : ParsedHttpSource() {
}
private fun convertQueryToPost(page: Int, url: String): Pair<FormBody.Builder, String> {
val url = HttpUrl.parse(url)
val url = HttpUrl.parse(url)!!
val body = FormBody.Builder().add("page", page.toString())
for (i in 0..url.querySize() - 1) {
body.add(url.queryParameterName(i), url.queryParameterValue(i))

View File

@@ -152,7 +152,7 @@ class Mangachan : ParsedHttpSource() {
}
override fun pageListParse(response: Response): List<Page> {
val html = response.body().string()
val html = response.body()!!.string()
val beginIndex = html.indexOf("fullimg\":[") + 10
val endIndex = html.indexOf(",]", beginIndex)
val trimmedHtml = html.substring(beginIndex, endIndex).replace("\"", "")

View File

@@ -120,7 +120,7 @@ class Mintmanga : ParsedHttpSource() {
}
override fun pageListParse(response: Response): List<Page> {
val html = response.body().string()
val html = response.body()!!.string()
val beginIndex = html.indexOf("rm_h.init( [")
val endIndex = html.indexOf("], 0, false);", beginIndex)
val trimmedHtml = html.substring(beginIndex, endIndex)

View File

@@ -120,7 +120,7 @@ class Readmanga : ParsedHttpSource() {
}
override fun pageListParse(response: Response): List<Page> {
val html = response.body().string()
val html = response.body()!!.string()
val beginIndex = html.indexOf("rm_h.init( [")
val endIndex = html.indexOf("], 0, false);", beginIndex)
val trimmedHtml = html.substring(beginIndex, endIndex)