diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt index f50b4a99ca..2a47e22be8 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt @@ -323,6 +323,12 @@ object ChatModel { is SecondaryContextFilter.MsgContentTagContext -> null } + val isUserSupportChat: Boolean = + when (groupScopeInfo) { + null -> false + is GroupChatScopeInfo.MemberSupport -> groupScopeInfo.groupMember_ == null + } + suspend fun addChat(chat: Chat) { chats.add(index = 0, chat) popChatCollector.throttlePopChat(chat.remoteHostId, chat.id, currentPosition = 0) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/MemberSupportChatView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/MemberSupportChatView.kt index 3196cae15c..99e2e3198e 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/MemberSupportChatView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/MemberSupportChatView.kt @@ -22,6 +22,7 @@ import dev.icerock.moko.resources.compose.stringResource @Composable private fun MemberSupportChatView( + chatInfo: ChatInfo, memberSupportChatsCtx: ChatModel.ChatsContext, staleChatId: State, scrollToItemId: MutableState @@ -29,6 +30,21 @@ private fun MemberSupportChatView( KeyChangeEffect(chatModel.chatId.value) { ModalManager.end.closeModals() } + if (appPlatform.isAndroid) { + DisposableEffect(Unit) { + onDispose { + val chat = chatModel.chats.value.firstOrNull { ch -> ch.id == chatInfo.id } + if ( + memberSupportChatsCtx.isUserSupportChat + && chat?.chatInfo?.groupInfo_?.membership?.memberPending == true + ) { + withBGApi { + chatModel.chatId.value = null + } + } + } + } + } ChatView(memberSupportChatsCtx, staleChatId, scrollToItemId, onComposed = {}) } @@ -118,7 +134,7 @@ suspend fun showMemberSupportChatView(staleChatId: State, scrollToItemI ModalManager.end.showCustomModal(true, id = ModalViewId.SECONDARY_CHAT) { close -> ModalView({}, showAppBar = false) { if (chatInfo is ChatInfo.Group && chatInfo.groupChatScope != null) { - MemberSupportChatView(memberSupportChatsCtx, staleChatId, scrollToItemId) + MemberSupportChatView(chatInfo, memberSupportChatsCtx, staleChatId, scrollToItemId) } else { LaunchedEffect(Unit) { close()