From 67acc89dbfe7287755cfb29463a777bddfdf277f Mon Sep 17 00:00:00 2001 From: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com> Date: Tue, 15 Aug 2023 00:45:29 +0300 Subject: [PATCH] desktop: close info panel on chat deletion (#2927) Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> --- .../kotlin/chat/simplex/common/views/chat/ChatInfoView.kt | 1 + .../kotlin/chat/simplex/common/views/chat/ChatView.kt | 1 + .../chat/simplex/common/views/chat/group/GroupChatInfoView.kt | 1 + .../chat/simplex/common/views/chatlist/ChatListNavLinkView.kt | 2 ++ 4 files changed, 5 insertions(+) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatInfoView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatInfoView.kt index e96907a46..87f8a7e65 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatInfoView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatInfoView.kt @@ -207,6 +207,7 @@ fun deleteContactDialog(chatInfo: ChatInfo, chatModel: ChatModel, close: (() -> chatModel.removeChat(chatInfo.id) if (chatModel.chatId.value == chatInfo.id) { chatModel.chatId.value = null + ModalManager.end.closeModals() } ntfManager.cancelNotificationsForChat(chatInfo.id) close?.invoke() diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt index 7d2787827..749afe8fa 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt @@ -98,6 +98,7 @@ fun ChatView(chatId: String, chatModel: ChatModel, onComposed: () -> Unit) { val view = LocalMultiplatformView() if (activeChat.value == null || user == null) { chatModel.chatId.value = null + ModalManager.end.closeModals() } else { val chat = activeChat.value!! // We need to have real unreadCount value for displaying it inside top right button diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/GroupChatInfoView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/GroupChatInfoView.kt index b0dc7060a..40291b8fe 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/GroupChatInfoView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/GroupChatInfoView.kt @@ -135,6 +135,7 @@ fun deleteGroupDialog(chatInfo: ChatInfo, groupInfo: GroupInfo, chatModel: ChatM chatModel.removeChat(chatInfo.id) if (chatModel.chatId.value == chatInfo.id) { chatModel.chatId.value = null + ModalManager.end.closeModals() } ntfManager.cancelNotificationsForChat(chatInfo.id) close?.invoke() diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListNavLinkView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListNavLinkView.kt index c84974137..18df5e850 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListNavLinkView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListNavLinkView.kt @@ -524,6 +524,7 @@ fun pendingContactAlertDialog(chatInfo: ChatInfo, chatModel: ChatModel) { chatModel.removeChat(chatInfo.id) if (chatModel.chatId.value == chatInfo.id) { chatModel.chatId.value = null + ModalManager.end.closeModals() } } } @@ -559,6 +560,7 @@ fun deleteGroup(groupInfo: GroupInfo, chatModel: ChatModel) { chatModel.removeChat(groupInfo.id) if (chatModel.chatId.value == groupInfo.id) { chatModel.chatId.value = null + ModalManager.end.closeModals() } ntfManager.cancelNotificationsForChat(groupInfo.id) }