mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-07 16:06:08 +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
|
||||
* 4 - Shared by e-mail
|
||||
* 5 - Shared by contact
|
||||
* 6 - Federated
|
||||
*
|
||||
* @author masensio
|
||||
*/
|
||||
|
||||
enum class ShareType private constructor(val value: Int) {
|
||||
enum class ShareType constructor(val value: Int) {
|
||||
NO_SHARED(-1),
|
||||
USER(0),
|
||||
GROUP(1),
|
||||
@ -48,16 +49,16 @@ enum class ShareType private constructor(val value: Int) {
|
||||
companion object {
|
||||
|
||||
fun fromValue(value: Int): ShareType? {
|
||||
when (value) {
|
||||
-1 -> return NO_SHARED
|
||||
0 -> return USER
|
||||
1 -> return GROUP
|
||||
3 -> return PUBLIC_LINK
|
||||
4 -> return EMAIL
|
||||
5 -> return CONTACT
|
||||
6 -> return FEDERATED
|
||||
}
|
||||
return null
|
||||
return when (value) {
|
||||
-1 -> NO_SHARED
|
||||
0 -> USER
|
||||
1 -> GROUP
|
||||
3 -> PUBLIC_LINK
|
||||
4 -> EMAIL
|
||||
5 -> CONTACT
|
||||
6 -> FEDERATED
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -46,12 +46,12 @@ enum class CapabilityBooleanType private constructor(val value: Int) {
|
||||
|
||||
companion object {
|
||||
fun fromValue(value: Int): CapabilityBooleanType? {
|
||||
when (value) {
|
||||
-1 -> return UNKNOWN
|
||||
0 -> return FALSE
|
||||
1 -> return TRUE
|
||||
return when (value) {
|
||||
-1 -> UNKNOWN
|
||||
0 -> FALSE
|
||||
1 -> TRUE
|
||||
else -> null
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
fun fromBooleanValue(boolValue: Boolean): CapabilityBooleanType {
|
||||
|
@ -65,7 +65,19 @@ class GetRemoteCapabilitiesOperation : RemoteOperation<RemoteCapability>() {
|
||||
val status = client.executeHttpMethod(getMethod)
|
||||
|
||||
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!!)
|
||||
|
||||
// Parse the response
|
||||
@ -75,7 +87,7 @@ class GetRemoteCapabilitiesOperation : RemoteOperation<RemoteCapability>() {
|
||||
val respData = respOCS.getJSONObject(NODE_DATA)
|
||||
|
||||
// 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 message = respMeta.getString(PROPERTY_MESSAGE)
|
||||
|
||||
@ -234,16 +246,6 @@ class GetRemoteCapabilitiesOperation : RemoteOperation<RemoteCapability>() {
|
||||
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) {
|
||||
result = RemoteOperationResult(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 PROPERTY_STATUS = "status"
|
||||
private val PROPERTY_STATUS_OK = "ok"
|
||||
private val PROPERTY_STATUSCODE = "statuscode"
|
||||
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
|
||||
*/
|
||||
class RemoteCapability {
|
||||
var accountName: String? = null
|
||||
var accountName: String
|
||||
|
||||
// Server version
|
||||
var versionMayor: Int = 0
|
||||
var versionMinor: Int = 0
|
||||
var versionMicro: Int = 0
|
||||
var versionString: String? = null
|
||||
var versionEdition: String? = null
|
||||
var versionMayor: Int
|
||||
var versionMinor: Int
|
||||
var versionMicro: Int
|
||||
var versionString: String
|
||||
var versionEdition: String
|
||||
|
||||
// Core PollInterval
|
||||
var corePollinterval: Int = 0
|
||||
var corePollinterval: Int
|
||||
|
||||
// Files Sharing
|
||||
var filesSharingApiEnabled: CapabilityBooleanType? = null
|
||||
|
||||
var filesSharingPublicEnabled: CapabilityBooleanType? = null
|
||||
var filesSharingPublicPasswordEnforced: CapabilityBooleanType? = null
|
||||
var filesSharingPublicPasswordEnforcedReadOnly: CapabilityBooleanType? = null
|
||||
var filesSharingPublicPasswordEnforcedReadWrite: CapabilityBooleanType? = null
|
||||
var filesSharingPublicPasswordEnforcedUploadOnly: CapabilityBooleanType? = null
|
||||
var filesSharingPublicExpireDateEnabled: CapabilityBooleanType? = null
|
||||
var filesSharingPublicExpireDateDays: Int = 0
|
||||
var filesSharingPublicExpireDateEnforced: CapabilityBooleanType? = null
|
||||
var filesSharingPublicSendMail: CapabilityBooleanType? = null
|
||||
var filesSharingPublicUpload: CapabilityBooleanType? = null
|
||||
var filesSharingPublicMultiple: CapabilityBooleanType? = null
|
||||
var filesSharingPublicSupportsUploadOnly: CapabilityBooleanType? = null
|
||||
|
||||
var filesSharingUserSendMail: CapabilityBooleanType? = null
|
||||
|
||||
var filesSharingResharing: CapabilityBooleanType? = null
|
||||
|
||||
var filesSharingFederationOutgoing: CapabilityBooleanType? = null
|
||||
var filesSharingFederationIncoming: CapabilityBooleanType? = null
|
||||
var filesSharingApiEnabled: CapabilityBooleanType
|
||||
var filesSharingPublicEnabled: CapabilityBooleanType
|
||||
var filesSharingPublicPasswordEnforced: CapabilityBooleanType
|
||||
var filesSharingPublicPasswordEnforcedReadOnly: CapabilityBooleanType
|
||||
var filesSharingPublicPasswordEnforcedReadWrite: CapabilityBooleanType
|
||||
var filesSharingPublicPasswordEnforcedUploadOnly: CapabilityBooleanType
|
||||
var filesSharingPublicExpireDateEnabled: CapabilityBooleanType
|
||||
var filesSharingPublicExpireDateDays: Int
|
||||
var filesSharingPublicExpireDateEnforced: CapabilityBooleanType
|
||||
var filesSharingPublicSendMail: CapabilityBooleanType
|
||||
var filesSharingPublicUpload: CapabilityBooleanType
|
||||
var filesSharingPublicMultiple: CapabilityBooleanType
|
||||
var filesSharingPublicSupportsUploadOnly: CapabilityBooleanType
|
||||
var filesSharingUserSendMail: CapabilityBooleanType
|
||||
var filesSharingResharing: CapabilityBooleanType
|
||||
var filesSharingFederationOutgoing: CapabilityBooleanType
|
||||
var filesSharingFederationIncoming: CapabilityBooleanType
|
||||
|
||||
// Files
|
||||
var filesBigFileChuncking: CapabilityBooleanType? = null
|
||||
var filesUndelete: CapabilityBooleanType? = null
|
||||
var filesVersioning: CapabilityBooleanType? = null
|
||||
var filesBigFileChuncking: CapabilityBooleanType
|
||||
var filesUndelete: CapabilityBooleanType
|
||||
var filesVersioning: CapabilityBooleanType
|
||||
|
||||
init {
|
||||
accountName = ""
|
||||
@ -76,7 +72,7 @@ class RemoteCapability {
|
||||
versionMinor = 0
|
||||
versionMicro = 0
|
||||
versionString = ""
|
||||
versionString = ""
|
||||
versionEdition = ""
|
||||
|
||||
corePollinterval = 0
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user