mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-06 15:36:45 +00:00
Removed publicUpload parameter from public shares creation and update requests
This commit is contained in:
parent
89dd13cec4
commit
e6937b4210
@ -89,8 +89,6 @@ class CreateRemoteShareOperation(
|
||||
|
||||
var expirationDateInMillis: Long = INIT_EXPIRATION_DATE_IN_MILLIS // Expiration date to set for the public link
|
||||
|
||||
var publicUpload: Boolean = false // Upload permissions for the public link (only folders)
|
||||
|
||||
var retrieveShareDetails = false // To retrieve more info about the just created share
|
||||
|
||||
private fun buildRequestUri(baseUri: Uri) =
|
||||
@ -99,7 +97,7 @@ class CreateRemoteShareOperation(
|
||||
.appendQueryParameter(PARAM_FORMAT, VALUE_FORMAT)
|
||||
.build()
|
||||
|
||||
private fun parseResponse(response: String): ShareResponse? {
|
||||
private fun parseResponse(response: String): ShareResponse {
|
||||
val moshi = Moshi.Builder().build()
|
||||
val commonOcsType: Type = Types.newParameterizedType(CommonOcsResponse::class.java, ShareItem::class.java)
|
||||
val adapter: JsonAdapter<CommonOcsResponse<ShareItem>> = moshi.adapter(commonOcsType)
|
||||
@ -155,12 +153,10 @@ class CreateRemoteShareOperation(
|
||||
formBodyBuilder.add(PARAM_EXPIRATION_DATE, formattedExpirationDate)
|
||||
}
|
||||
|
||||
if (publicUpload) {
|
||||
formBodyBuilder.add(PARAM_PUBLIC_UPLOAD, publicUpload.toString())
|
||||
}
|
||||
if (password.isNotEmpty()) {
|
||||
formBodyBuilder.add(PARAM_PASSWORD, password)
|
||||
}
|
||||
|
||||
if (RemoteShare.DEFAULT_PERMISSION != permissions) {
|
||||
formBodyBuilder.add(PARAM_PERMISSIONS, permissions.toString())
|
||||
}
|
||||
@ -207,7 +203,6 @@ class CreateRemoteShareOperation(
|
||||
private const val PARAM_SHARE_TYPE = "shareType"
|
||||
private const val PARAM_SHARE_WITH = "shareWith"
|
||||
private const val PARAM_PASSWORD = "password"
|
||||
private const val PARAM_PUBLIC_UPLOAD = "publicUpload"
|
||||
private const val PARAM_PERMISSIONS = "permissions"
|
||||
|
||||
//Arguments - constant values
|
||||
|
@ -103,13 +103,6 @@ class UpdateRemoteShareOperation
|
||||
*/
|
||||
var permissions: Int = DEFAULT_PERMISSION
|
||||
|
||||
/**
|
||||
* Enable upload permissions to update in Share resource.
|
||||
*
|
||||
* Null results in no update applied to the upload permission.
|
||||
*/
|
||||
var publicUpload: Boolean? = null
|
||||
|
||||
var retrieveShareDetails = false // To retrieve more info about the just updated share
|
||||
|
||||
private fun buildRequestUri(baseUri: Uri) =
|
||||
@ -119,7 +112,7 @@ class UpdateRemoteShareOperation
|
||||
.appendQueryParameter(PARAM_FORMAT, VALUE_FORMAT)
|
||||
.build()
|
||||
|
||||
private fun parseResponse(response: String): ShareResponse? {
|
||||
private fun parseResponse(response: String): ShareResponse {
|
||||
val moshi = Moshi.Builder().build()
|
||||
val commonOcsType: Type = Types.newParameterizedType(CommonOcsResponse::class.java, ShareItem::class.java)
|
||||
val adapter: JsonAdapter<CommonOcsResponse<ShareItem>> = moshi.adapter(commonOcsType)
|
||||
@ -181,10 +174,6 @@ class UpdateRemoteShareOperation
|
||||
formBodyBuilder.add(PARAM_EXPIRATION_DATE, formattedExpirationDate)
|
||||
} // else, ignore - no update
|
||||
|
||||
if (publicUpload != null) {
|
||||
formBodyBuilder.add(PARAM_PUBLIC_UPLOAD, publicUpload.toString())
|
||||
}
|
||||
|
||||
// IMPORTANT: permissions parameter needs to be updated after mPublicUpload parameter,
|
||||
// otherwise they would be set always as 1 (READ) in the server when mPublicUpload was updated
|
||||
if (permissions > DEFAULT_PERMISSION) {
|
||||
@ -233,7 +222,6 @@ class UpdateRemoteShareOperation
|
||||
private const val PARAM_PASSWORD = "password"
|
||||
private const val PARAM_EXPIRATION_DATE = "expireDate"
|
||||
private const val PARAM_PERMISSIONS = "permissions"
|
||||
private const val PARAM_PUBLIC_UPLOAD = "publicUpload"
|
||||
|
||||
//Arguments - constant values
|
||||
private const val FORMAT_EXPIRATION_DATE = "yyyy-MM-dd"
|
||||
|
@ -46,7 +46,6 @@ interface ShareService : Service {
|
||||
name: String,
|
||||
password: String,
|
||||
expirationDate: Long,
|
||||
publicUpload: Boolean
|
||||
): RemoteOperationResult<ShareResponse>
|
||||
|
||||
fun updateShare(
|
||||
@ -55,7 +54,6 @@ interface ShareService : Service {
|
||||
password: String?,
|
||||
expirationDate: Long,
|
||||
permissions: Int,
|
||||
publicUpload: Boolean
|
||||
): RemoteOperationResult<ShareResponse>
|
||||
|
||||
fun deleteShare(remoteId: String): RemoteOperationResult<Unit>
|
||||
|
@ -55,7 +55,6 @@ class OCShareService(override val client: OwnCloudClient) : ShareService {
|
||||
name: String,
|
||||
password: String,
|
||||
expirationDate: Long,
|
||||
publicUpload: Boolean
|
||||
): RemoteOperationResult<ShareResponse> =
|
||||
CreateRemoteShareOperation(
|
||||
remoteFilePath,
|
||||
@ -66,7 +65,6 @@ class OCShareService(override val client: OwnCloudClient) : ShareService {
|
||||
this.name = name
|
||||
this.password = password
|
||||
this.expirationDateInMillis = expirationDate
|
||||
this.publicUpload = publicUpload
|
||||
this.retrieveShareDetails = true
|
||||
}.execute(client)
|
||||
|
||||
@ -76,7 +74,6 @@ class OCShareService(override val client: OwnCloudClient) : ShareService {
|
||||
password: String?,
|
||||
expirationDate: Long,
|
||||
permissions: Int,
|
||||
publicUpload: Boolean
|
||||
): RemoteOperationResult<ShareResponse> =
|
||||
UpdateRemoteShareOperation(
|
||||
remoteId
|
||||
@ -85,7 +82,6 @@ class OCShareService(override val client: OwnCloudClient) : ShareService {
|
||||
this.password = password
|
||||
this.expirationDateInMillis = expirationDate
|
||||
this.permissions = permissions
|
||||
this.publicUpload = publicUpload
|
||||
this.retrieveShareDetails = true
|
||||
}.execute(client)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user