mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-07 16:06:08 +00:00
Apply changes requested in code review
This commit is contained in:
parent
9710cf991d
commit
1aeacd62b8
@ -36,6 +36,7 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCo
|
|||||||
import com.owncloud.android.lib.common.utils.Log_OC
|
import com.owncloud.android.lib.common.utils.Log_OC
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
|
import com.owncloud.android.lib.resources.status.RemoteCapability.CapabilityBooleanType
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Capabilities from the server
|
* Get the Capabilities from the server
|
||||||
|
@ -44,7 +44,7 @@ data class RemoteCapability(
|
|||||||
|
|
||||||
// Files Sharing
|
// Files Sharing
|
||||||
var filesSharingApiEnabled: CapabilityBooleanType = CapabilityBooleanType.UNKNOWN,
|
var filesSharingApiEnabled: CapabilityBooleanType = CapabilityBooleanType.UNKNOWN,
|
||||||
var filesSharingSearchMinLength: Int? = 2,
|
var filesSharingSearchMinLength: Int? = DEFAULT_MIN_CHARACTERS_TO_SEARCH,
|
||||||
var filesSharingPublicEnabled: CapabilityBooleanType = CapabilityBooleanType.UNKNOWN,
|
var filesSharingPublicEnabled: CapabilityBooleanType = CapabilityBooleanType.UNKNOWN,
|
||||||
var filesSharingPublicPasswordEnforced: CapabilityBooleanType = CapabilityBooleanType.UNKNOWN,
|
var filesSharingPublicPasswordEnforced: CapabilityBooleanType = CapabilityBooleanType.UNKNOWN,
|
||||||
var filesSharingPublicPasswordEnforcedReadOnly: CapabilityBooleanType = CapabilityBooleanType.UNKNOWN,
|
var filesSharingPublicPasswordEnforcedReadOnly: CapabilityBooleanType = CapabilityBooleanType.UNKNOWN,
|
||||||
@ -66,35 +66,39 @@ data class RemoteCapability(
|
|||||||
var filesBigFileChunking: CapabilityBooleanType = CapabilityBooleanType.UNKNOWN,
|
var filesBigFileChunking: CapabilityBooleanType = CapabilityBooleanType.UNKNOWN,
|
||||||
var filesUndelete: CapabilityBooleanType = CapabilityBooleanType.UNKNOWN,
|
var filesUndelete: CapabilityBooleanType = CapabilityBooleanType.UNKNOWN,
|
||||||
var filesVersioning: CapabilityBooleanType = CapabilityBooleanType.UNKNOWN
|
var filesVersioning: CapabilityBooleanType = CapabilityBooleanType.UNKNOWN
|
||||||
)
|
) {
|
||||||
|
/**
|
||||||
|
* Enum for Boolean Type in capabilities, with values:
|
||||||
|
* -1 - Unknown
|
||||||
|
* 0 - False
|
||||||
|
* 1 - True
|
||||||
|
*/
|
||||||
|
enum class CapabilityBooleanType constructor(val value: Int) {
|
||||||
|
UNKNOWN(-1),
|
||||||
|
FALSE(0),
|
||||||
|
TRUE(1);
|
||||||
|
|
||||||
/**
|
companion object {
|
||||||
* Enum for Boolean Type in capabilities, with values:
|
fun fromValue(value: Int): CapabilityBooleanType? {
|
||||||
* -1 - Unknown
|
return when (value) {
|
||||||
* 0 - False
|
-1 -> UNKNOWN
|
||||||
* 1 - True
|
0 -> FALSE
|
||||||
*/
|
1 -> TRUE
|
||||||
enum class CapabilityBooleanType constructor(val value: Int) {
|
else -> null
|
||||||
UNKNOWN(-1),
|
}
|
||||||
FALSE(0),
|
|
||||||
TRUE(1);
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
fun fromValue(value: Int): CapabilityBooleanType? {
|
|
||||||
return when (value) {
|
|
||||||
-1 -> UNKNOWN
|
|
||||||
0 -> FALSE
|
|
||||||
1 -> TRUE
|
|
||||||
else -> null
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fun fromBooleanValue(boolValue: Boolean): CapabilityBooleanType {
|
fun fromBooleanValue(boolValue: Boolean): CapabilityBooleanType {
|
||||||
return if (boolValue) {
|
return if (boolValue) {
|
||||||
TRUE
|
TRUE
|
||||||
} else {
|
} else {
|
||||||
FALSE
|
FALSE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val DEFAULT_MIN_CHARACTERS_TO_SEARCH = 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user