From 764ea39cdbf611912b8df05cac15d876bf5c8fbd Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Sun, 7 Sep 2025 07:30:59 +0000 Subject: [PATCH] ui: delay closing support view on acceptance for items to be marked read (#6244) * ui: delay closing support view on acceptance for items to be marked read * move to coroutine * increase delay --- apps/ios/Shared/Views/Chat/ChatView.swift | 5 ++++- .../kotlin/chat/simplex/common/model/SimpleXAPI.kt | 9 ++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/ios/Shared/Views/Chat/ChatView.swift b/apps/ios/Shared/Views/Chat/ChatView.swift index f5348c9baf..fa53045391 100644 --- a/apps/ios/Shared/Views/Chat/ChatView.swift +++ b/apps/ios/Shared/Views/Chat/ChatView.swift @@ -360,7 +360,10 @@ struct ChatView: View { } .onChange(of: chatModel.secondaryPendingInviteeChatOpened) { opened in if im.secondaryIMFilter != nil && !opened { - dismiss() + Task { + try? await Task.sleep(nanoseconds: 650_000000) + dismiss() + } } } .onChange(of: chatModel.openAroundItemId) { openAround in 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 17ebaa6c96..30f3edb055 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 @@ -2913,10 +2913,13 @@ object ChatController { && ModalManager.end.hasModalOpen(ModalViewId.SECONDARY_CHAT) && chatModel.secondaryChatsContext.value?.secondaryContextFilter is SecondaryContextFilter.GroupChatScopeContext ) { - withContext(Dispatchers.Main) { - chatModel.secondaryChatsContext.value = null + CoroutineScope(Dispatchers.Default).launch { + delay(1000L) + withContext(Dispatchers.Main) { + chatModel.secondaryChatsContext.value = null + } + ModalManager.end.closeModals() } - ModalManager.end.closeModals() } } is CR.JoinedGroupMember ->