mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-30 18:07:38 +00:00 
			
		
		
		
	
						commit
						abf72ef3e8
					
				
							
								
								
									
										5
									
								
								.editorconfig
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								.editorconfig
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | ||||
| [*] | ||||
| max_line_length = 150 | ||||
| 
 | ||||
| [*.{kt, kts}] | ||||
| disabled_rules=no-consecutive-blank-lines,no-wildcard-imports,max-line-length,no-blank-line-before-rbrace,final-newline,indent,no-multi-spaces,comment-spacing,parameter-list-wrapping | ||||
							
								
								
									
										16
									
								
								build.gradle
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								build.gradle
									
									
									
									
									
								
							| @ -1,15 +1,17 @@ | ||||
| buildscript { | ||||
|     ext { | ||||
|         kotlinVersion = '1.4.31' | ||||
|         moshiVersion = "1.11.0" | ||||
|         kotlinVersion = '1.4.32' | ||||
|         moshiVersion = "1.12.0" | ||||
|     } | ||||
| 
 | ||||
|     repositories { | ||||
|         google() | ||||
|         jcenter() | ||||
|         mavenCentral() | ||||
|         maven { url "https://plugins.gradle.org/m2/" } | ||||
|     } | ||||
|     dependencies { | ||||
|         classpath 'com.android.tools.build:gradle:4.1.2' | ||||
|         classpath "org.jlleitschuh.gradle:ktlint-gradle:10.0.0" | ||||
|         classpath 'com.android.tools.build:gradle:4.1.3' | ||||
|         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" | ||||
|     } | ||||
| } | ||||
| @ -17,7 +19,11 @@ buildscript { | ||||
| allprojects { | ||||
|     repositories { | ||||
|         google() | ||||
|         jcenter() | ||||
|         mavenCentral() | ||||
|         maven { url 'https://jitpack.io' } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| subprojects { | ||||
|     apply plugin: "org.jlleitschuh.gradle.ktlint" | ||||
| } | ||||
| @ -15,7 +15,7 @@ dependencies { | ||||
|     kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshiVersion" | ||||
| 
 | ||||
|     testImplementation 'junit:junit:4.13.2' | ||||
|     testImplementation 'org.robolectric:robolectric:4.3.1' | ||||
|     testImplementation 'org.robolectric:robolectric:4.5.1' | ||||
| } | ||||
| 
 | ||||
| android { | ||||
| @ -25,8 +25,8 @@ android { | ||||
|         minSdkVersion 21 | ||||
|         targetSdkVersion 29 | ||||
| 
 | ||||
|         versionCode = 10001000 | ||||
|         versionName = "1.0.10" | ||||
|         versionCode = 10001100 | ||||
|         versionName = "1.0.11" | ||||
|     } | ||||
| 
 | ||||
|     lintOptions { | ||||
|  | ||||
| @ -52,17 +52,9 @@ public class AccountUtils { | ||||
|      */ | ||||
|     public static String getWebDavUrlForAccount(Context context, Account account) | ||||
|             throws AccountNotFoundException { | ||||
|         String webDavUrlForAccount = ""; | ||||
| 
 | ||||
|         try { | ||||
|             OwnCloudCredentials ownCloudCredentials = getCredentialsForAccount(context, account); | ||||
|             webDavUrlForAccount = getBaseUrlForAccount(context, account) + OwnCloudClient.WEBDAV_FILES_PATH_4_0 | ||||
|                     + ownCloudCredentials.getUsername(); | ||||
|         } catch (OperationCanceledException | AuthenticatorException | IOException e) { | ||||
|             Timber.e(e); | ||||
|         } | ||||
| 
 | ||||
|         return webDavUrlForAccount; | ||||
|         return getBaseUrlForAccount(context, account) + OwnCloudClient.WEBDAV_FILES_PATH_4_0 | ||||
|                 + AccountUtils.getUserId(account, context); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -39,7 +39,6 @@ import java.net.URL; | ||||
| import java.nio.channels.FileChannel; | ||||
| import java.util.concurrent.TimeUnit; | ||||
| 
 | ||||
| import static com.owncloud.android.lib.common.http.HttpConstants.IF_MATCH_HEADER; | ||||
| import static com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode.OK; | ||||
| 
 | ||||
| /** | ||||
| @ -95,10 +94,6 @@ public class ChunkedUploadRemoteFileOperation extends UploadRemoteFileOperation | ||||
|             } else { | ||||
|                 mPutMethod = new PutMethod(new URL(uriPrefix + File.separator + chunkIndex), mFileRequestBody); | ||||
| 
 | ||||
|                 if (mRequiredEtag != null && mRequiredEtag.length() > 0) { | ||||
|                     mPutMethod.addRequestHeader(IF_MATCH_HEADER, "\"" + mRequiredEtag + "\""); | ||||
|                 } | ||||
| 
 | ||||
|                 if (chunkIndex == chunkCount - 1) { | ||||
|                     // Added a high timeout to the last chunk due to when the last chunk | ||||
|                     // arrives to the server with the last PUT, all chunks get assembled | ||||
|  | ||||
| @ -26,6 +26,6 @@ package com.owncloud.android.lib.resources.files.services | ||||
| import com.owncloud.android.lib.common.operations.RemoteOperationResult | ||||
| import com.owncloud.android.lib.resources.Service | ||||
| 
 | ||||
| interface FileService: Service { | ||||
| interface FileService : Service { | ||||
|     fun checkPathExistence(path: String, isUserLogged: Boolean): RemoteOperationResult<Boolean> | ||||
| } | ||||
|  | ||||
| @ -31,13 +31,13 @@ import com.squareup.moshi.JsonClass | ||||
| @JsonClass(generateAdapter = true) | ||||
| data class OIDCDiscoveryResponse( | ||||
|     val authorization_endpoint: String, | ||||
|     val check_session_iframe: String, | ||||
|     val end_session_endpoint: String, | ||||
|     val check_session_iframe: String?, | ||||
|     val end_session_endpoint: String?, | ||||
|     val issuer: String, | ||||
|     val registration_endpoint: String, | ||||
|     val registration_endpoint: String?, | ||||
|     val response_types_supported: List<String>, | ||||
|     val scopes_supported: List<String>, | ||||
|     val scopes_supported: List<String>?, | ||||
|     val token_endpoint: String, | ||||
|     val token_endpoint_auth_methods_supported: List<String>, | ||||
|     val userinfo_endpoint: String, | ||||
|     val token_endpoint_auth_methods_supported: List<String>?, | ||||
|     val userinfo_endpoint: String?, | ||||
| ) | ||||
|  | ||||
| @ -176,7 +176,7 @@ class ShareXMLParser { | ||||
|                 name.equals(NODE_ELEMENT, ignoreCase = true) -> { | ||||
|                     readElement(parser, shares) | ||||
|                 } | ||||
|                 name.equals(NODE_ID, ignoreCase = true) -> {// Parse Create XML Response | ||||
|                 name.equals(NODE_ID, ignoreCase = true) -> { // Parse Create XML Response | ||||
|                     share = RemoteShare() | ||||
|                     val value = readNode(parser, NODE_ID) | ||||
|                     share.id = value | ||||
|  | ||||
| @ -34,8 +34,8 @@ import com.owncloud.android.lib.common.http.methods.nonwebdav.GetMethod | ||||
| import com.owncloud.android.lib.common.operations.RemoteOperation | ||||
| import com.owncloud.android.lib.common.operations.RemoteOperationResult | ||||
| import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode.OK | ||||
| import com.owncloud.android.lib.resources.status.responses.CapabilityResponse | ||||
| import com.owncloud.android.lib.resources.CommonOcsResponse | ||||
| import com.owncloud.android.lib.resources.status.responses.CapabilityResponse | ||||
| import com.squareup.moshi.JsonAdapter | ||||
| import com.squareup.moshi.Moshi | ||||
| import com.squareup.moshi.Types | ||||
|  | ||||
| @ -31,7 +31,6 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCo | ||||
| 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 okhttp3.HttpUrl.Companion.toHttpUrl | ||||
| import org.json.JSONException | ||||
| import timber.log.Timber | ||||
| 
 | ||||
|  | ||||
| @ -45,9 +45,9 @@ internal class StatusRequester { | ||||
|         redirectedToNonSecureLocationBefore: Boolean, | ||||
|         baseUrl: String, | ||||
|         redirectedUrl: String | ||||
|     ) = redirectedToNonSecureLocationBefore | ||||
|             || (baseUrl.startsWith(HTTPS_SCHEME) | ||||
|             && !redirectedUrl.startsWith(HTTPS_SCHEME)) | ||||
|     ) = redirectedToNonSecureLocationBefore || | ||||
|             (baseUrl.startsWith(HTTPS_SCHEME) && | ||||
|             !redirectedUrl.startsWith(HTTPS_SCHEME)) | ||||
| 
 | ||||
|     fun updateLocationWithRedirectPath(oldLocation: String, redirectedLocation: String): String { | ||||
|         /** Redirection with different endpoint. | ||||
|  | ||||
| @ -24,6 +24,6 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult | ||||
| import com.owncloud.android.lib.resources.Service | ||||
| import com.owncloud.android.lib.resources.status.RemoteCapability | ||||
| 
 | ||||
| interface CapabilityService: Service { | ||||
|     fun getCapabilities() : RemoteOperationResult<RemoteCapability> | ||||
| interface CapabilityService : Service { | ||||
|     fun getCapabilities(): RemoteOperationResult<RemoteCapability> | ||||
| } | ||||
|  | ||||
| @ -22,9 +22,9 @@ package com.owncloud.android.lib.resources.status.services.implementation | ||||
| 
 | ||||
| import com.owncloud.android.lib.common.OwnCloudClient | ||||
| import com.owncloud.android.lib.common.operations.RemoteOperationResult | ||||
| import com.owncloud.android.lib.resources.status.services.CapabilityService | ||||
| import com.owncloud.android.lib.resources.status.GetRemoteCapabilitiesOperation | ||||
| import com.owncloud.android.lib.resources.status.RemoteCapability | ||||
| import com.owncloud.android.lib.resources.status.services.CapabilityService | ||||
| 
 | ||||
| class OCCapabilityService(override val client: OwnCloudClient) : | ||||
|     CapabilityService { | ||||
|  | ||||
| @ -70,7 +70,7 @@ class GetRemoteUserAvatarOperation(private val avatarDimension: Int) : RemoteOpe | ||||
| 
 | ||||
|                 /// download will be performed to a buffer | ||||
|                 inputStream = getMethod.getResponseBodyAsStream() | ||||
|                 val bytesArray = inputStream?.readBytes()?: byteArrayOf() | ||||
|                 val bytesArray = inputStream?.readBytes() ?: byteArrayOf() | ||||
| 
 | ||||
|                 // TODO check total bytes transferred? | ||||
|                 Timber.d("Avatar size: Bytes received ${bytesArray.size} of $contentLength") | ||||
|  | ||||
| @ -28,8 +28,8 @@ import com.owncloud.android.lib.resources.CommonOcsResponse | ||||
| import com.squareup.moshi.JsonAdapter | ||||
| import com.squareup.moshi.Moshi | ||||
| import com.squareup.moshi.Types | ||||
| import org.junit.Assert.assertNull | ||||
| import org.junit.Assert.assertEquals | ||||
| import org.junit.Assert.assertNull | ||||
| import org.junit.Assert.assertTrue | ||||
| import org.junit.Before | ||||
| import org.junit.Test | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user