From db93c85e48b781d80804c922027cc07824083913 Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Tue, 15 Jul 2025 15:15:10 +0000 Subject: [PATCH] desktop: fix accept contact/connection in progress staying when changing chat (#6081) --- .../views/chat/ComposeContextContactRequestActionsView.kt | 7 +++++++ .../kotlin/chat/simplex/common/views/chat/ComposeView.kt | 1 + 2 files changed, 8 insertions(+) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ComposeContextContactRequestActionsView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ComposeContextContactRequestActionsView.kt index 332d205cf1..106c975226 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ComposeContextContactRequestActionsView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ComposeContextContactRequestActionsView.kt @@ -31,6 +31,13 @@ fun ComposeContextContactRequestActionsView( val inProgress = rememberSaveable { mutableStateOf(false) } var progressByTimeout by rememberSaveable { mutableStateOf(false) } + KeyChangeEffect(chatModel.chatId.value) { + if (inProgress.value) { + inProgress.value = false + progressByTimeout = false + } + } + LaunchedEffect(inProgress.value) { progressByTimeout = if (inProgress.value) { delay(1000) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ComposeView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ComposeView.kt index 7fc1e9ae56..f1b370a796 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ComposeView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ComposeView.kt @@ -1146,6 +1146,7 @@ fun ComposeView( deleteUnusedFiles() } else if (cs.inProgress) { clearPrevDraft(prevChatId) + composeState.value = cs.copy(inProgress = false, progressByTimeout = false) } else if (!cs.empty) { if (cs.preview is ComposePreview.VoicePreview && !cs.preview.finished) { composeState.value = cs.copy(preview = cs.preview.copy(finished = true))