1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Compare commits

..

19 Commits

Author SHA1 Message Date
Aitorbp
71224c30d1
Merge pull request #581 from owncloud/release/4.1
[RELEASE] 4.1 library to master
2023-09-05 09:49:55 +01:00
Aitorbp
c82d75b1d8 New fix for snackbar when copy without server on 2023-08-30 10:16:58 +01:00
Manuel Plazas Palacio
530999848f Solving bugs when getting file existence in OC10 2023-08-24 14:12:30 +02:00
Manuel Plazas Palacio
b4625d017c Solving bugs when getting file existence. 2023-08-24 12:28:23 +02:00
Manuel Plazas Palacio
2c698cc2a4
Merge pull request #578 from owncloud/feature/unneccesary_call
[BUG] unneccessary or wrong call ....
2023-08-23 10:56:22 +02:00
Manuel Plazas Palacio
bf183fe04d Solving bug when copyin or moving 2023-08-22 15:24:59 +02:00
Manuel Plazas Palacio
1f8de383b6 Removing extra path on check path existence. 2023-08-18 11:14:11 +02:00
Aitorbp
8eb435a1c2
Merge pull request #577 from owncloud/feature/respect_app_provider_values_from_capabilities
[FEATURE REQUEST] Respect app_provider values from capabilities
2023-08-03 08:26:26 +01:00
Aitorbp
052566d205 Added variable from local data source 2023-07-31 12:43:16 +01:00
Manuel Plazas Palacio
063c3fa9e9
Merge pull request #571 from owncloud/feature/copy_move_conflic_solved_users
[FEATURE REQUEST] Copy/move conflict solved by users
2023-06-21 08:33:47 +02:00
Manuel Plazas Palacio
fa143804d2 Solving CR changes. 2023-06-08 13:31:09 +02:00
Manuel Plazas Palacio
5b64876e2c Showing decision dialog when moving file conflict.
Solving errors when copying, replace and keep both.
2023-06-07 12:15:14 +02:00
Manuel Plazas Palacio
d81ca97f14 Showing decision dialog when copying file conflict. 2023-06-07 12:15:14 +02:00
Juan Carlos Garrote
5607f76a1d
Merge pull request #566 from owncloud/technical/min_sdk_23
[TECHNICAL] Upgrade min SDK to Android 6 (v23)
2023-05-25 14:03:37 +02:00
Juan Carlos Garrote
b4137502d2 Remove unnecessary code after upgrading to min SDK 23 2023-05-25 13:33:49 +02:00
Juan Carlos Garrote
261075a8ad Update minSdkVersion to 23 (Android 6) 2023-05-25 13:33:49 +02:00
Juan Carlos Garrote
c2874357f0
Merge pull request #569 from owncloud/release/4.0
[Release] 2.1
2023-05-25 13:30:31 +02:00
Juan Carlos Garrote
e6937b4210 Removed publicUpload parameter from public shares creation and update requests 2023-05-15 14:01:16 +02:00
Juan Carlos Garrote
89dd13cec4
Merge pull request #562 from owncloud/feature/create_file_web
[FEATURE REQUEST] Create new file via Open in Web
2023-05-04 09:11:24 +02:00
19 changed files with 54 additions and 56 deletions

View File

@ -49,6 +49,6 @@ ownCloud Android Library uses OkHttp version 4.6.0, licensed under Apache Licens
### Compatibility ### Compatibility
ownCloud Android Library is valid for Android systems from version Android 5 (android:minSdkVersion="21" android:targetSdkVersion="29"). ownCloud Android Library is valid for Android systems from version Android 6 (android:minSdkVersion="23" android:targetSdkVersion="33").
ownCloud Android library supports ownCloud server from version 4.5. ownCloud Android library supports ownCloud server from version 4.5.

View File

@ -25,7 +25,7 @@ android {
compileSdkVersion 33 compileSdkVersion 33
defaultConfig { defaultConfig {
minSdkVersion 21 minSdkVersion 23
targetSdkVersion 33 targetSdkVersion 33
} }

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- ownCloud Android Library is available under MIT license <!-- ownCloud Android Library is available under MIT license
Copyright (C) 2016 ownCloud GmbH. Copyright (C) 2023 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
@ -25,13 +25,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- USE_CREDENTIALS, MANAGE_ACCOUNTS and AUTHENTICATE_ACCOUNTS are needed for API < 23.
In API >= 23 the do not exist anymore -->
<uses-permission
android:name="android.permission.MANAGE_ACCOUNTS"
android:maxSdkVersion="22" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest> </manifest>

View File

@ -36,7 +36,7 @@ import java.net.URL
class CopyMethod( class CopyMethod(
val url: URL, val url: URL,
private val destinationUrl: String, private val destinationUrl: String,
private val forceOverride: Boolean = false val forceOverride: Boolean = false
) : DavMethod(url) { ) : DavMethod(url) {
@Throws(Exception::class) @Throws(Exception::class)
public override fun onDavExecute(davResource: DavOCResource): Int { public override fun onDavExecute(davResource: DavOCResource): Int {

View File

@ -36,7 +36,7 @@ import java.net.URL
class MoveMethod( class MoveMethod(
url: URL, url: URL,
private val destinationUrl: String, private val destinationUrl: String,
private val forceOverride: Boolean = false val forceOverride: Boolean = false
) : DavMethod(url) { ) : DavMethod(url) {
@Throws(Exception::class) @Throws(Exception::class)
override fun onDavExecute(davResource: DavOCResource): Int { override fun onDavExecute(davResource: DavOCResource): Int {

View File

@ -37,14 +37,14 @@ import com.squareup.moshi.Moshi
import timber.log.Timber import timber.log.Timber
import java.net.URL import java.net.URL
class GetRemoteAppRegistryOperation : RemoteOperation<AppRegistryResponse>() { class GetRemoteAppRegistryOperation(private val appUrl: String?) : RemoteOperation<AppRegistryResponse>() {
override fun run(client: OwnCloudClient): RemoteOperationResult<AppRegistryResponse> { override fun run(client: OwnCloudClient): RemoteOperationResult<AppRegistryResponse> {
var result: RemoteOperationResult<AppRegistryResponse> var result: RemoteOperationResult<AppRegistryResponse>
try { try {
val uriBuilder = client.baseUri.buildUpon().apply { val uriBuilder = client.baseUri.buildUpon().apply {
appendEncodedPath(APP_REGISTRY_ENDPOINT) appendEncodedPath(appUrl)
} }
val getMethod = GetMethod(URL(uriBuilder.build().toString())) val getMethod = GetMethod(URL(uriBuilder.build().toString()))
val status = client.executeHttpMethod(getMethod) val status = client.executeHttpMethod(getMethod)
@ -75,8 +75,4 @@ class GetRemoteAppRegistryOperation : RemoteOperation<AppRegistryResponse>() {
return result return result
} }
companion object {
private const val APP_REGISTRY_ENDPOINT = "app/list"
}
} }

View File

@ -28,7 +28,7 @@ import com.owncloud.android.lib.resources.Service
import com.owncloud.android.lib.resources.appregistry.responses.AppRegistryResponse import com.owncloud.android.lib.resources.appregistry.responses.AppRegistryResponse
interface AppRegistryService : Service { interface AppRegistryService : Service {
fun getAppRegistry(): RemoteOperationResult<AppRegistryResponse> fun getAppRegistry(appUrl: String?): RemoteOperationResult<AppRegistryResponse>
fun getUrlToOpenInWeb( fun getUrlToOpenInWeb(
openWebEndpoint: String, openWebEndpoint: String,

View File

@ -31,8 +31,8 @@ import com.owncloud.android.lib.resources.appregistry.GetUrlToOpenInWebRemoteOpe
import com.owncloud.android.lib.resources.appregistry.responses.AppRegistryResponse import com.owncloud.android.lib.resources.appregistry.responses.AppRegistryResponse
class OCAppRegistryService(override val client: OwnCloudClient) : AppRegistryService { class OCAppRegistryService(override val client: OwnCloudClient) : AppRegistryService {
override fun getAppRegistry(): RemoteOperationResult<AppRegistryResponse> = override fun getAppRegistry(appUrl: String?): RemoteOperationResult<AppRegistryResponse> =
GetRemoteAppRegistryOperation().execute(client) GetRemoteAppRegistryOperation(appUrl).execute(client)
override fun getUrlToOpenInWeb(openWebEndpoint: String, fileId: String, appName: String): RemoteOperationResult<String> = override fun getUrlToOpenInWeb(openWebEndpoint: String, fileId: String, appName: String): RemoteOperationResult<String> =
GetUrlToOpenInWebRemoteOperation( GetUrlToOpenInWebRemoteOperation(

View File

@ -54,9 +54,8 @@ class CheckPathExistenceRemoteOperation(
) : RemoteOperation<Boolean>() { ) : RemoteOperation<Boolean>() {
override fun run(client: OwnCloudClient): RemoteOperationResult<Boolean> { override fun run(client: OwnCloudClient): RemoteOperationResult<Boolean> {
val baseStringUrl = spaceWebDavUrl ?: if (isUserLoggedIn) client.baseFilesWebDavUri.toString() val baseStringUrl = spaceWebDavUrl ?: if (isUserLoggedIn) client.userFilesWebDavUri.toString() else client.baseFilesWebDavUri.toString()
else client.userFilesWebDavUri.toString() val stringUrl = if (isUserLoggedIn) baseStringUrl + WebdavUtils.encodePath(remotePath) else baseStringUrl
val stringUrl = baseStringUrl + WebdavUtils.encodePath(remotePath)
return try { return try {
val propFindMethod = PropfindMethod(URL(stringUrl), 0, allPropSet).apply { val propFindMethod = PropfindMethod(URL(stringUrl), 0, allPropSet).apply {
@ -81,6 +80,7 @@ class CheckPathExistenceRemoteOperation(
e, e,
"Existence check for $stringUrl : ${result.logMessage}" "Existence check for $stringUrl : ${result.logMessage}"
) )
result.data = false
result result
} }
} }

View File

@ -45,6 +45,7 @@ import java.util.concurrent.TimeUnit
* @author Christian Schabesberger * @author Christian Schabesberger
* @author David González V. * @author David González V.
* @author Juan Carlos Garrote Gascón * @author Juan Carlos Garrote Gascón
* @author Manuel Plazas Palacio
* *
* @param sourceRemotePath Remote path of the file/folder to copy. * @param sourceRemotePath Remote path of the file/folder to copy.
* @param targetRemotePath Remote path desired for the file/folder to copy it. * @param targetRemotePath Remote path desired for the file/folder to copy it.
@ -54,6 +55,7 @@ class CopyRemoteFileOperation(
private val targetRemotePath: String, private val targetRemotePath: String,
private val sourceSpaceWebDavUrl: String? = null, private val sourceSpaceWebDavUrl: String? = null,
private val targetSpaceWebDavUrl: String? = null, private val targetSpaceWebDavUrl: String? = null,
private val forceOverride: Boolean = false,
) : RemoteOperation<String>() { ) : RemoteOperation<String>() {
/** /**
@ -74,9 +76,11 @@ class CopyRemoteFileOperation(
var result: RemoteOperationResult<String> var result: RemoteOperationResult<String>
try { try {
val copyMethod = CopyMethod( val copyMethod = CopyMethod(
URL((sourceSpaceWebDavUrl ?: client.userFilesWebDavUri.toString()) + WebdavUtils.encodePath(sourceRemotePath)), url = URL((sourceSpaceWebDavUrl ?: client.userFilesWebDavUri.toString()) + WebdavUtils.encodePath(sourceRemotePath)),
(targetSpaceWebDavUrl ?: client.userFilesWebDavUri.toString()) + WebdavUtils.encodePath(targetRemotePath), destinationUrl = (targetSpaceWebDavUrl ?: client.userFilesWebDavUri.toString()) + WebdavUtils.encodePath(targetRemotePath),
forceOverride = forceOverride,
).apply { ).apply {
addRequestHeaders(this)
setReadTimeout(COPY_READ_TIMEOUT, TimeUnit.SECONDS) setReadTimeout(COPY_READ_TIMEOUT, TimeUnit.SECONDS)
setConnectionTimeout(COPY_CONNECTION_TIMEOUT, TimeUnit.SECONDS) setConnectionTimeout(COPY_CONNECTION_TIMEOUT, TimeUnit.SECONDS)
} }
@ -87,6 +91,7 @@ class CopyRemoteFileOperation(
result = RemoteOperationResult(ResultCode.OK) result = RemoteOperationResult(ResultCode.OK)
result.setData(fileRemoteId) result.setData(fileRemoteId)
} }
isPreconditionFailed(status) -> { isPreconditionFailed(status) -> {
result = RemoteOperationResult(ResultCode.INVALID_OVERWRITE) result = RemoteOperationResult(ResultCode.INVALID_OVERWRITE)
client.exhaustResponse(copyMethod.getResponseBodyAsStream()) client.exhaustResponse(copyMethod.getResponseBodyAsStream())
@ -94,6 +99,7 @@ class CopyRemoteFileOperation(
/// for other errors that could be explicitly handled, check first: /// for other errors that could be explicitly handled, check first:
/// http://www.webdav.org/specs/rfc4918.html#rfc.section.9.9.4 /// http://www.webdav.org/specs/rfc4918.html#rfc.section.9.9.4
} }
else -> { else -> {
result = RemoteOperationResult(copyMethod) result = RemoteOperationResult(copyMethod)
client.exhaustResponse(copyMethod.getResponseBodyAsStream()) client.exhaustResponse(copyMethod.getResponseBodyAsStream())
@ -107,6 +113,13 @@ class CopyRemoteFileOperation(
return result return result
} }
private fun addRequestHeaders(copyMethod: CopyMethod) {
//Adding this because the library has an error with override
if (copyMethod.forceOverride) {
copyMethod.setRequestHeader(OVERWRITE, TRUE)
}
}
private fun isSuccess(status: Int) = status.isOneOf(HttpConstants.HTTP_CREATED, HttpConstants.HTTP_NO_CONTENT) private fun isSuccess(status: Int) = status.isOneOf(HttpConstants.HTTP_CREATED, HttpConstants.HTTP_NO_CONTENT)
private fun isPreconditionFailed(status: Int) = status == HttpConstants.HTTP_PRECONDITION_FAILED private fun isPreconditionFailed(status: Int) = status == HttpConstants.HTTP_PRECONDITION_FAILED
@ -114,5 +127,7 @@ class CopyRemoteFileOperation(
companion object { companion object {
private const val COPY_READ_TIMEOUT = 10L private const val COPY_READ_TIMEOUT = 10L
private const val COPY_CONNECTION_TIMEOUT = 6L private const val COPY_CONNECTION_TIMEOUT = 6L
private const val OVERWRITE = "overwrite"
private const val TRUE = "T"
} }
} }

View File

@ -46,6 +46,7 @@ import java.util.concurrent.TimeUnit
* @author David González Verdugo * @author David González Verdugo
* @author Abel García de Prada * @author Abel García de Prada
* @author Juan Carlos Garrote Gascón * @author Juan Carlos Garrote Gascón
* @author Manuel Plazas Palacio
* *
* @param sourceRemotePath Remote path of the file/folder to copy. * @param sourceRemotePath Remote path of the file/folder to copy.
* @param targetRemotePath Remote path desired for the file/folder to copy it. * @param targetRemotePath Remote path desired for the file/folder to copy it.
@ -54,6 +55,7 @@ open class MoveRemoteFileOperation(
private val sourceRemotePath: String, private val sourceRemotePath: String,
private val targetRemotePath: String, private val targetRemotePath: String,
private val spaceWebDavUrl: String? = null, private val spaceWebDavUrl: String? = null,
private val forceOverride: Boolean = false,
) : RemoteOperation<Unit>() { ) : RemoteOperation<Unit>() {
/** /**
@ -80,6 +82,7 @@ open class MoveRemoteFileOperation(
val moveMethod = MoveMethod( val moveMethod = MoveMethod(
url = URL((spaceWebDavUrl ?: srcWebDavUri.toString()) + WebdavUtils.encodePath(sourceRemotePath)), url = URL((spaceWebDavUrl ?: srcWebDavUri.toString()) + WebdavUtils.encodePath(sourceRemotePath)),
destinationUrl = (spaceWebDavUrl ?: client.userFilesWebDavUri.toString()) + WebdavUtils.encodePath(targetRemotePath), destinationUrl = (spaceWebDavUrl ?: client.userFilesWebDavUri.toString()) + WebdavUtils.encodePath(targetRemotePath),
forceOverride = forceOverride,
).apply { ).apply {
addRequestHeaders(this) addRequestHeaders(this)
setReadTimeout(MOVE_READ_TIMEOUT, TimeUnit.SECONDS) setReadTimeout(MOVE_READ_TIMEOUT, TimeUnit.SECONDS)
@ -92,6 +95,7 @@ open class MoveRemoteFileOperation(
isSuccess(status) -> { isSuccess(status) -> {
result = RemoteOperationResult<Unit>(ResultCode.OK) result = RemoteOperationResult<Unit>(ResultCode.OK)
} }
isPreconditionFailed(status) -> { isPreconditionFailed(status) -> {
result = RemoteOperationResult<Unit>(ResultCode.INVALID_OVERWRITE) result = RemoteOperationResult<Unit>(ResultCode.INVALID_OVERWRITE)
client.exhaustResponse(moveMethod.getResponseBodyAsStream()) client.exhaustResponse(moveMethod.getResponseBodyAsStream())
@ -99,6 +103,7 @@ open class MoveRemoteFileOperation(
/// for other errors that could be explicitly handled, check first: /// for other errors that could be explicitly handled, check first:
/// http://www.webdav.org/specs/rfc4918.html#rfc.section.9.9.4 /// http://www.webdav.org/specs/rfc4918.html#rfc.section.9.9.4
} }
else -> { else -> {
result = RemoteOperationResult<Unit>(moveMethod) result = RemoteOperationResult<Unit>(moveMethod)
client.exhaustResponse(moveMethod.getResponseBodyAsStream()) client.exhaustResponse(moveMethod.getResponseBodyAsStream())
@ -125,6 +130,10 @@ open class MoveRemoteFileOperation(
* In case new headers are needed, override this method * In case new headers are needed, override this method
*/ */
open fun addRequestHeaders(moveMethod: MoveMethod) { open fun addRequestHeaders(moveMethod: MoveMethod) {
//Adding this because the library has an error with override
if (moveMethod.forceOverride) {
moveMethod.setRequestHeader(OVERWRITE, TRUE)
}
} }
private fun isSuccess(status: Int) = status.isOneOf(HttpConstants.HTTP_CREATED, HttpConstants.HTTP_NO_CONTENT) private fun isSuccess(status: Int) = status.isOneOf(HttpConstants.HTTP_CREATED, HttpConstants.HTTP_NO_CONTENT)
@ -134,5 +143,7 @@ open class MoveRemoteFileOperation(
companion object { companion object {
private const val MOVE_READ_TIMEOUT = 10L private const val MOVE_READ_TIMEOUT = 10L
private const val MOVE_CONNECTION_TIMEOUT = 6L private const val MOVE_CONNECTION_TIMEOUT = 6L
private const val OVERWRITE = "overwrite"
private const val TRUE = "T"
} }
} }

View File

@ -106,7 +106,7 @@ class RenameRemoteFileOperation(
* @return 'True' if the target path is already used by an existing file. * @return 'True' if the target path is already used by an existing file.
*/ */
private fun targetPathIsUsed(client: OwnCloudClient): Boolean { private fun targetPathIsUsed(client: OwnCloudClient): Boolean {
val checkPathExistenceRemoteOperation = CheckPathExistenceRemoteOperation(newRemotePath, false) val checkPathExistenceRemoteOperation = CheckPathExistenceRemoteOperation(newRemotePath, true)
val exists = checkPathExistenceRemoteOperation.execute(client) val exists = checkPathExistenceRemoteOperation.execute(client)
return exists.isSuccess return exists.isSuccess
} }

View File

@ -39,7 +39,8 @@ interface FileService : Service {
targetRemotePath: String, targetRemotePath: String,
sourceSpaceWebDavUrl: String?, sourceSpaceWebDavUrl: String?,
targetSpaceWebDavUrl: String?, targetSpaceWebDavUrl: String?,
): RemoteOperationResult<String> replace: Boolean,
): RemoteOperationResult<String?>
fun createFolder( fun createFolder(
remotePath: String, remotePath: String,
@ -57,6 +58,7 @@ interface FileService : Service {
sourceRemotePath: String, sourceRemotePath: String,
targetRemotePath: String, targetRemotePath: String,
spaceWebDavUrl: String?, spaceWebDavUrl: String?,
replace: Boolean,
): RemoteOperationResult<Unit> ): RemoteOperationResult<Unit>
fun readFile( fun readFile(

View File

@ -54,12 +54,14 @@ class OCFileService(override val client: OwnCloudClient) : FileService {
targetRemotePath: String, targetRemotePath: String,
sourceSpaceWebDavUrl: String?, sourceSpaceWebDavUrl: String?,
targetSpaceWebDavUrl: String?, targetSpaceWebDavUrl: String?,
): RemoteOperationResult<String> = replace: Boolean,
): RemoteOperationResult<String?> =
CopyRemoteFileOperation( CopyRemoteFileOperation(
sourceRemotePath = sourceRemotePath, sourceRemotePath = sourceRemotePath,
targetRemotePath = targetRemotePath, targetRemotePath = targetRemotePath,
sourceSpaceWebDavUrl = sourceSpaceWebDavUrl, sourceSpaceWebDavUrl = sourceSpaceWebDavUrl,
targetSpaceWebDavUrl = targetSpaceWebDavUrl, targetSpaceWebDavUrl = targetSpaceWebDavUrl,
forceOverride = replace,
).execute(client) ).execute(client)
override fun createFolder( override fun createFolder(
@ -88,11 +90,13 @@ class OCFileService(override val client: OwnCloudClient) : FileService {
sourceRemotePath: String, sourceRemotePath: String,
targetRemotePath: String, targetRemotePath: String,
spaceWebDavUrl: String?, spaceWebDavUrl: String?,
replace: Boolean,
): RemoteOperationResult<Unit> = ): RemoteOperationResult<Unit> =
MoveRemoteFileOperation( MoveRemoteFileOperation(
sourceRemotePath = sourceRemotePath, sourceRemotePath = sourceRemotePath,
targetRemotePath = targetRemotePath, targetRemotePath = targetRemotePath,
spaceWebDavUrl = spaceWebDavUrl, spaceWebDavUrl = spaceWebDavUrl,
forceOverride = replace,
).execute(client) ).execute(client)
override fun readFile( override fun readFile(

View File

@ -89,8 +89,6 @@ class CreateRemoteShareOperation(
var expirationDateInMillis: Long = INIT_EXPIRATION_DATE_IN_MILLIS // Expiration date to set for the public link 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 var retrieveShareDetails = false // To retrieve more info about the just created share
private fun buildRequestUri(baseUri: Uri) = private fun buildRequestUri(baseUri: Uri) =
@ -99,7 +97,7 @@ class CreateRemoteShareOperation(
.appendQueryParameter(PARAM_FORMAT, VALUE_FORMAT) .appendQueryParameter(PARAM_FORMAT, VALUE_FORMAT)
.build() .build()
private fun parseResponse(response: String): ShareResponse? { private fun parseResponse(response: String): ShareResponse {
val moshi = Moshi.Builder().build() val moshi = Moshi.Builder().build()
val commonOcsType: Type = Types.newParameterizedType(CommonOcsResponse::class.java, ShareItem::class.java) val commonOcsType: Type = Types.newParameterizedType(CommonOcsResponse::class.java, ShareItem::class.java)
val adapter: JsonAdapter<CommonOcsResponse<ShareItem>> = moshi.adapter(commonOcsType) val adapter: JsonAdapter<CommonOcsResponse<ShareItem>> = moshi.adapter(commonOcsType)
@ -155,12 +153,10 @@ class CreateRemoteShareOperation(
formBodyBuilder.add(PARAM_EXPIRATION_DATE, formattedExpirationDate) formBodyBuilder.add(PARAM_EXPIRATION_DATE, formattedExpirationDate)
} }
if (publicUpload) {
formBodyBuilder.add(PARAM_PUBLIC_UPLOAD, publicUpload.toString())
}
if (password.isNotEmpty()) { if (password.isNotEmpty()) {
formBodyBuilder.add(PARAM_PASSWORD, password) formBodyBuilder.add(PARAM_PASSWORD, password)
} }
if (RemoteShare.DEFAULT_PERMISSION != permissions) { if (RemoteShare.DEFAULT_PERMISSION != permissions) {
formBodyBuilder.add(PARAM_PERMISSIONS, permissions.toString()) formBodyBuilder.add(PARAM_PERMISSIONS, permissions.toString())
} }
@ -207,7 +203,6 @@ class CreateRemoteShareOperation(
private const val PARAM_SHARE_TYPE = "shareType" private const val PARAM_SHARE_TYPE = "shareType"
private const val PARAM_SHARE_WITH = "shareWith" private const val PARAM_SHARE_WITH = "shareWith"
private const val PARAM_PASSWORD = "password" private const val PARAM_PASSWORD = "password"
private const val PARAM_PUBLIC_UPLOAD = "publicUpload"
private const val PARAM_PERMISSIONS = "permissions" private const val PARAM_PERMISSIONS = "permissions"
//Arguments - constant values //Arguments - constant values

View File

@ -103,13 +103,6 @@ class UpdateRemoteShareOperation
*/ */
var permissions: Int = DEFAULT_PERMISSION 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 var retrieveShareDetails = false // To retrieve more info about the just updated share
private fun buildRequestUri(baseUri: Uri) = private fun buildRequestUri(baseUri: Uri) =
@ -119,7 +112,7 @@ class UpdateRemoteShareOperation
.appendQueryParameter(PARAM_FORMAT, VALUE_FORMAT) .appendQueryParameter(PARAM_FORMAT, VALUE_FORMAT)
.build() .build()
private fun parseResponse(response: String): ShareResponse? { private fun parseResponse(response: String): ShareResponse {
val moshi = Moshi.Builder().build() val moshi = Moshi.Builder().build()
val commonOcsType: Type = Types.newParameterizedType(CommonOcsResponse::class.java, ShareItem::class.java) val commonOcsType: Type = Types.newParameterizedType(CommonOcsResponse::class.java, ShareItem::class.java)
val adapter: JsonAdapter<CommonOcsResponse<ShareItem>> = moshi.adapter(commonOcsType) val adapter: JsonAdapter<CommonOcsResponse<ShareItem>> = moshi.adapter(commonOcsType)
@ -181,10 +174,6 @@ class UpdateRemoteShareOperation
formBodyBuilder.add(PARAM_EXPIRATION_DATE, formattedExpirationDate) formBodyBuilder.add(PARAM_EXPIRATION_DATE, formattedExpirationDate)
} // else, ignore - no update } // else, ignore - no update
if (publicUpload != null) {
formBodyBuilder.add(PARAM_PUBLIC_UPLOAD, publicUpload.toString())
}
// IMPORTANT: permissions parameter needs to be updated after mPublicUpload parameter, // 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 // otherwise they would be set always as 1 (READ) in the server when mPublicUpload was updated
if (permissions > DEFAULT_PERMISSION) { if (permissions > DEFAULT_PERMISSION) {
@ -233,7 +222,6 @@ class UpdateRemoteShareOperation
private const val PARAM_PASSWORD = "password" private const val PARAM_PASSWORD = "password"
private const val PARAM_EXPIRATION_DATE = "expireDate" private const val PARAM_EXPIRATION_DATE = "expireDate"
private const val PARAM_PERMISSIONS = "permissions" private const val PARAM_PERMISSIONS = "permissions"
private const val PARAM_PUBLIC_UPLOAD = "publicUpload"
//Arguments - constant values //Arguments - constant values
private const val FORMAT_EXPIRATION_DATE = "yyyy-MM-dd" private const val FORMAT_EXPIRATION_DATE = "yyyy-MM-dd"

View File

@ -46,7 +46,6 @@ interface ShareService : Service {
name: String, name: String,
password: String, password: String,
expirationDate: Long, expirationDate: Long,
publicUpload: Boolean
): RemoteOperationResult<ShareResponse> ): RemoteOperationResult<ShareResponse>
fun updateShare( fun updateShare(
@ -55,7 +54,6 @@ interface ShareService : Service {
password: String?, password: String?,
expirationDate: Long, expirationDate: Long,
permissions: Int, permissions: Int,
publicUpload: Boolean
): RemoteOperationResult<ShareResponse> ): RemoteOperationResult<ShareResponse>
fun deleteShare(remoteId: String): RemoteOperationResult<Unit> fun deleteShare(remoteId: String): RemoteOperationResult<Unit>

View File

@ -55,7 +55,6 @@ class OCShareService(override val client: OwnCloudClient) : ShareService {
name: String, name: String,
password: String, password: String,
expirationDate: Long, expirationDate: Long,
publicUpload: Boolean
): RemoteOperationResult<ShareResponse> = ): RemoteOperationResult<ShareResponse> =
CreateRemoteShareOperation( CreateRemoteShareOperation(
remoteFilePath, remoteFilePath,
@ -66,7 +65,6 @@ class OCShareService(override val client: OwnCloudClient) : ShareService {
this.name = name this.name = name
this.password = password this.password = password
this.expirationDateInMillis = expirationDate this.expirationDateInMillis = expirationDate
this.publicUpload = publicUpload
this.retrieveShareDetails = true this.retrieveShareDetails = true
}.execute(client) }.execute(client)
@ -76,7 +74,6 @@ class OCShareService(override val client: OwnCloudClient) : ShareService {
password: String?, password: String?,
expirationDate: Long, expirationDate: Long,
permissions: Int, permissions: Int,
publicUpload: Boolean
): RemoteOperationResult<ShareResponse> = ): RemoteOperationResult<ShareResponse> =
UpdateRemoteShareOperation( UpdateRemoteShareOperation(
remoteId remoteId
@ -85,7 +82,6 @@ class OCShareService(override val client: OwnCloudClient) : ShareService {
this.password = password this.password = password
this.expirationDateInMillis = expirationDate this.expirationDateInMillis = expirationDate
this.permissions = permissions this.permissions = permissions
this.publicUpload = publicUpload
this.retrieveShareDetails = true this.retrieveShareDetails = true
}.execute(client) }.execute(client)

View File

@ -40,7 +40,7 @@ class OCServerInfoService : ServerInfoService {
): RemoteOperationResult<Boolean> = ): RemoteOperationResult<Boolean> =
CheckPathExistenceRemoteOperation( CheckPathExistenceRemoteOperation(
remotePath = path, remotePath = path,
isUserLoggedIn = true, isUserLoggedIn = isUserLoggedIn,
).execute(client) ).execute(client)
override fun getRemoteStatus( override fun getRemoteStatus(