From 9e6047989e5adebcbfc3be30f4fc835e6cb1125c Mon Sep 17 00:00:00 2001 From: Narasimha-sc <166327228+Narasimha-sc@users.noreply.github.com> Date: Tue, 20 Oct 2026 09:10:24 +0000 Subject: [PATCH] android: report network info without an error alert, remove comments that restate the code --- apps/ios/Shared/Model/NetworkObserver.swift | 1 - .../kotlin/chat/simplex/common/helpers/NetworkObserver.kt | 2 -- .../commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt | 2 +- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/apps/ios/Shared/Model/NetworkObserver.swift b/apps/ios/Shared/Model/NetworkObserver.swift index 5d65252e97..86c4646828 100644 --- a/apps/ios/Shared/Model/NetworkObserver.swift +++ b/apps/ios/Shared/Model/NetworkObserver.swift @@ -52,7 +52,6 @@ class NetworkObserver { // the interface is compared too - a VPN that reconnected as another one can have the same // address, and an interface being configured has none yet let pathChanged = interface != prevInterface || lost(prevGateways, gateways) || lost(prevAddresses, addresses) - // the report that was not accepted is repeated when the next path update is received if prevInfo != info || (info.online && pathChanged) { prevInfo = setNetworkInfo(info) ? info : nil } diff --git a/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/helpers/NetworkObserver.kt b/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/helpers/NetworkObserver.kt index 9c6589ca0e..ab34eeb2fa 100644 --- a/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/helpers/NetworkObserver.kt +++ b/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/helpers/NetworkObserver.kt @@ -160,11 +160,9 @@ class NetworkObserver { private suspend fun sendNetworkInfo(info: UserNetworkInfo, network: Network?, removals: Int, ctrlGen: Int): Boolean { if (ctrlGen != ctrlGeneration) return false - // the controller is passed, so that replacing it while the report is sent does not fail the command val ctrl = controller.currentCtrl() ?: return false.also { reportFailed(ctrlGen) } // a failed command must not be recorded as sent, and it throws when the response cannot be parsed val sent = try { controller.apiSetNetworkInfo(info, ctrl) } catch (e: Throwable) { Log.e(TAG, "Error reporting network info: ${e.stackTraceToString()}"); false } - // when it was not sent the network info is reported again when the next event is received if (sent) setSentInfo(info, network, removals, ctrlGen) else reportFailed(ctrlGen) return sent } diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt index d48a7c1574..72bbf7bcb9 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt @@ -1534,7 +1534,7 @@ object ChatController { } suspend fun apiSetNetworkInfo(networkInfo: UserNetworkInfo, ctrl: ChatCtrl): Boolean = - sendCommandOkResp(null, CC.APISetNetworkInfo(networkInfo), ctrl) + sendCmd(null, CC.APISetNetworkInfo(networkInfo), ctrl).result is CR.CmdOk suspend fun apiSetMemberSettings(rh: Long?, groupId: Long, groupMemberId: Long, memberSettings: GroupMemberSettings): Boolean = sendCommandOkResp(rh, CC.ApiSetMemberSettings(groupId, groupMemberId, memberSettings))