Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 450e8fa3 authored by tobiasKaminsky's avatar tobiasKaminsky
Browse files

Use okhttp 4.x branch and dav4jvm-2.x branch

parent f6ddc4be
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -11,10 +11,6 @@ updates:
  - 2. to review
  - dependencies
  ignore:
  - dependency-name: com.gitlab.bitfireAT:dav4jvm
    versions:
    - "> 2.1.2"
    - "< 3"
  - dependency-name: org.apache.jackrabbit:jackrabbit-webdav
    versions:
    - "> 2.13.1"
+2 −2
Original line number Diff line number Diff line
@@ -57,8 +57,8 @@ ext {

dependencies {
    implementation 'org.apache.jackrabbit:jackrabbit-webdav:2.13.1'
    api 'com.squareup.okhttp3:okhttp:3.14.7'
    implementation 'com.gitlab.bitfireAT:dav4jvm:1.0.1' // in transition phase, we use old and new libs
    api 'com.squareup.okhttp3:okhttp:4.9.0'
    implementation 'com.gitlab.bitfireAT:dav4jvm:2.1.2' // in transition phase, we use old and new libs
    implementation 'org.parceler:parceler-api:1.1.13'
    annotationProcessor 'org.parceler:parceler:1.1.13'
    implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
+10 −9
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import com.owncloud.android.lib.common.OwnCloudClientManagerFactory
import com.owncloud.android.lib.common.operations.RemoteOperation
import okhttp3.Headers
import okhttp3.HttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import okhttp3.Request
import okhttp3.Response
import java.io.IOException
@@ -59,7 +60,7 @@ abstract class OkHttpMethodBase(
    }

    fun buildQueryParameter(): HttpUrl {
        val httpBuilder = HttpUrl.parse(uri)?.newBuilder() ?: throw IllegalStateException("Error")
        val httpBuilder = uri.toHttpUrlOrNull()?.newBuilder() ?: throw IllegalStateException("Error")

        queryMap.forEach { (k, v) -> httpBuilder.addQueryParameter(k, v) }

@@ -92,27 +93,27 @@ abstract class OkHttpMethodBase(
    }

    fun getResponseBodyAsString(): String {
        return response?.body()?.string() ?: ""
        return response?.body?.string() ?: ""
    }

    fun getResponseContentLength(): Long {
        return response?.body()?.contentLength() ?: -1
        return response?.body?.contentLength() ?: -1
    }

    fun releaseConnection() {
        response?.body()?.close()
        response?.body?.close()
    }

    fun getStatusCode(): Int {
        return response?.code() ?: UNKNOWN_STATUS_CODE
        return response?.code ?: UNKNOWN_STATUS_CODE
    }

    fun getStatusText(): String {
        return response?.message() ?: ""
        return response?.message ?: ""
    }

    fun getResponseHeaders(): Headers {
        return response?.headers() ?: Headers.Builder().build()
        return response?.headers ?: Headers.Builder().build()
    }

    fun getResponseHeader(name: String): String? {
@@ -152,7 +153,7 @@ abstract class OkHttpMethodBase(
        return if (nextcloudClient.followRedirects) {
            nextcloudClient.followRedirection(this).lastStatus
        } else {
            response?.code() ?: UNKNOWN_STATUS_CODE
            response?.code ?: UNKNOWN_STATUS_CODE
        }
    }

@@ -173,7 +174,7 @@ abstract class OkHttpMethodBase(
            throw RuntimeException(ex)
        }

        return response?.code() ?: UNKNOWN_STATUS_CODE
        return response?.code ?: UNKNOWN_STATUS_CODE
    }

    abstract fun applyType(temp: Request.Builder)