From 9a8ed4008286a908c013afe6cb22471811152ad5 Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Fri, 1 Aug 2025 15:09:20 +0000 Subject: [PATCH] android, desktop: fix banner not showing when creating chat with member; when creating group (#6139) * android, desktop: fix banner not showing when creating chat with member * fix group --- .../views/chat/group/GroupMemberInfoView.kt | 15 +++++++-------- .../simplex/common/views/newchat/AddGroupView.kt | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/GroupMemberInfoView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/GroupMemberInfoView.kt index d3e7f60f62..e5f0b708e7 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/GroupMemberInfoView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/GroupMemberInfoView.kt @@ -34,7 +34,7 @@ import chat.simplex.common.views.newchat.* import chat.simplex.common.views.usersettings.SettingsActionItem import chat.simplex.common.model.GroupInfo import chat.simplex.common.platform.* -import chat.simplex.common.views.chatlist.openLoadedChat +import chat.simplex.common.views.chatlist.openDirectChat import chat.simplex.res.MR import dev.icerock.moko.resources.StringResource import kotlinx.datetime.Clock @@ -57,6 +57,7 @@ fun GroupMemberInfoView( val connStats = remember { mutableStateOf(connectionStats) } val developerTools = chatModel.controller.appPrefs.developerTools.get() var progressIndicator by remember { mutableStateOf(false) } + val scope = rememberCoroutineScope() fun syncMemberConnection() { withBGApi { @@ -86,12 +87,10 @@ fun GroupMemberInfoView( developerTools, connectionCode, getContactChat = { chatModel.getContactChat(it) }, - openDirectChat = { - withBGApi { - apiLoadMessages(chatModel.chatsContext, rhId, ChatType.Direct, it, ChatPagination.Initial(ChatPagination.INITIAL_COUNT)) - if (chatModel.getContactChat(it) != null) { - closeAll() - } + openDirectChat = { contactId -> + scope.launch { + openDirectChat(rhId, contactId) + closeAll() } }, createMemberContact = { @@ -104,7 +103,7 @@ fun GroupMemberInfoView( withContext(Dispatchers.Main) { chatModel.chatsContext.addChat(memberChat) } - openLoadedChat(memberChat) + openDirectChat(rhId, memberContact.contactId) closeAll() chatModel.setContactNetworkStatus(memberContact, NetworkStatus.Connected()) } diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/AddGroupView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/AddGroupView.kt index d4161ee3e5..e8084e055a 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/AddGroupView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/AddGroupView.kt @@ -25,6 +25,7 @@ import chat.simplex.common.views.helpers.* import chat.simplex.common.platform.* import chat.simplex.common.views.* import chat.simplex.common.views.chat.group.GroupLinkView +import chat.simplex.common.views.chatlist.openGroupChat import chat.simplex.common.views.usersettings.* import chat.simplex.res.MR import kotlinx.coroutines.delay @@ -44,8 +45,7 @@ fun AddGroupView(chatModel: ChatModel, rh: RemoteHostInfo?, close: () -> Unit, c if (groupInfo != null) { withContext(Dispatchers.Main) { chatModel.chatsContext.updateGroup(rhId = rhId, groupInfo) - chatModel.chatsContext.chatItems.clearAndNotify() - chatModel.chatId.value = groupInfo.id + openGroupChat(rhId, groupInfo.groupId) } setGroupMembers(rhId, groupInfo, chatModel) closeAll.invoke()