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 8dfa5e05f..e96907a46 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 @@ -205,7 +205,9 @@ fun deleteContactDialog(chatInfo: ChatInfo, chatModel: ChatModel, close: (() -> val r = chatModel.controller.apiDeleteChat(chatInfo.chatType, chatInfo.apiId) if (r) { chatModel.removeChat(chatInfo.id) - chatModel.chatId.value = null + if (chatModel.chatId.value == chatInfo.id) { + chatModel.chatId.value = null + } ntfManager.cancelNotificationsForChat(chatInfo.id) close?.invoke() } 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 e5f63ed3e..b0dc7060a 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 @@ -133,7 +133,9 @@ fun deleteGroupDialog(chatInfo: ChatInfo, groupInfo: GroupInfo, chatModel: ChatM val r = chatModel.controller.apiDeleteChat(chatInfo.chatType, chatInfo.apiId) if (r) { chatModel.removeChat(chatInfo.id) - chatModel.chatId.value = null + if (chatModel.chatId.value == chatInfo.id) { + chatModel.chatId.value = null + } 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 5452bbba2..c84974137 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 @@ -522,7 +522,9 @@ fun pendingContactAlertDialog(chatInfo: ChatInfo, chatModel: ChatModel) { val r = chatModel.controller.apiDeleteChat(chatInfo.chatType, chatInfo.apiId) if (r) { chatModel.removeChat(chatInfo.id) - chatModel.chatId.value = null + if (chatModel.chatId.value == chatInfo.id) { + chatModel.chatId.value = null + } } } }, @@ -555,7 +557,9 @@ fun deleteGroup(groupInfo: GroupInfo, chatModel: ChatModel) { val r = chatModel.controller.apiDeleteChat(ChatType.Group, groupInfo.apiId) if (r) { chatModel.removeChat(groupInfo.id) - chatModel.chatId.value = null + if (chatModel.chatId.value == groupInfo.id) { + chatModel.chatId.value = null + } ntfManager.cancelNotificationsForChat(groupInfo.id) } }