mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 10:27:45 +00:00 
			
		
		
		
	Apply changes requested in PR
This commit is contained in:
		
							parent
							
								
									6bd64197b4
								
							
						
					
					
						commit
						4f57487f70
					
				| @ -32,11 +32,12 @@ package com.owncloud.android.lib.resources.shares | |||||||
|  * 3 - Shared by public link |  * 3 - Shared by public link | ||||||
|  * 4 - Shared by e-mail |  * 4 - Shared by e-mail | ||||||
|  * 5 - Shared by contact |  * 5 - Shared by contact | ||||||
|  |  * 6 - Federated | ||||||
|  * |  * | ||||||
|  * @author masensio |  * @author masensio | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| enum class ShareType private constructor(val value: Int) { | enum class ShareType constructor(val value: Int) { | ||||||
|     NO_SHARED(-1), |     NO_SHARED(-1), | ||||||
|     USER(0), |     USER(0), | ||||||
|     GROUP(1), |     GROUP(1), | ||||||
| @ -48,16 +49,16 @@ enum class ShareType private constructor(val value: Int) { | |||||||
|     companion object { |     companion object { | ||||||
| 
 | 
 | ||||||
|         fun fromValue(value: Int): ShareType? { |         fun fromValue(value: Int): ShareType? { | ||||||
|             when (value) { |             return when (value) { | ||||||
|                 -1 -> return NO_SHARED |                 -1 -> NO_SHARED | ||||||
|                 0 -> return USER |                 0 -> USER | ||||||
|                 1 -> return GROUP |                 1 -> GROUP | ||||||
|                 3 -> return PUBLIC_LINK |                 3 -> PUBLIC_LINK | ||||||
|                 4 -> return EMAIL |                 4 -> EMAIL | ||||||
|                 5 -> return CONTACT |                 5 -> CONTACT | ||||||
|                 6 -> return FEDERATED |                 6 -> FEDERATED | ||||||
|             } |                 else -> null | ||||||
|             return null |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @ -46,12 +46,12 @@ enum class CapabilityBooleanType private constructor(val value: Int) { | |||||||
| 
 | 
 | ||||||
|     companion object { |     companion object { | ||||||
|         fun fromValue(value: Int): CapabilityBooleanType? { |         fun fromValue(value: Int): CapabilityBooleanType? { | ||||||
|             when (value) { |             return when (value) { | ||||||
|                 -1 -> return UNKNOWN |                 -1 -> UNKNOWN | ||||||
|                 0 -> return FALSE |                 0 -> FALSE | ||||||
|                 1 -> return TRUE |                 1 -> TRUE | ||||||
|  |                 else -> null | ||||||
|             } |             } | ||||||
|             return null |  | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         fun fromBooleanValue(boolValue: Boolean): CapabilityBooleanType { |         fun fromBooleanValue(boolValue: Boolean): CapabilityBooleanType { | ||||||
|  | |||||||
| @ -65,7 +65,19 @@ class GetRemoteCapabilitiesOperation : RemoteOperation<RemoteCapability>() { | |||||||
|             val status = client.executeHttpMethod(getMethod) |             val status = client.executeHttpMethod(getMethod) | ||||||
| 
 | 
 | ||||||
|             val response = getMethod.responseBodyAsString |             val response = getMethod.responseBodyAsString | ||||||
|             if (isSuccess(status)) { | 
 | ||||||
|  |             if (!isSuccess(status)) { | ||||||
|  |                 result = RemoteOperationResult(getMethod) | ||||||
|  |                 Log_OC.e(TAG, "Failed response while getting capabilities from the server ") | ||||||
|  |                 if (response != null) { | ||||||
|  |                     Log_OC.e(TAG, "*** status code: $status; response message: $response") | ||||||
|  |                 } else { | ||||||
|  |                     Log_OC.e(TAG, "*** status code: $status") | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |                 return result | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|             Log_OC.d(TAG, "Successful response: " + response!!) |             Log_OC.d(TAG, "Successful response: " + response!!) | ||||||
| 
 | 
 | ||||||
|             // Parse the response |             // Parse the response | ||||||
| @ -75,7 +87,7 @@ class GetRemoteCapabilitiesOperation : RemoteOperation<RemoteCapability>() { | |||||||
|             val respData = respOCS.getJSONObject(NODE_DATA) |             val respData = respOCS.getJSONObject(NODE_DATA) | ||||||
| 
 | 
 | ||||||
|             // Read meta |             // Read meta | ||||||
|                 val statusProp = respMeta.getString(PROPERTY_STATUS).equals("ok", ignoreCase = true) |             val statusProp = respMeta.getString(PROPERTY_STATUS).equals(PROPERTY_STATUS_OK, ignoreCase = true) | ||||||
|             val statuscode = respMeta.getInt(PROPERTY_STATUSCODE) |             val statuscode = respMeta.getInt(PROPERTY_STATUSCODE) | ||||||
|             val message = respMeta.getString(PROPERTY_MESSAGE) |             val message = respMeta.getString(PROPERTY_MESSAGE) | ||||||
| 
 | 
 | ||||||
| @ -234,16 +246,6 @@ class GetRemoteCapabilitiesOperation : RemoteOperation<RemoteCapability>() { | |||||||
|                 Log_OC.e(TAG, "*** status: $statusProp; message: $message") |                 Log_OC.e(TAG, "*** status: $statusProp; message: $message") | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             } else { |  | ||||||
|                 result = RemoteOperationResult(getMethod) |  | ||||||
|                 Log_OC.e(TAG, "Failed response while getting capabilities from the server ") |  | ||||||
|                 if (response != null) { |  | ||||||
|                     Log_OC.e(TAG, "*** status code: $status; response message: $response") |  | ||||||
|                 } else { |  | ||||||
|                     Log_OC.e(TAG, "*** status code: $status") |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
|         } catch (e: Exception) { |         } catch (e: Exception) { | ||||||
|             result = RemoteOperationResult(e) |             result = RemoteOperationResult(e) | ||||||
|             Log_OC.e(TAG, "Exception while getting capabilities", e) |             Log_OC.e(TAG, "Exception while getting capabilities", e) | ||||||
| @ -290,6 +292,7 @@ class GetRemoteCapabilitiesOperation : RemoteOperation<RemoteCapability>() { | |||||||
|         private val NODE_FILES = "files" |         private val NODE_FILES = "files" | ||||||
| 
 | 
 | ||||||
|         private val PROPERTY_STATUS = "status" |         private val PROPERTY_STATUS = "status" | ||||||
|  |         private val PROPERTY_STATUS_OK = "ok" | ||||||
|         private val PROPERTY_STATUSCODE = "statuscode" |         private val PROPERTY_STATUSCODE = "statuscode" | ||||||
|         private val PROPERTY_MESSAGE = "message" |         private val PROPERTY_MESSAGE = "message" | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -29,45 +29,41 @@ package com.owncloud.android.lib.resources.status | |||||||
|  * Contains data of the Capabilities for an account, from the Capabilities API |  * Contains data of the Capabilities for an account, from the Capabilities API | ||||||
|  */ |  */ | ||||||
| class RemoteCapability { | class RemoteCapability { | ||||||
|     var accountName: String? = null |     var accountName: String | ||||||
| 
 | 
 | ||||||
|     // Server version |     // Server version | ||||||
|     var versionMayor: Int = 0 |     var versionMayor: Int | ||||||
|     var versionMinor: Int = 0 |     var versionMinor: Int | ||||||
|     var versionMicro: Int = 0 |     var versionMicro: Int | ||||||
|     var versionString: String? = null |     var versionString: String | ||||||
|     var versionEdition: String? = null |     var versionEdition: String | ||||||
| 
 | 
 | ||||||
|     // Core PollInterval |     // Core PollInterval | ||||||
|     var corePollinterval: Int = 0 |     var corePollinterval: Int | ||||||
| 
 | 
 | ||||||
|     // Files Sharing |     // Files Sharing | ||||||
|     var filesSharingApiEnabled: CapabilityBooleanType? = null |     var filesSharingApiEnabled: CapabilityBooleanType | ||||||
| 
 |     var filesSharingPublicEnabled: CapabilityBooleanType | ||||||
|     var filesSharingPublicEnabled: CapabilityBooleanType? = null |     var filesSharingPublicPasswordEnforced: CapabilityBooleanType | ||||||
|     var filesSharingPublicPasswordEnforced: CapabilityBooleanType? = null |     var filesSharingPublicPasswordEnforcedReadOnly: CapabilityBooleanType | ||||||
|     var filesSharingPublicPasswordEnforcedReadOnly: CapabilityBooleanType? = null |     var filesSharingPublicPasswordEnforcedReadWrite: CapabilityBooleanType | ||||||
|     var filesSharingPublicPasswordEnforcedReadWrite: CapabilityBooleanType? = null |     var filesSharingPublicPasswordEnforcedUploadOnly: CapabilityBooleanType | ||||||
|     var filesSharingPublicPasswordEnforcedUploadOnly: CapabilityBooleanType? = null |     var filesSharingPublicExpireDateEnabled: CapabilityBooleanType | ||||||
|     var filesSharingPublicExpireDateEnabled: CapabilityBooleanType? = null |     var filesSharingPublicExpireDateDays: Int | ||||||
|     var filesSharingPublicExpireDateDays: Int = 0 |     var filesSharingPublicExpireDateEnforced: CapabilityBooleanType | ||||||
|     var filesSharingPublicExpireDateEnforced: CapabilityBooleanType? = null |     var filesSharingPublicSendMail: CapabilityBooleanType | ||||||
|     var filesSharingPublicSendMail: CapabilityBooleanType? = null |     var filesSharingPublicUpload: CapabilityBooleanType | ||||||
|     var filesSharingPublicUpload: CapabilityBooleanType? = null |     var filesSharingPublicMultiple: CapabilityBooleanType | ||||||
|     var filesSharingPublicMultiple: CapabilityBooleanType? = null |     var filesSharingPublicSupportsUploadOnly: CapabilityBooleanType | ||||||
|     var filesSharingPublicSupportsUploadOnly: CapabilityBooleanType? = null |     var filesSharingUserSendMail: CapabilityBooleanType | ||||||
| 
 |     var filesSharingResharing: CapabilityBooleanType | ||||||
|     var filesSharingUserSendMail: CapabilityBooleanType? = null |     var filesSharingFederationOutgoing: CapabilityBooleanType | ||||||
| 
 |     var filesSharingFederationIncoming: CapabilityBooleanType | ||||||
|     var filesSharingResharing: CapabilityBooleanType? = null |  | ||||||
| 
 |  | ||||||
|     var filesSharingFederationOutgoing: CapabilityBooleanType? = null |  | ||||||
|     var filesSharingFederationIncoming: CapabilityBooleanType? = null |  | ||||||
| 
 | 
 | ||||||
|     // Files |     // Files | ||||||
|     var filesBigFileChuncking: CapabilityBooleanType? = null |     var filesBigFileChuncking: CapabilityBooleanType | ||||||
|     var filesUndelete: CapabilityBooleanType? = null |     var filesUndelete: CapabilityBooleanType | ||||||
|     var filesVersioning: CapabilityBooleanType? = null |     var filesVersioning: CapabilityBooleanType | ||||||
| 
 | 
 | ||||||
|     init { |     init { | ||||||
|         accountName = "" |         accountName = "" | ||||||
| @ -76,7 +72,7 @@ class RemoteCapability { | |||||||
|         versionMinor = 0 |         versionMinor = 0 | ||||||
|         versionMicro = 0 |         versionMicro = 0 | ||||||
|         versionString = "" |         versionString = "" | ||||||
|         versionString = "" |         versionEdition = "" | ||||||
| 
 | 
 | ||||||
|         corePollinterval = 0 |         corePollinterval = 0 | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user