From fce7ec89121010690181d8b5f3ac19e03ccddbd2 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 10 Oct 2024 21:53:26 +0600 Subject: [PATCH] start migration onto ktor 3.0 --- gradle/libs.versions.toml | 4 ++-- .../dev/inmo/micro_utils/ktor/client/TemporalUpload.kt | 3 ++- .../dev/inmo/micro_utils/ktor/client/ActualTemporalUpload.kt | 5 +++-- .../dev/inmo/micro_utils/ktor/client/ActualTemporalUpload.kt | 3 ++- .../client/src/linuxArm64Main/kotlin/ActualTemporalUpload.kt | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9fafdeb524d..ffbe7b6fe17 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -kt = "2.0.20" +kt = "2.0.21" kt-serialization = "1.7.3" kt-coroutines = "1.9.0" @@ -15,7 +15,7 @@ sqlite = "3.46.1.3" korlibs = "5.4.0" uuid = "0.8.4" -ktor = "2.3.12" +ktor = "3.0.0" gh-release = "2.5.2" diff --git a/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/client/TemporalUpload.kt b/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/client/TemporalUpload.kt index ab0d0de9ab7..8b1cc74ad8a 100644 --- a/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/client/TemporalUpload.kt +++ b/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/client/TemporalUpload.kt @@ -3,9 +3,10 @@ package dev.inmo.micro_utils.ktor.client import dev.inmo.micro_utils.common.MPPFile import dev.inmo.micro_utils.ktor.common.* import io.ktor.client.HttpClient +import io.ktor.client.content.* expect suspend fun HttpClient.tempUpload( fullTempUploadDraftPath: String, file: MPPFile, - onUpload: OnUploadCallback = { _, _ -> } + onUpload: ProgressListener = { _, _ -> } ): TemporalFileId diff --git a/ktor/client/src/jsMain/kotlin/dev/inmo/micro_utils/ktor/client/ActualTemporalUpload.kt b/ktor/client/src/jsMain/kotlin/dev/inmo/micro_utils/ktor/client/ActualTemporalUpload.kt index 35a9f89a6eb..0dcc49ecde6 100644 --- a/ktor/client/src/jsMain/kotlin/dev/inmo/micro_utils/ktor/client/ActualTemporalUpload.kt +++ b/ktor/client/src/jsMain/kotlin/dev/inmo/micro_utils/ktor/client/ActualTemporalUpload.kt @@ -5,6 +5,7 @@ import dev.inmo.micro_utils.coroutines.LinkedSupervisorJob import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions import dev.inmo.micro_utils.ktor.common.TemporalFileId import io.ktor.client.HttpClient +import io.ktor.client.content.* import kotlinx.coroutines.* import org.w3c.dom.mediasource.ENDED import org.w3c.dom.mediasource.ReadyState @@ -14,7 +15,7 @@ import org.w3c.xhr.XMLHttpRequest.Companion.DONE suspend fun tempUpload( fullTempUploadDraftPath: String, file: MPPFile, - onUpload: OnUploadCallback + onUpload: ProgressListener ): TemporalFileId { val formData = FormData() val answer = CompletableDeferred(currentCoroutineContext().job) @@ -60,5 +61,5 @@ suspend fun tempUpload( actual suspend fun HttpClient.tempUpload( fullTempUploadDraftPath: String, file: MPPFile, - onUpload: OnUploadCallback + onUpload: ProgressListener ): TemporalFileId = dev.inmo.micro_utils.ktor.client.tempUpload(fullTempUploadDraftPath, file, onUpload) diff --git a/ktor/client/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/client/ActualTemporalUpload.kt b/ktor/client/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/client/ActualTemporalUpload.kt index 3341ef88b83..b55791da76f 100644 --- a/ktor/client/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/client/ActualTemporalUpload.kt +++ b/ktor/client/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/client/ActualTemporalUpload.kt @@ -4,6 +4,7 @@ import dev.inmo.micro_utils.common.MPPFile import dev.inmo.micro_utils.common.filename import dev.inmo.micro_utils.ktor.common.TemporalFileId import io.ktor.client.HttpClient +import io.ktor.client.content.* import io.ktor.client.plugins.onUpload import io.ktor.client.request.forms.formData import io.ktor.client.request.forms.submitFormWithBinaryData @@ -18,7 +19,7 @@ internal val MPPFile.mimeType: String actual suspend fun HttpClient.tempUpload( fullTempUploadDraftPath: String, file: MPPFile, - onUpload: OnUploadCallback + onUpload: ProgressListener ): TemporalFileId { val inputProvider = file.inputProvider() val fileId = submitFormWithBinaryData( diff --git a/ktor/client/src/linuxArm64Main/kotlin/ActualTemporalUpload.kt b/ktor/client/src/linuxArm64Main/kotlin/ActualTemporalUpload.kt index 8dc14e5f7c0..42d7210c7a7 100644 --- a/ktor/client/src/linuxArm64Main/kotlin/ActualTemporalUpload.kt +++ b/ktor/client/src/linuxArm64Main/kotlin/ActualTemporalUpload.kt @@ -18,7 +18,7 @@ internal val MPPFile.mimeType: String actual suspend fun HttpClient.tempUpload( fullTempUploadDraftPath: String, file: MPPFile, - onUpload: OnUploadCallback + onUpload: ProgressListener ): TemporalFileId { val inputProvider = file.inputProvider() val fileId = submitFormWithBinaryData(