From 127fe2e31a8a1a3fc6c81d1a87bf7cd56bab269e Mon Sep 17 00:00:00 2001 From: denis0001-dev Date: Thu, 19 Nov 2026 19:49:03 +0300 Subject: [PATCH] Fix proxy code for Kotlin/Native iOS compile before 1.3.0 release. Co-authored-by: Cursor --- .../kotlin/ru/fromchat/network/proxy/ProxyRuntime.kt | 4 +++- .../kotlin/ru/fromchat/network/proxy/ProxyTlsTrust.kt | 1 + .../ru/fromchat/ui/main/settings/proxy/AddProxyScreen.kt | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/shared/src/commonMain/kotlin/ru/fromchat/network/proxy/ProxyRuntime.kt b/app/shared/src/commonMain/kotlin/ru/fromchat/network/proxy/ProxyRuntime.kt index c51ac72..e0e3807 100644 --- a/app/shared/src/commonMain/kotlin/ru/fromchat/network/proxy/ProxyRuntime.kt +++ b/app/shared/src/commonMain/kotlin/ru/fromchat/network/proxy/ProxyRuntime.kt @@ -2,6 +2,7 @@ package ru.fromchat.network.proxy import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.IO import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.first @@ -18,6 +19,7 @@ import ru.fromchat.network.proxy.ssh.KeyPassphraseSubmit import ru.fromchat.network.proxy.ssh.decryptAndExportPrivateKeyPem import ru.fromchat.network.proxy.ssh.isPassphraseFailure import ru.fromchat.network.proxy.ssh.privateKeyNeedsPassphrase +import kotlin.concurrent.Volatile object ProxyRuntime { @Volatile @@ -361,7 +363,7 @@ object ProxyRuntime { } val error = connectResult.exceptionOrNull() - val message = error?.message ?: error?.javaClass?.simpleName.orEmpty() + val message = error?.message ?: error?.let { it::class.simpleName }.orEmpty() if ( proxy.auth is SshKeyAuth && keyPassphrase != null && diff --git a/app/shared/src/commonMain/kotlin/ru/fromchat/network/proxy/ProxyTlsTrust.kt b/app/shared/src/commonMain/kotlin/ru/fromchat/network/proxy/ProxyTlsTrust.kt index 6736b91..c9be547 100644 --- a/app/shared/src/commonMain/kotlin/ru/fromchat/network/proxy/ProxyTlsTrust.kt +++ b/app/shared/src/commonMain/kotlin/ru/fromchat/network/proxy/ProxyTlsTrust.kt @@ -9,6 +9,7 @@ import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.json.Json import ru.fromchat.api.local.AttachmentMediaLog import ru.fromchat.utils.settings.Settings as PlatformSettings +import kotlin.concurrent.Volatile @Serializable data class TrustedTlsCertificate( diff --git a/app/shared/src/commonMain/kotlin/ru/fromchat/ui/main/settings/proxy/AddProxyScreen.kt b/app/shared/src/commonMain/kotlin/ru/fromchat/ui/main/settings/proxy/AddProxyScreen.kt index 06dd826..3dd1fac 100644 --- a/app/shared/src/commonMain/kotlin/ru/fromchat/ui/main/settings/proxy/AddProxyScreen.kt +++ b/app/shared/src/commonMain/kotlin/ru/fromchat/ui/main/settings/proxy/AddProxyScreen.kt @@ -50,6 +50,7 @@ import androidx.compose.ui.text.input.PasswordVisualTransformation import androidx.compose.ui.unit.dp import kotlin.random.Random import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.IO import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import org.jetbrains.compose.resources.stringResource