mirror of
https://github.com/nextcloud/android.git
synced 2024-11-25 22:55:46 +03:00
Convert to kt
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
2b257fb67e
commit
a690674b5d
1 changed files with 26 additions and 28 deletions
|
@ -29,9 +29,7 @@ import org.apache.jackrabbit.webdav.client.methods.DeleteMethod
|
|||
|
||||
/**
|
||||
* Remote operation performing the removal of a remote encrypted file or folder
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* Constructor
|
||||
*
|
||||
* @param remotePath RemotePath of the remote file or folder to remove from the server
|
||||
|
@ -124,6 +122,31 @@ class RemoveRemoteEncryptedFileOperation internal constructor(
|
|||
return metadata
|
||||
}
|
||||
|
||||
private fun deleteForV1(client: OwnCloudClient, token: String?): RemoteOperationResult<Void> {
|
||||
val arbitraryDataProvider: ArbitraryDataProvider = ArbitraryDataProviderImpl(context)
|
||||
val metadata = getMetadataV1(arbitraryDataProvider)
|
||||
val (first) = deleteRemoteFile(client, token)
|
||||
|
||||
val serializedMetadata: String = if (metadata.metadata.getMetadataKey() != null) {
|
||||
EncryptionUtils.serializeJSON(metadata, true)
|
||||
} else {
|
||||
EncryptionUtils.serializeJSON(metadata)
|
||||
}
|
||||
|
||||
EncryptionUtils.uploadMetadata(
|
||||
parentFolder,
|
||||
serializedMetadata,
|
||||
token,
|
||||
client,
|
||||
true, E2EVersion.V1_2,
|
||||
"",
|
||||
arbitraryDataProvider,
|
||||
user
|
||||
)
|
||||
|
||||
return first
|
||||
}
|
||||
|
||||
private fun deleteForV2(client: OwnCloudClient, token: String?): Pair<RemoteOperationResult<Void>, DeleteMethod> {
|
||||
val encryptionUtilsV2 = EncryptionUtilsV2()
|
||||
|
||||
|
@ -156,31 +179,6 @@ class RemoveRemoteEncryptedFileOperation internal constructor(
|
|||
return Pair(result, delete)
|
||||
}
|
||||
|
||||
private fun deleteForV1(client: OwnCloudClient, token: String?): RemoteOperationResult<Void> {
|
||||
val arbitraryDataProvider: ArbitraryDataProvider = ArbitraryDataProviderImpl(context)
|
||||
val metadata = getMetadataV1(arbitraryDataProvider)
|
||||
val (first) = deleteRemoteFile(client, token)
|
||||
|
||||
val serializedMetadata: String = if (metadata.metadata.getMetadataKey() != null) {
|
||||
EncryptionUtils.serializeJSON(metadata, true)
|
||||
} else {
|
||||
EncryptionUtils.serializeJSON(metadata)
|
||||
}
|
||||
|
||||
EncryptionUtils.uploadMetadata(
|
||||
parentFolder,
|
||||
serializedMetadata,
|
||||
token,
|
||||
client,
|
||||
true, E2EVersion.V1_2,
|
||||
"",
|
||||
arbitraryDataProvider,
|
||||
user
|
||||
)
|
||||
|
||||
return first
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val TAG = RemoveRemoteEncryptedFileOperation::class.java.getSimpleName()
|
||||
private const val REMOVE_READ_TIMEOUT = 30000
|
||||
|
|
Loading…
Reference in a new issue