mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-07 16:06:08 +00:00
Save spaces-related capabilities in database
This commit is contained in:
parent
e30246c486
commit
4f001550f9
@ -45,7 +45,7 @@ import java.net.URL
|
||||
|
||||
/**
|
||||
* Get the Capabilities from the server
|
||||
* Save in Result.getData in a RemoteCapability object
|
||||
* Save Result.getData in a RemoteCapability object
|
||||
*
|
||||
* @author masensio
|
||||
* @author David González Verdugo
|
||||
|
@ -1,8 +1,12 @@
|
||||
/* ownCloud Android Library is available under MIT license
|
||||
/**
|
||||
* ownCloud Android Library is available under MIT license
|
||||
*
|
||||
* @author masensio
|
||||
* @author David González Verdugo
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
* @author Juan Carlos Garrote Gascón
|
||||
*
|
||||
* Copyright (C) 2022 ownCloud GmbH.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -22,8 +26,8 @@
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.owncloud.android.lib.resources.status
|
||||
|
||||
/**
|
||||
@ -33,7 +37,7 @@ data class RemoteCapability(
|
||||
var accountName: String = "",
|
||||
|
||||
// Server version
|
||||
var versionMayor: Int = 0,
|
||||
var versionMajor: Int = 0,
|
||||
var versionMinor: Int = 0,
|
||||
var versionMicro: Int = 0,
|
||||
var versionString: String = "",
|
||||
@ -68,7 +72,10 @@ data class RemoteCapability(
|
||||
var filesUndelete: CapabilityBooleanType = CapabilityBooleanType.UNKNOWN,
|
||||
var filesVersioning: CapabilityBooleanType = CapabilityBooleanType.UNKNOWN,
|
||||
val filesPrivateLinks: CapabilityBooleanType = CapabilityBooleanType.UNKNOWN,
|
||||
val filesAppProviders: List<RemoteOCISProvider>?,
|
||||
val filesAppProviders: List<RemoteAppProviders>?,
|
||||
|
||||
// Spaces
|
||||
val spaces: RemoteSpaces?,
|
||||
) {
|
||||
/**
|
||||
* Enum for Boolean Type in capabilities, with values:
|
||||
@ -101,7 +108,7 @@ data class RemoteCapability(
|
||||
}
|
||||
}
|
||||
|
||||
data class RemoteOCISProvider(
|
||||
data class RemoteAppProviders(
|
||||
val enabled: Boolean,
|
||||
val version: String,
|
||||
val appsUrl: String?,
|
||||
@ -109,4 +116,10 @@ data class RemoteCapability(
|
||||
val openWebUrl: String?,
|
||||
val newUrl: String?,
|
||||
)
|
||||
|
||||
data class RemoteSpaces(
|
||||
val enabled: Boolean,
|
||||
val projects: Boolean,
|
||||
val shareJail: Boolean,
|
||||
)
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
/* ownCloud Android Library is available under MIT license
|
||||
/**
|
||||
* ownCloud Android Library is available under MIT license
|
||||
*
|
||||
* @author Abel García de Prada
|
||||
* Copyright (C) 2020 ownCloud GmbH.
|
||||
* @author Juan Carlos Garrote Gascón
|
||||
*
|
||||
* Copyright (C) 2022 ownCloud GmbH.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -20,13 +24,12 @@
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.owncloud.android.lib.resources.status.responses
|
||||
|
||||
import com.owncloud.android.lib.resources.status.RemoteCapability
|
||||
import com.owncloud.android.lib.resources.status.RemoteCapability.CapabilityBooleanType
|
||||
import com.owncloud.android.lib.resources.status.RemoteCapability.RemoteOCISProvider
|
||||
import com.owncloud.android.lib.resources.status.RemoteCapability.*
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
@ -37,7 +40,7 @@ data class CapabilityResponse(
|
||||
val capabilities: Capabilities?
|
||||
) {
|
||||
fun toRemoteCapability(): RemoteCapability = RemoteCapability(
|
||||
versionMayor = serverVersion?.major ?: 0,
|
||||
versionMajor = serverVersion?.major ?: 0,
|
||||
versionMinor = serverVersion?.minor ?: 0,
|
||||
versionMicro = serverVersion?.micro ?: 0,
|
||||
versionString = serverVersion?.string ?: "",
|
||||
@ -70,10 +73,11 @@ data class CapabilityResponse(
|
||||
filesUndelete = CapabilityBooleanType.fromBooleanValue(capabilities?.fileCapabilities?.undelete),
|
||||
filesVersioning = CapabilityBooleanType.fromBooleanValue(capabilities?.fileCapabilities?.versioning),
|
||||
filesPrivateLinks = capabilities?.fileCapabilities?.privateLinks?.let { CapabilityBooleanType.fromBooleanValue(it) } ?: CapabilityBooleanType.UNKNOWN,
|
||||
filesAppProviders = capabilities?.fileCapabilities?.appProviders?.map { it.toOCISProvider() },
|
||||
filesAppProviders = capabilities?.fileCapabilities?.appProviders?.map { it.toAppProviders() },
|
||||
filesSharingFederationIncoming = CapabilityBooleanType.fromBooleanValue(capabilities?.fileSharingCapabilities?.fileSharingFederation?.incoming),
|
||||
filesSharingFederationOutgoing = CapabilityBooleanType.fromBooleanValue(capabilities?.fileSharingCapabilities?.fileSharingFederation?.outgoing),
|
||||
filesSharingUserProfilePicture = CapabilityBooleanType.fromBooleanValue(capabilities?.fileSharingCapabilities?.fileSharingUser?.profilePicture),
|
||||
spaces = capabilities?.spacesCapabilities?.toSpaces(),
|
||||
)
|
||||
}
|
||||
|
||||
@ -86,7 +90,9 @@ data class Capabilities(
|
||||
@Json(name = "files")
|
||||
val fileCapabilities: FileCapabilities?,
|
||||
@Json(name = "dav")
|
||||
val davCapabilities: DavCapabilities?
|
||||
val davCapabilities: DavCapabilities?,
|
||||
@Json(name = "spaces")
|
||||
val spacesCapabilities: SpacesCapabilities?
|
||||
)
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
@ -182,7 +188,7 @@ data class AppProvider(
|
||||
@Json(name = "new_url")
|
||||
val newUrl: String?,
|
||||
) {
|
||||
fun toOCISProvider() = RemoteOCISProvider(enabled, version, appsUrl, openUrl, openWebUrl, newUrl)
|
||||
fun toAppProviders() = RemoteAppProviders(enabled, version, appsUrl, openUrl, openWebUrl, newUrl)
|
||||
}
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
@ -190,6 +196,16 @@ data class DavCapabilities(
|
||||
val chunking: String?
|
||||
)
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class SpacesCapabilities(
|
||||
val enabled: Boolean,
|
||||
val projects: Boolean,
|
||||
@Json(name = "share_jail")
|
||||
val shareJail: Boolean,
|
||||
) {
|
||||
fun toSpaces() = RemoteSpaces(enabled, projects, shareJail)
|
||||
}
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class ServerVersion(
|
||||
var major: Int?,
|
||||
|
Loading…
x
Reference in New Issue
Block a user