Stop using internal OkHttp APIs (#11172)
This commit is contained in:
parent
84714f887f
commit
5db3e03d15
@ -6,7 +6,7 @@ ext {
|
||||
extName = 'MangaDex'
|
||||
pkgNameSuffix = 'all.mangadex'
|
||||
extClass = '.MangaDexFactory'
|
||||
extVersionCode = 157
|
||||
extVersionCode = 158
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,7 @@ abstract class MangaDex(override val lang: String, val dexLang: String) :
|
||||
val listDto = helper.json.decodeFromString<ListDto>(response.body!!.string())
|
||||
val listDtoFiltered = listDto.data.relationships.filter { it.type != "Manga" }
|
||||
val amount = listDtoFiltered.count()
|
||||
if (amount < 1){
|
||||
if (amount < 1) {
|
||||
throw Exception("No Manga in List")
|
||||
}
|
||||
val minIndex = (page - 1) * MDConstants.mangaLimit
|
||||
|
@ -12,7 +12,6 @@ import okhttp3.MediaType.Companion.toMediaType
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
import okhttp3.Response
|
||||
import okhttp3.internal.closeQuietly
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
/**
|
||||
@ -61,16 +60,14 @@ class MdAtHomeReportInterceptor(
|
||||
|
||||
val jsonString = json.encodeToString(result)
|
||||
|
||||
val postResult = client.newCall(
|
||||
POST(
|
||||
MDConstants.atHomePostUrl,
|
||||
headers,
|
||||
jsonString.toRequestBody("application/json".toMediaType())
|
||||
)
|
||||
)
|
||||
try {
|
||||
val body = postResult.execute()
|
||||
body.closeQuietly()
|
||||
client.newCall(
|
||||
POST(
|
||||
MDConstants.atHomePostUrl,
|
||||
headers,
|
||||
jsonString.toRequestBody("application/json".toMediaType())
|
||||
)
|
||||
).execute().close()
|
||||
} catch (e: Exception) {
|
||||
Log.e("MangaDex", "Error trying to POST report to MD@Home: ${e.message}")
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ ext {
|
||||
extName = 'Dmzj'
|
||||
pkgNameSuffix = 'zh.dmzj'
|
||||
extClass = '.Dmzj'
|
||||
extVersionCode = 27
|
||||
extVersionCode = 28
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -4,8 +4,6 @@ import android.util.Log
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.Response
|
||||
import okhttp3.internal.closeQuietly
|
||||
import java.lang.Exception
|
||||
|
||||
/**
|
||||
* An OkHttp interceptor that will switch to a failover address and retry when an HTTP GET request
|
||||
@ -45,7 +43,11 @@ class HttpGetFailoverInterceptor : Interceptor {
|
||||
} catch (e: Exception) {
|
||||
Log.d(LOG_TAG, "[HttpGetFailoverInterceptor] failed with exception, next: $retry", e)
|
||||
}
|
||||
response?.closeQuietly()
|
||||
try {
|
||||
response?.close()
|
||||
} catch (_: Exception) {
|
||||
// Ignore exceptions
|
||||
}
|
||||
request = request.newBuilder().url(retry).build()
|
||||
}
|
||||
return chain.proceed(request)
|
||||
|
Loading…
x
Reference in New Issue
Block a user