mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 02:17:41 +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 |  * Get the Capabilities from the server | ||||||
|  * Save in Result.getData in a RemoteCapability object |  * Save Result.getData in a RemoteCapability object | ||||||
|  * |  * | ||||||
|  * @author masensio |  * @author masensio | ||||||
|  * @author David González Verdugo |  * @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 masensio | ||||||
|  * @author David González Verdugo |  * @author David González Verdugo | ||||||
|  * @author Abel García de Prada |  * @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 |  * Permission is hereby granted, free of charge, to any person obtaining a copy | ||||||
|  * of this software and associated documentation files (the "Software"), to deal |  * 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 |  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||||||
|  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||||||
|  * THE SOFTWARE. |  * THE SOFTWARE. | ||||||
|  * |  | ||||||
|  */ |  */ | ||||||
|  | 
 | ||||||
| package com.owncloud.android.lib.resources.status | package com.owncloud.android.lib.resources.status | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
| @ -33,7 +37,7 @@ data class RemoteCapability( | |||||||
|     var accountName: String = "", |     var accountName: String = "", | ||||||
| 
 | 
 | ||||||
|     // Server version |     // Server version | ||||||
|     var versionMayor: Int = 0, |     var versionMajor: Int = 0, | ||||||
|     var versionMinor: Int = 0, |     var versionMinor: Int = 0, | ||||||
|     var versionMicro: Int = 0, |     var versionMicro: Int = 0, | ||||||
|     var versionString: String = "", |     var versionString: String = "", | ||||||
| @ -68,7 +72,10 @@ data class RemoteCapability( | |||||||
|     var filesUndelete: CapabilityBooleanType = CapabilityBooleanType.UNKNOWN, |     var filesUndelete: CapabilityBooleanType = CapabilityBooleanType.UNKNOWN, | ||||||
|     var filesVersioning: CapabilityBooleanType = CapabilityBooleanType.UNKNOWN, |     var filesVersioning: CapabilityBooleanType = CapabilityBooleanType.UNKNOWN, | ||||||
|     val filesPrivateLinks: 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: |      * 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 enabled: Boolean, | ||||||
|         val version: String, |         val version: String, | ||||||
|         val appsUrl: String?, |         val appsUrl: String?, | ||||||
| @ -109,4 +116,10 @@ data class RemoteCapability( | |||||||
|         val openWebUrl: String?, |         val openWebUrl: String?, | ||||||
|         val newUrl: 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 |  * @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 |  * Permission is hereby granted, free of charge, to any person obtaining a copy | ||||||
|  * of this software and associated documentation files (the "Software"), to deal |  * 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 |  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||||||
|  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||||||
|  * THE SOFTWARE. |  * THE SOFTWARE. | ||||||
|  * |  | ||||||
|  */ |  */ | ||||||
|  | 
 | ||||||
| package com.owncloud.android.lib.resources.status.responses | package com.owncloud.android.lib.resources.status.responses | ||||||
| 
 | 
 | ||||||
| import com.owncloud.android.lib.resources.status.RemoteCapability | 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.* | ||||||
| import com.owncloud.android.lib.resources.status.RemoteCapability.RemoteOCISProvider |  | ||||||
| import com.squareup.moshi.Json | import com.squareup.moshi.Json | ||||||
| import com.squareup.moshi.JsonClass | import com.squareup.moshi.JsonClass | ||||||
| 
 | 
 | ||||||
| @ -37,7 +40,7 @@ data class CapabilityResponse( | |||||||
|     val capabilities: Capabilities? |     val capabilities: Capabilities? | ||||||
| ) { | ) { | ||||||
|     fun toRemoteCapability(): RemoteCapability = RemoteCapability( |     fun toRemoteCapability(): RemoteCapability = RemoteCapability( | ||||||
|         versionMayor = serverVersion?.major ?: 0, |         versionMajor = serverVersion?.major ?: 0, | ||||||
|         versionMinor = serverVersion?.minor ?: 0, |         versionMinor = serverVersion?.minor ?: 0, | ||||||
|         versionMicro = serverVersion?.micro ?: 0, |         versionMicro = serverVersion?.micro ?: 0, | ||||||
|         versionString = serverVersion?.string ?: "", |         versionString = serverVersion?.string ?: "", | ||||||
| @ -70,10 +73,11 @@ data class CapabilityResponse( | |||||||
|         filesUndelete = CapabilityBooleanType.fromBooleanValue(capabilities?.fileCapabilities?.undelete), |         filesUndelete = CapabilityBooleanType.fromBooleanValue(capabilities?.fileCapabilities?.undelete), | ||||||
|         filesVersioning = CapabilityBooleanType.fromBooleanValue(capabilities?.fileCapabilities?.versioning), |         filesVersioning = CapabilityBooleanType.fromBooleanValue(capabilities?.fileCapabilities?.versioning), | ||||||
|         filesPrivateLinks = capabilities?.fileCapabilities?.privateLinks?.let { CapabilityBooleanType.fromBooleanValue(it) } ?: CapabilityBooleanType.UNKNOWN, |         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), |         filesSharingFederationIncoming = CapabilityBooleanType.fromBooleanValue(capabilities?.fileSharingCapabilities?.fileSharingFederation?.incoming), | ||||||
|         filesSharingFederationOutgoing = CapabilityBooleanType.fromBooleanValue(capabilities?.fileSharingCapabilities?.fileSharingFederation?.outgoing), |         filesSharingFederationOutgoing = CapabilityBooleanType.fromBooleanValue(capabilities?.fileSharingCapabilities?.fileSharingFederation?.outgoing), | ||||||
|         filesSharingUserProfilePicture = CapabilityBooleanType.fromBooleanValue(capabilities?.fileSharingCapabilities?.fileSharingUser?.profilePicture), |         filesSharingUserProfilePicture = CapabilityBooleanType.fromBooleanValue(capabilities?.fileSharingCapabilities?.fileSharingUser?.profilePicture), | ||||||
|  |         spaces = capabilities?.spacesCapabilities?.toSpaces(), | ||||||
|     ) |     ) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -86,7 +90,9 @@ data class Capabilities( | |||||||
|     @Json(name = "files") |     @Json(name = "files") | ||||||
|     val fileCapabilities: FileCapabilities?, |     val fileCapabilities: FileCapabilities?, | ||||||
|     @Json(name = "dav") |     @Json(name = "dav") | ||||||
|     val davCapabilities: DavCapabilities? |     val davCapabilities: DavCapabilities?, | ||||||
|  |     @Json(name = "spaces") | ||||||
|  |     val spacesCapabilities: SpacesCapabilities? | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| @JsonClass(generateAdapter = true) | @JsonClass(generateAdapter = true) | ||||||
| @ -182,7 +188,7 @@ data class AppProvider( | |||||||
|     @Json(name = "new_url") |     @Json(name = "new_url") | ||||||
|     val newUrl: String?, |     val newUrl: String?, | ||||||
| ) { | ) { | ||||||
|     fun toOCISProvider() = RemoteOCISProvider(enabled, version, appsUrl, openUrl, openWebUrl, newUrl) |     fun toAppProviders() = RemoteAppProviders(enabled, version, appsUrl, openUrl, openWebUrl, newUrl) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @JsonClass(generateAdapter = true) | @JsonClass(generateAdapter = true) | ||||||
| @ -190,6 +196,16 @@ data class DavCapabilities( | |||||||
|     val chunking: String? |     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) | @JsonClass(generateAdapter = true) | ||||||
| data class ServerVersion( | data class ServerVersion( | ||||||
|     var major: Int?, |     var major: Int?, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user