diff --git a/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/managers/UploadManager.kt b/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/managers/UploadManager.kt index 1ae938e4..c3f0eb16 100644 --- a/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/managers/UploadManager.kt +++ b/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/managers/UploadManager.kt @@ -181,7 +181,7 @@ class UploadManager( chunkIndex: Int, isLastChunk: Boolean, data: ByteArray, - onUpload: (bytesSentTotal: Long, chunkSize: Long) -> Unit, + onUpload: suspend (bytesSentTotal: Long, chunkSize: Long) -> Unit, ): Unit = withContext(Dispatchers.IO) { val uploadSession = uploadController.getUploadByUUID(uuid) ?: throw NotFoundException("${UploadSession::class.simpleName} not found in DB with uuid = $uuid") diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/repositories/UploadRepository.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/repositories/UploadRepository.kt index 1616d526..05b591d2 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/repositories/UploadRepository.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/repositories/UploadRepository.kt @@ -110,7 +110,7 @@ class UploadRepository internal constructor(private val uploadRequest: UploadReq chunkIndex: Int, isLastChunk: Boolean, data: ByteArray, - onUpload: (bytesSentTotal: Long, chunkSize: Long) -> Unit, + onUpload: suspend (bytesSentTotal: Long, chunkSize: Long) -> Unit, ): Boolean { return uploadRequest.uploadChunk(uploadHost, containerUUID, fileUUID, chunkIndex, isLastChunk, data, onUpload) } diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/UploadRequest.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/UploadRequest.kt index 75a0e280..3b89844a 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/UploadRequest.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/UploadRequest.kt @@ -58,7 +58,7 @@ internal class UploadRequest(json: Json, httpClient: HttpClient) : BaseRequest(j chunkIndex: Int, isLastChunk: Boolean, data: ByteArray, - onUpload: (bytesSentTotal: Long, chunkSize: Long) -> Unit, + onUpload: suspend (bytesSentTotal: Long, chunkSize: Long) -> Unit, ): Boolean { val httpResponse = httpClient.post( urlString = SharedApiRoutes.uploadChunk(uploadHost, containerUUID, fileUUID, chunkIndex, isLastChunk)