mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 02:17:41 +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,176 +65,8 @@ 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)) { |  | ||||||
|                 Log_OC.d(TAG, "Successful response: " + response!!) |  | ||||||
| 
 | 
 | ||||||
|                 // Parse the response |             if (!isSuccess(status)) { | ||||||
|                 val respJSON = JSONObject(response) |  | ||||||
|                 val respOCS = respJSON.getJSONObject(NODE_OCS) |  | ||||||
|                 val respMeta = respOCS.getJSONObject(NODE_META) |  | ||||||
|                 val respData = respOCS.getJSONObject(NODE_DATA) |  | ||||||
| 
 |  | ||||||
|                 // Read meta |  | ||||||
|                 val statusProp = respMeta.getString(PROPERTY_STATUS).equals("ok", ignoreCase = true) |  | ||||||
|                 val statuscode = respMeta.getInt(PROPERTY_STATUSCODE) |  | ||||||
|                 val message = respMeta.getString(PROPERTY_MESSAGE) |  | ||||||
| 
 |  | ||||||
|                 if (statusProp) { |  | ||||||
|                     val capability = RemoteCapability() |  | ||||||
|                     // Add Version |  | ||||||
|                     if (respData.has(NODE_VERSION)) { |  | ||||||
|                         val respVersion = respData.getJSONObject(NODE_VERSION) |  | ||||||
|                         capability.versionMayor = respVersion.getInt(PROPERTY_MAJOR) |  | ||||||
|                         capability.versionMinor = respVersion.getInt(PROPERTY_MINOR) |  | ||||||
|                         capability.versionMicro = respVersion.getInt(PROPERTY_MICRO) |  | ||||||
|                         capability.versionString = respVersion.getString(PROPERTY_STRING) |  | ||||||
|                         capability.versionEdition = respVersion.getString(PROPERTY_EDITION) |  | ||||||
|                         Log_OC.d(TAG, "*** Added $NODE_VERSION") |  | ||||||
|                     } |  | ||||||
| 
 |  | ||||||
|                     // Capabilities Object |  | ||||||
|                     if (respData.has(NODE_CAPABILITIES)) { |  | ||||||
|                         val respCapabilities = respData.getJSONObject(NODE_CAPABILITIES) |  | ||||||
| 
 |  | ||||||
|                         // Add Core: pollinterval |  | ||||||
|                         if (respCapabilities.has(NODE_CORE)) { |  | ||||||
|                             val respCore = respCapabilities.getJSONObject(NODE_CORE) |  | ||||||
|                             capability.corePollinterval = respCore.getInt(PROPERTY_POLLINTERVAL) |  | ||||||
|                             Log_OC.d(TAG, "*** Added $NODE_CORE") |  | ||||||
|                         } |  | ||||||
| 
 |  | ||||||
|                         // Add files_sharing: public, user, resharing |  | ||||||
|                         if (respCapabilities.has(NODE_FILES_SHARING)) { |  | ||||||
|                             val respFilesSharing = respCapabilities.getJSONObject(NODE_FILES_SHARING) |  | ||||||
|                             if (respFilesSharing.has(PROPERTY_API_ENABLED)) { |  | ||||||
|                                 capability.filesSharingApiEnabled = CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                     respFilesSharing.getBoolean(PROPERTY_API_ENABLED) |  | ||||||
|                                 ) |  | ||||||
|                             } |  | ||||||
| 
 |  | ||||||
|                             if (respFilesSharing.has(NODE_PUBLIC)) { |  | ||||||
|                                 val respPublic = respFilesSharing.getJSONObject(NODE_PUBLIC) |  | ||||||
|                                 capability.filesSharingPublicEnabled = CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                     respPublic.getBoolean(PROPERTY_ENABLED) |  | ||||||
|                                 ) |  | ||||||
| 
 |  | ||||||
|                                 if (respPublic.has(NODE_PASSWORD)) { |  | ||||||
|                                     val respPassword = respPublic.getJSONObject(NODE_PASSWORD) |  | ||||||
|                                     capability.filesSharingPublicPasswordEnforced = |  | ||||||
|                                         CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                             respPublic.getJSONObject(NODE_PASSWORD).getBoolean(PROPERTY_ENFORCED) |  | ||||||
|                                         ) |  | ||||||
| 
 |  | ||||||
|                                     if (respPassword.has(NODE_ENFORCED_FOR)) { |  | ||||||
|                                         capability.filesSharingPublicPasswordEnforcedReadOnly = |  | ||||||
|                                             CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                                 respPassword.getJSONObject(NODE_ENFORCED_FOR).getBoolean( |  | ||||||
|                                                     PROPERTY_ENFORCED_READ_ONLY |  | ||||||
|                                                 ) |  | ||||||
|                                             ) |  | ||||||
| 
 |  | ||||||
|                                         capability.filesSharingPublicPasswordEnforcedReadWrite = |  | ||||||
|                                             CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                                 respPassword.getJSONObject(NODE_ENFORCED_FOR).getBoolean( |  | ||||||
|                                                     PROPERTY_ENFORCED_READ_WRITE |  | ||||||
|                                                 ) |  | ||||||
|                                             ) |  | ||||||
| 
 |  | ||||||
|                                         capability.filesSharingPublicPasswordEnforcedUploadOnly = |  | ||||||
|                                             CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                                 respPassword.getJSONObject(NODE_ENFORCED_FOR).getBoolean( |  | ||||||
|                                                     PROPERTY_ENFORCED_UPLOAD_ONLY |  | ||||||
|                                                 ) |  | ||||||
|                                             ) |  | ||||||
|                                     } |  | ||||||
|                                 } |  | ||||||
|                                 if (respPublic.has(NODE_EXPIRE_DATE)) { |  | ||||||
|                                     val respExpireDate = respPublic.getJSONObject(NODE_EXPIRE_DATE) |  | ||||||
|                                     capability.filesSharingPublicExpireDateEnabled = |  | ||||||
|                                         CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                             respExpireDate.getBoolean(PROPERTY_ENABLED) |  | ||||||
|                                         ) |  | ||||||
|                                     if (respExpireDate.has(PROPERTY_DAYS)) { |  | ||||||
|                                         capability.filesSharingPublicExpireDateDays = |  | ||||||
|                                             respExpireDate.getInt(PROPERTY_DAYS) |  | ||||||
|                                     } |  | ||||||
|                                     if (respExpireDate.has(PROPERTY_ENFORCED)) { |  | ||||||
|                                         capability.filesSharingPublicExpireDateEnforced = |  | ||||||
|                                             CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                                 respExpireDate.getBoolean(PROPERTY_ENFORCED) |  | ||||||
|                                             ) |  | ||||||
|                                     } |  | ||||||
|                                 } |  | ||||||
|                                 if (respPublic.has(PROPERTY_UPLOAD)) { |  | ||||||
|                                     capability.filesSharingPublicUpload = CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                         respPublic.getBoolean(PROPERTY_UPLOAD) |  | ||||||
|                                     ) |  | ||||||
|                                 } |  | ||||||
|                                 if (respPublic.has(PROPERTY_UPLOAD_ONLY)) { |  | ||||||
|                                     capability.filesSharingPublicSupportsUploadOnly = |  | ||||||
|                                         CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                             respPublic.getBoolean(PROPERTY_UPLOAD_ONLY) |  | ||||||
|                                         ) |  | ||||||
|                                 } |  | ||||||
|                                 if (respPublic.has(PROPERTY_MULTIPLE)) { |  | ||||||
|                                     capability.filesSharingPublicMultiple = CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                         respPublic.getBoolean(PROPERTY_MULTIPLE) |  | ||||||
|                                     ) |  | ||||||
|                                 } |  | ||||||
|                             } |  | ||||||
| 
 |  | ||||||
|                             if (respFilesSharing.has(NODE_USER)) { |  | ||||||
|                                 val respUser = respFilesSharing.getJSONObject(NODE_USER) |  | ||||||
|                                 capability.filesSharingUserSendMail = CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                     respUser.getBoolean(PROPERTY_SEND_MAIL) |  | ||||||
|                                 ) |  | ||||||
|                             } |  | ||||||
| 
 |  | ||||||
|                             capability.filesSharingResharing = CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                 respFilesSharing.getBoolean(PROPERTY_RESHARING) |  | ||||||
|                             ) |  | ||||||
|                             if (respFilesSharing.has(NODE_FEDERATION)) { |  | ||||||
|                                 val respFederation = respFilesSharing.getJSONObject(NODE_FEDERATION) |  | ||||||
|                                 capability.filesSharingFederationOutgoing = |  | ||||||
|                                     CapabilityBooleanType.fromBooleanValue(respFederation.getBoolean(PROPERTY_OUTGOING)) |  | ||||||
|                                 capability.filesSharingFederationIncoming = CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                     respFederation.getBoolean(PROPERTY_INCOMING) |  | ||||||
|                                 ) |  | ||||||
|                             } |  | ||||||
|                             Log_OC.d(TAG, "*** Added $NODE_FILES_SHARING") |  | ||||||
|                         } |  | ||||||
| 
 |  | ||||||
|                         if (respCapabilities.has(NODE_FILES)) { |  | ||||||
|                             val respFiles = respCapabilities.getJSONObject(NODE_FILES) |  | ||||||
|                             // Add files |  | ||||||
|                             capability.filesBigFileChuncking = CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                 respFiles.getBoolean(PROPERTY_BIGFILECHUNKING) |  | ||||||
|                             ) |  | ||||||
|                             if (respFiles.has(PROPERTY_UNDELETE)) { |  | ||||||
|                                 capability.filesUndelete = CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                     respFiles.getBoolean(PROPERTY_UNDELETE) |  | ||||||
|                                 ) |  | ||||||
|                             } |  | ||||||
|                             if (respFiles.has(PROPERTY_VERSIONING)) { |  | ||||||
|                                 capability.filesVersioning = CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                     respFiles.getBoolean(PROPERTY_VERSIONING) |  | ||||||
|                                 ) |  | ||||||
|                             } |  | ||||||
|                             Log_OC.d(TAG, "*** Added $NODE_FILES") |  | ||||||
|                         } |  | ||||||
|                     } |  | ||||||
|                     // Result |  | ||||||
|                     result = RemoteOperationResult(OK) |  | ||||||
|                     result.data = capability |  | ||||||
| 
 |  | ||||||
|                     Log_OC.d(TAG, "*** Get Capabilities completed ") |  | ||||||
|                 } else { |  | ||||||
|                     result = RemoteOperationResult(statuscode, message, null) |  | ||||||
|                     Log_OC.e(TAG, "Failed response while getting capabilities from the server ") |  | ||||||
|                     Log_OC.e(TAG, "*** status: $statusProp; message: $message") |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|             } else { |  | ||||||
|                 result = RemoteOperationResult(getMethod) |                 result = RemoteOperationResult(getMethod) | ||||||
|                 Log_OC.e(TAG, "Failed response while getting capabilities from the server ") |                 Log_OC.e(TAG, "Failed response while getting capabilities from the server ") | ||||||
|                 if (response != null) { |                 if (response != null) { | ||||||
| @ -242,6 +74,176 @@ class GetRemoteCapabilitiesOperation : RemoteOperation<RemoteCapability>() { | |||||||
|                 } else { |                 } else { | ||||||
|                     Log_OC.e(TAG, "*** status code: $status") |                     Log_OC.e(TAG, "*** status code: $status") | ||||||
|                 } |                 } | ||||||
|  | 
 | ||||||
|  |                 return result | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             Log_OC.d(TAG, "Successful response: " + response!!) | ||||||
|  | 
 | ||||||
|  |             // Parse the response | ||||||
|  |             val respJSON = JSONObject(response) | ||||||
|  |             val respOCS = respJSON.getJSONObject(NODE_OCS) | ||||||
|  |             val respMeta = respOCS.getJSONObject(NODE_META) | ||||||
|  |             val respData = respOCS.getJSONObject(NODE_DATA) | ||||||
|  | 
 | ||||||
|  |             // Read meta | ||||||
|  |             val statusProp = respMeta.getString(PROPERTY_STATUS).equals(PROPERTY_STATUS_OK, ignoreCase = true) | ||||||
|  |             val statuscode = respMeta.getInt(PROPERTY_STATUSCODE) | ||||||
|  |             val message = respMeta.getString(PROPERTY_MESSAGE) | ||||||
|  | 
 | ||||||
|  |             if (statusProp) { | ||||||
|  |                 val capability = RemoteCapability() | ||||||
|  |                 // Add Version | ||||||
|  |                 if (respData.has(NODE_VERSION)) { | ||||||
|  |                     val respVersion = respData.getJSONObject(NODE_VERSION) | ||||||
|  |                     capability.versionMayor = respVersion.getInt(PROPERTY_MAJOR) | ||||||
|  |                     capability.versionMinor = respVersion.getInt(PROPERTY_MINOR) | ||||||
|  |                     capability.versionMicro = respVersion.getInt(PROPERTY_MICRO) | ||||||
|  |                     capability.versionString = respVersion.getString(PROPERTY_STRING) | ||||||
|  |                     capability.versionEdition = respVersion.getString(PROPERTY_EDITION) | ||||||
|  |                     Log_OC.d(TAG, "*** Added $NODE_VERSION") | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |                 // Capabilities Object | ||||||
|  |                 if (respData.has(NODE_CAPABILITIES)) { | ||||||
|  |                     val respCapabilities = respData.getJSONObject(NODE_CAPABILITIES) | ||||||
|  | 
 | ||||||
|  |                     // Add Core: pollinterval | ||||||
|  |                     if (respCapabilities.has(NODE_CORE)) { | ||||||
|  |                         val respCore = respCapabilities.getJSONObject(NODE_CORE) | ||||||
|  |                         capability.corePollinterval = respCore.getInt(PROPERTY_POLLINTERVAL) | ||||||
|  |                         Log_OC.d(TAG, "*** Added $NODE_CORE") | ||||||
|  |                     } | ||||||
|  | 
 | ||||||
|  |                     // Add files_sharing: public, user, resharing | ||||||
|  |                     if (respCapabilities.has(NODE_FILES_SHARING)) { | ||||||
|  |                         val respFilesSharing = respCapabilities.getJSONObject(NODE_FILES_SHARING) | ||||||
|  |                         if (respFilesSharing.has(PROPERTY_API_ENABLED)) { | ||||||
|  |                             capability.filesSharingApiEnabled = CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                 respFilesSharing.getBoolean(PROPERTY_API_ENABLED) | ||||||
|  |                             ) | ||||||
|  |                         } | ||||||
|  | 
 | ||||||
|  |                         if (respFilesSharing.has(NODE_PUBLIC)) { | ||||||
|  |                             val respPublic = respFilesSharing.getJSONObject(NODE_PUBLIC) | ||||||
|  |                             capability.filesSharingPublicEnabled = CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                 respPublic.getBoolean(PROPERTY_ENABLED) | ||||||
|  |                             ) | ||||||
|  | 
 | ||||||
|  |                             if (respPublic.has(NODE_PASSWORD)) { | ||||||
|  |                                 val respPassword = respPublic.getJSONObject(NODE_PASSWORD) | ||||||
|  |                                 capability.filesSharingPublicPasswordEnforced = | ||||||
|  |                                     CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                         respPublic.getJSONObject(NODE_PASSWORD).getBoolean(PROPERTY_ENFORCED) | ||||||
|  |                                     ) | ||||||
|  | 
 | ||||||
|  |                                 if (respPassword.has(NODE_ENFORCED_FOR)) { | ||||||
|  |                                     capability.filesSharingPublicPasswordEnforcedReadOnly = | ||||||
|  |                                         CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                             respPassword.getJSONObject(NODE_ENFORCED_FOR).getBoolean( | ||||||
|  |                                                 PROPERTY_ENFORCED_READ_ONLY | ||||||
|  |                                             ) | ||||||
|  |                                         ) | ||||||
|  | 
 | ||||||
|  |                                     capability.filesSharingPublicPasswordEnforcedReadWrite = | ||||||
|  |                                         CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                             respPassword.getJSONObject(NODE_ENFORCED_FOR).getBoolean( | ||||||
|  |                                                 PROPERTY_ENFORCED_READ_WRITE | ||||||
|  |                                             ) | ||||||
|  |                                         ) | ||||||
|  | 
 | ||||||
|  |                                     capability.filesSharingPublicPasswordEnforcedUploadOnly = | ||||||
|  |                                         CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                             respPassword.getJSONObject(NODE_ENFORCED_FOR).getBoolean( | ||||||
|  |                                                 PROPERTY_ENFORCED_UPLOAD_ONLY | ||||||
|  |                                             ) | ||||||
|  |                                         ) | ||||||
|  |                                 } | ||||||
|  |                             } | ||||||
|  |                             if (respPublic.has(NODE_EXPIRE_DATE)) { | ||||||
|  |                                 val respExpireDate = respPublic.getJSONObject(NODE_EXPIRE_DATE) | ||||||
|  |                                 capability.filesSharingPublicExpireDateEnabled = | ||||||
|  |                                     CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                         respExpireDate.getBoolean(PROPERTY_ENABLED) | ||||||
|  |                                     ) | ||||||
|  |                                 if (respExpireDate.has(PROPERTY_DAYS)) { | ||||||
|  |                                     capability.filesSharingPublicExpireDateDays = | ||||||
|  |                                         respExpireDate.getInt(PROPERTY_DAYS) | ||||||
|  |                                 } | ||||||
|  |                                 if (respExpireDate.has(PROPERTY_ENFORCED)) { | ||||||
|  |                                     capability.filesSharingPublicExpireDateEnforced = | ||||||
|  |                                         CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                             respExpireDate.getBoolean(PROPERTY_ENFORCED) | ||||||
|  |                                         ) | ||||||
|  |                                 } | ||||||
|  |                             } | ||||||
|  |                             if (respPublic.has(PROPERTY_UPLOAD)) { | ||||||
|  |                                 capability.filesSharingPublicUpload = CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                     respPublic.getBoolean(PROPERTY_UPLOAD) | ||||||
|  |                                 ) | ||||||
|  |                             } | ||||||
|  |                             if (respPublic.has(PROPERTY_UPLOAD_ONLY)) { | ||||||
|  |                                 capability.filesSharingPublicSupportsUploadOnly = | ||||||
|  |                                     CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                         respPublic.getBoolean(PROPERTY_UPLOAD_ONLY) | ||||||
|  |                                     ) | ||||||
|  |                             } | ||||||
|  |                             if (respPublic.has(PROPERTY_MULTIPLE)) { | ||||||
|  |                                 capability.filesSharingPublicMultiple = CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                     respPublic.getBoolean(PROPERTY_MULTIPLE) | ||||||
|  |                                 ) | ||||||
|  |                             } | ||||||
|  |                         } | ||||||
|  | 
 | ||||||
|  |                         if (respFilesSharing.has(NODE_USER)) { | ||||||
|  |                             val respUser = respFilesSharing.getJSONObject(NODE_USER) | ||||||
|  |                             capability.filesSharingUserSendMail = CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                 respUser.getBoolean(PROPERTY_SEND_MAIL) | ||||||
|  |                             ) | ||||||
|  |                         } | ||||||
|  | 
 | ||||||
|  |                         capability.filesSharingResharing = CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                             respFilesSharing.getBoolean(PROPERTY_RESHARING) | ||||||
|  |                         ) | ||||||
|  |                         if (respFilesSharing.has(NODE_FEDERATION)) { | ||||||
|  |                             val respFederation = respFilesSharing.getJSONObject(NODE_FEDERATION) | ||||||
|  |                             capability.filesSharingFederationOutgoing = | ||||||
|  |                                 CapabilityBooleanType.fromBooleanValue(respFederation.getBoolean(PROPERTY_OUTGOING)) | ||||||
|  |                             capability.filesSharingFederationIncoming = CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                 respFederation.getBoolean(PROPERTY_INCOMING) | ||||||
|  |                             ) | ||||||
|  |                         } | ||||||
|  |                         Log_OC.d(TAG, "*** Added $NODE_FILES_SHARING") | ||||||
|  |                     } | ||||||
|  | 
 | ||||||
|  |                     if (respCapabilities.has(NODE_FILES)) { | ||||||
|  |                         val respFiles = respCapabilities.getJSONObject(NODE_FILES) | ||||||
|  |                         // Add files | ||||||
|  |                         capability.filesBigFileChuncking = CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                             respFiles.getBoolean(PROPERTY_BIGFILECHUNKING) | ||||||
|  |                         ) | ||||||
|  |                         if (respFiles.has(PROPERTY_UNDELETE)) { | ||||||
|  |                             capability.filesUndelete = CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                 respFiles.getBoolean(PROPERTY_UNDELETE) | ||||||
|  |                             ) | ||||||
|  |                         } | ||||||
|  |                         if (respFiles.has(PROPERTY_VERSIONING)) { | ||||||
|  |                             capability.filesVersioning = CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                 respFiles.getBoolean(PROPERTY_VERSIONING) | ||||||
|  |                             ) | ||||||
|  |                         } | ||||||
|  |                         Log_OC.d(TAG, "*** Added $NODE_FILES") | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |                 // Result | ||||||
|  |                 result = RemoteOperationResult(OK) | ||||||
|  |                 result.data = capability | ||||||
|  | 
 | ||||||
|  |                 Log_OC.d(TAG, "*** Get Capabilities completed ") | ||||||
|  |             } else { | ||||||
|  |                 result = RemoteOperationResult(statuscode, message, null) | ||||||
|  |                 Log_OC.e(TAG, "Failed response while getting capabilities from the server ") | ||||||
|  |                 Log_OC.e(TAG, "*** status: $statusProp; message: $message") | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|         } catch (e: Exception) { |         } catch (e: Exception) { | ||||||
| @ -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