From 0039eec74c8bd13a6f330c4e844d9b63bae330e8 Mon Sep 17 00:00:00 2001 From: GuavaGoat <320862384+GuavaGoat@users.noreply.github.com> Date: Sat, 29 Aug 2026 06:21:30 +0000 Subject: [PATCH] Update CallView.android.kt show reconnecting without sending it to the core --- .../chat/simplex/common/views/call/CallView.android.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/views/call/CallView.android.kt b/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/views/call/CallView.android.kt index 50415b03c3..e3480ae827 100644 --- a/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/views/call/CallView.android.kt +++ b/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/views/call/CallView.android.kt @@ -171,13 +171,15 @@ actual fun ActiveCallView() { chatModel.controller.apiSendCallExtraInfo(callRh, call.contact, r.iceCandidates) } is WCallResponse.Connection -> - try { + // the call is restored and NOT sent to the core + // Makes sure the core DOES NOT record the duration wrong if a reconnect happens + if (r.state.connectionState == "reconnecting") { + updateActiveCall(call) { it.copy(callState = CallState.Reconnecting) } + } else try { val callStatus = json.decodeFromString("\"${r.state.connectionState}\"") if (callStatus == WebRTCCallStatus.Connected) { - // Makes sure it uses the connected value so if call reconnects it doesn't use the reconnecting value + // connectedAt is only set ONCE, this way call duration is NOT reset when the call is restored from reconnecting updateActiveCall(call) { it.copy(callState = CallState.Connected, connectedAt = it.connectedAt ?: Clock.System.now()) } - } else if (callStatus == WebRTCCallStatus.Reconnecting) { - updateActiveCall(call) { it.copy(callState = CallState.Reconnecting) } } withBGApi { chatModel.controller.apiCallStatus(callRh, call.contact, callStatus) } } catch (e: Throwable) {