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

Download file operation will return unit instead of Any

This commit is contained in:
Abel García de Prada 2020-11-17 16:15:40 +01:00 committed by Abel García de Prada
parent ec71fa6c23
commit 3a996ef583
3 changed files with 7 additions and 7 deletions

View File

@ -48,7 +48,7 @@ import java.util.concurrent.atomic.AtomicBoolean
class DownloadRemoteFileOperation( class DownloadRemoteFileOperation(
private val remotePath: String, private val remotePath: String,
localFolderPath: String localFolderPath: String
) : RemoteOperation<Any>() { ) : RemoteOperation<Unit>() {
private val mCancellationRequested = AtomicBoolean(false) private val mCancellationRequested = AtomicBoolean(false)
private val mDataTransferListeners: MutableSet<OnDatatransferProgressListener> = HashSet() private val mDataTransferListeners: MutableSet<OnDatatransferProgressListener> = HashSet()
@ -58,8 +58,8 @@ class DownloadRemoteFileOperation(
var etag: String = "" var etag: String = ""
private set private set
override fun run(client: OwnCloudClient): RemoteOperationResult<Any> { override fun run(client: OwnCloudClient): RemoteOperationResult<Unit> {
var result: RemoteOperationResult<Any> var result: RemoteOperationResult<Unit>
// download will be performed to a temporal file, then moved to the final location // download will be performed to a temporal file, then moved to the final location
val tmpFile = File(tmpPath) val tmpFile = File(tmpPath)
@ -77,8 +77,8 @@ class DownloadRemoteFileOperation(
} }
@Throws(Exception::class) @Throws(Exception::class)
private fun downloadFile(client: OwnCloudClient, targetFile: File): RemoteOperationResult<Any> { private fun downloadFile(client: OwnCloudClient, targetFile: File): RemoteOperationResult<Unit> {
val result: RemoteOperationResult<Any> val result: RemoteOperationResult<Unit>
var it: Iterator<OnDatatransferProgressListener> var it: Iterator<OnDatatransferProgressListener>
var fos: FileOutputStream? = null var fos: FileOutputStream? = null
var bis: BufferedInputStream? = null var bis: BufferedInputStream? = null

View File

@ -44,7 +44,7 @@ interface FileService : Service {
fun downloadFile( fun downloadFile(
remotePath: String, remotePath: String,
localTempPath: String localTempPath: String
): RemoteOperationResult<Any> ): RemoteOperationResult<Unit>
fun refreshFolder( fun refreshFolder(
remotePath: String remotePath: String

View File

@ -61,7 +61,7 @@ class OCFileService(override val client: OwnCloudClient) : FileService {
override fun downloadFile( override fun downloadFile(
remotePath: String, remotePath: String,
localTempPath: String localTempPath: String
): RemoteOperationResult<Any> = ): RemoteOperationResult<Unit> =
DownloadRemoteFileOperation( DownloadRemoteFileOperation(
remotePath = remotePath, remotePath = remotePath,
localFolderPath = localTempPath localFolderPath = localTempPath