mirror of
https://github.com/owncloud/android-library.git
synced 2026-08-11 08:22:56 +00:00
fix lint and compile issues
This commit is contained in:
+5
-5
@@ -15,17 +15,17 @@ import timber.log.Timber
|
||||
import java.io.IOException
|
||||
import java.lang.Exception
|
||||
|
||||
class ConnectionValidator (
|
||||
class ConnectionValidator(
|
||||
val context: Context,
|
||||
val clearCookiesOnValidation: Boolean
|
||||
){
|
||||
) {
|
||||
|
||||
fun validate(baseClient: OwnCloudClient, singleSessionManager: SingleSessionManager): Boolean {
|
||||
try {
|
||||
var validationRetryCount = 0
|
||||
val client = OwnCloudClient(baseClient.baseUri, null, false, singleSessionManager)
|
||||
if (clearCookiesOnValidation) {
|
||||
client.clearCookies();
|
||||
client.clearCookies()
|
||||
} else {
|
||||
client.cookiesForBaseUri = baseClient.cookiesForBaseUri
|
||||
}
|
||||
@@ -45,7 +45,7 @@ class ConnectionValidator (
|
||||
}
|
||||
|
||||
// Skip the part where we try to check if we can access the parts where we have to be logged in... if we are not logged in
|
||||
if(baseClient.credentials !is OwnCloudAnonymousCredentials) {
|
||||
if (baseClient.credentials !is OwnCloudAnonymousCredentials) {
|
||||
client.setFollowRedirects(false)
|
||||
val contentReply = canAccessRootFolder(client)
|
||||
if (contentReply.httpCode == HttpConstants.HTTP_OK) {
|
||||
@@ -184,4 +184,4 @@ class ConnectionValidator (
|
||||
companion object {
|
||||
val VALIDATION_RETRY_COUNT = 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ package com.owncloud.android.lib.common.http;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.facebook.stetho.okhttp3.StethoInterceptor;
|
||||
import com.owncloud.android.lib.common.network.AdvancedX509TrustManager;
|
||||
import com.owncloud.android.lib.common.network.NetworkUtils;
|
||||
import okhttp3.Cookie;
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ class PropfindMethod(
|
||||
public override fun onExecute(): Int {
|
||||
davResource.propfind(
|
||||
depth = depth,
|
||||
reqProp = *propertiesToRequest,
|
||||
reqProp = propertiesToRequest,
|
||||
listOfHeaders = super.getRequestHeadersAsHashMap(),
|
||||
callback = { response: Response, hrefRelation: HrefRelation? ->
|
||||
when (hrefRelation) {
|
||||
|
||||
+2
-3
@@ -27,7 +27,6 @@ import com.owncloud.android.lib.common.OwnCloudClient
|
||||
import com.owncloud.android.lib.common.http.HttpConstants
|
||||
import com.owncloud.android.lib.common.http.methods.webdav.DavUtils
|
||||
import com.owncloud.android.lib.common.http.methods.webdav.PropfindMethod
|
||||
import com.owncloud.android.lib.common.network.WebdavUtils
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperation
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult
|
||||
import timber.log.Timber
|
||||
@@ -58,7 +57,7 @@ class GetBaseUrlRemoteOperation : RemoteOperation<String?>() {
|
||||
else RemoteOperationResult<String?>(propFindMethod).apply { data = null }
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "Could not get actuall (or redirected) base URL from base url (/).")
|
||||
RemoteOperationResult<String?>(e);
|
||||
RemoteOperationResult<String?>(e)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,4 +69,4 @@ class GetBaseUrlRemoteOperation : RemoteOperation<String?>() {
|
||||
*/
|
||||
private const val TIMEOUT = 10000
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-4
@@ -30,9 +30,7 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode
|
||||
import com.owncloud.android.lib.resources.status.HttpScheme.HTTPS_PREFIX
|
||||
import com.owncloud.android.lib.resources.status.HttpScheme.HTTP_PREFIX
|
||||
import com.owncloud.android.lib.resources.status.HttpScheme.HTTP_SCHEME
|
||||
import org.json.JSONException
|
||||
import timber.log.Timber
|
||||
|
||||
/**
|
||||
* Checks if the server is valid
|
||||
@@ -45,13 +43,13 @@ import timber.log.Timber
|
||||
class GetRemoteStatusOperation : RemoteOperation<RemoteServerInfo>() {
|
||||
|
||||
public override fun run(client: OwnCloudClient): RemoteOperationResult<RemoteServerInfo> {
|
||||
if(!usesHttpOrHttps(client.baseUri)) {
|
||||
if (!usesHttpOrHttps(client.baseUri)) {
|
||||
client.baseUri = buildFullHttpsUrl(client.baseUri)
|
||||
}
|
||||
return tryToConnect(client)
|
||||
}
|
||||
|
||||
private fun updateClientBaseUrl(client:OwnCloudClient, newBaseUrl:String) {
|
||||
private fun updateClientBaseUrl(client: OwnCloudClient, newBaseUrl: String) {
|
||||
client.baseUri = Uri.parse(newBaseUrl)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user