1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-06 15:36:45 +00:00

Merge pull request #549 from owncloud/release/2.1

[Release] 2.1 beta.1
This commit is contained in:
Juan Carlos Garrote 2023-03-13 13:09:04 +01:00 committed by GitHub
commit e6e30fc352
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 19 deletions

View File

@ -24,13 +24,36 @@
package com.owncloud.android.lib.common.http.methods.webdav
import at.bitfire.dav4jvm.Property
import at.bitfire.dav4jvm.PropertyUtils.getAllPropSet
import at.bitfire.dav4jvm.PropertyUtils.getQuotaPropset
import at.bitfire.dav4jvm.property.CreationDate
import at.bitfire.dav4jvm.property.DisplayName
import at.bitfire.dav4jvm.property.GetContentLength
import at.bitfire.dav4jvm.property.GetContentType
import at.bitfire.dav4jvm.property.GetETag
import at.bitfire.dav4jvm.property.GetLastModified
import at.bitfire.dav4jvm.property.OCId
import at.bitfire.dav4jvm.property.OCPermissions
import at.bitfire.dav4jvm.property.OCPrivatelink
import at.bitfire.dav4jvm.property.OCSize
import at.bitfire.dav4jvm.property.ResourceType
import com.owncloud.android.lib.common.http.methods.webdav.properties.OCShareTypes
object DavUtils {
@JvmStatic val allPropset: Array<Property.Name>
get() = getAllPropSet().plus(OCShareTypes.NAME)
@JvmStatic val allPropSet: Array<Property.Name>
get() = arrayOf(
DisplayName.NAME,
GetContentType.NAME,
ResourceType.NAME,
GetContentLength.NAME,
GetLastModified.NAME,
CreationDate.NAME,
GetETag.NAME,
OCPermissions.NAME,
OCId.NAME,
OCSize.NAME,
OCPrivatelink.NAME,
OCShareTypes.NAME,
)
val quotaPropSet: Array<Property.Name>
get() = getQuotaPropset()

View File

@ -25,7 +25,7 @@ package com.owncloud.android.lib.resources.files
import com.owncloud.android.lib.common.OwnCloudClient
import com.owncloud.android.lib.common.http.HttpConstants
import com.owncloud.android.lib.common.http.methods.webdav.DavUtils.allPropset
import com.owncloud.android.lib.common.http.methods.webdav.DavUtils.allPropSet
import com.owncloud.android.lib.common.http.methods.webdav.PropfindMethod
import com.owncloud.android.lib.common.network.WebdavUtils
import com.owncloud.android.lib.common.operations.RemoteOperation
@ -59,7 +59,7 @@ class CheckPathExistenceRemoteOperation(
val stringUrl = baseStringUrl + WebdavUtils.encodePath(remotePath)
return try {
val propFindMethod = PropfindMethod(URL(stringUrl), 0, allPropset).apply {
val propFindMethod = PropfindMethod(URL(stringUrl), 0, allPropSet).apply {
setReadTimeout(TIMEOUT.toLong(), TimeUnit.SECONDS)
setConnectionTimeout(TIMEOUT.toLong(), TimeUnit.SECONDS)
}

View File

@ -44,7 +44,7 @@ class GetBaseUrlRemoteOperation : RemoteOperation<String?>() {
return try {
val stringUrl = client.baseFilesWebDavUri.toString()
val propFindMethod = PropfindMethod(URL(stringUrl), 0, DavUtils.allPropset).apply {
val propFindMethod = PropfindMethod(URL(stringUrl), 0, DavUtils.allPropSet).apply {
setReadTimeout(TIMEOUT, TimeUnit.SECONDS)
setConnectionTimeout(TIMEOUT, TimeUnit.SECONDS)
}

View File

@ -62,7 +62,7 @@ class ReadRemoteFileOperation(
val propFind = PropfindMethod(
url = getFinalWebDavUrl(),
depth = DEPTH_0,
propertiesToRequest = DavUtils.allPropset
propertiesToRequest = DavUtils.allPropSet
).apply {
setReadTimeout(SYNC_READ_TIMEOUT, TimeUnit.SECONDS)
setConnectionTimeout(SYNC_CONNECTION_TIMEOUT, TimeUnit.SECONDS)

View File

@ -64,7 +64,7 @@ class ReadRemoteFolderOperation(
val propfindMethod = PropfindMethod(
getFinalWebDavUrl(),
DavConstants.DEPTH_1,
DavUtils.allPropset
DavUtils.allPropSet
)
val status = client.executeHttpMethod(propfindMethod)

View File

@ -39,8 +39,6 @@ import at.bitfire.dav4jvm.property.OCId
import at.bitfire.dav4jvm.property.OCPermissions
import at.bitfire.dav4jvm.property.OCPrivatelink
import at.bitfire.dav4jvm.property.OCSize
import at.bitfire.dav4jvm.property.QuotaAvailableBytes
import at.bitfire.dav4jvm.property.QuotaUsedBytes
import com.owncloud.android.lib.common.OwnCloudClient
import com.owncloud.android.lib.common.http.HttpConstants
import com.owncloud.android.lib.common.http.methods.webdav.properties.OCShareTypes
@ -51,7 +49,6 @@ import kotlinx.parcelize.Parcelize
import okhttp3.HttpUrl
import timber.log.Timber
import java.io.File
import java.math.BigDecimal
/**
* Contains the data of a Remote File from a WebDavEntry
@ -73,8 +70,6 @@ data class RemoteFile(
var permissions: String? = null,
var remoteId: String? = null,
var size: Long = 0,
var quotaUsedBytes: BigDecimal? = null,
var quotaAvailableBytes: BigDecimal? = null,
var privateLink: String? = null,
var owner: String,
var sharedByLink: Boolean = false,
@ -137,12 +132,6 @@ data class RemoteFile(
is OCSize -> {
remoteFile.size = property.size
}
is QuotaUsedBytes -> {
remoteFile.quotaUsedBytes = BigDecimal.valueOf(property.quotaUsedBytes)
}
is QuotaAvailableBytes -> {
remoteFile.quotaAvailableBytes = BigDecimal.valueOf(property.quotaAvailableBytes)
}
is OCPrivatelink -> {
remoteFile.privateLink = property.link
}