Revert to older okhttp

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2019-10-26 13:30:24 +02:00
parent 281692519a
commit 6436c6b6ac
4 changed files with 15 additions and 11 deletions

View File

@ -90,6 +90,10 @@ android {
}
}
sourceSets {
androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
}
dexOptions {
javaMaxHeapSize "4g"
}
@ -250,9 +254,9 @@ dependencies {
implementation 'com.bluelinelabs:conductor-autodispose:3.0.0-rc2'
implementation "com.github.miquelbeltran:conductor-viewmodel:1.0.3"
implementation 'com.squareup.okhttp3:okhttp:4.2.2'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:4.2.2'
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.2'
implementation 'com.squareup.okhttp3:okhttp:3.14.2'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.14.2'
implementation 'com.squareup.okhttp3:logging-interceptor:3.14.2'
implementation 'com.squareup.retrofit2:retrofit:2.6.2'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.6.2'

View File

@ -1138,7 +1138,7 @@ class ChatController(args: Bundle) : BaseController(), MessagesListAdapter
timeout: Int
) {
val xChatLastGivenHeader: String? = response.headers().get("X-Chat-Last-Given")
if (response.headers().size > 0 && !TextUtils.isEmpty(xChatLastGivenHeader)) {
if (response.headers().size() > 0 && !TextUtils.isEmpty(xChatLastGivenHeader)) {
val header = Integer.parseInt(xChatLastGivenHeader!!)
if (header > 0) {

View File

@ -117,7 +117,7 @@ fun createOkHttpClient(
// Trust own CA and all self-signed certs
httpClient.sslSocketFactory(sslSocketFactoryCompat, magicTrustManager)
httpClient.retryOnConnectionFailure(true)
httpClient.hostnameVerifier(magicTrustManager.getHostnameVerifier(OkHostnameVerifier))
httpClient.hostnameVerifier(magicTrustManager.getHostnameVerifier(OkHostnameVerifier.INSTANCE))
httpClient.dispatcher(dispatcher)
if (Proxy.NO_PROXY != proxy) {

View File

@ -45,14 +45,14 @@ class NetworkUtils {
.header("User-Agent", ApiUtils.getUserAgent())
.header("Accept", "application/json")
.header("OCS-APIRequest", "true")
.method(original.method, original.body)
.method(original.method(), original.body())
.build()
val response = chain.proceed(request)
if (request.url.encodedPath.contains("/avatar/")) {
if (request.url().encodedPath().contains("/avatar/")) {
AvatarStatusCodeHolder.getInstance()
.statusCode = response.code
.statusCode = response.code()
}
return response
@ -68,7 +68,7 @@ class NetworkUtils {
route: Route?,
response: Response
): Request? {
if (response.request.header(authenticatorType) != null) {
if (response.request().header(authenticatorType) != null) {
return null
}
@ -77,13 +77,13 @@ class NetworkUtils {
var attemptsCount = 0
while ({ countedResponse = countedResponse?.priorResponse; countedResponse }() != null) {
while ({ countedResponse = countedResponse?.priorResponse(); countedResponse }() != null) {
attemptsCount++
if (attemptsCount == 3) {
return null
}
}
return response.request
return response.request()
.newBuilder()
.header(authenticatorType, credentials)
.build()