mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-03-30 22:55:48 +00:00
android: go back to chat list after closing support chat when invitee is pending (#5918)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -22,6 +22,7 @@ import dev.icerock.moko.resources.compose.stringResource
|
||||
|
||||
@Composable
|
||||
private fun MemberSupportChatView(
|
||||
chatInfo: ChatInfo,
|
||||
memberSupportChatsCtx: ChatModel.ChatsContext,
|
||||
staleChatId: State<String?>,
|
||||
scrollToItemId: MutableState<Long?>
|
||||
@@ -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<String?>, 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()
|
||||
|
||||
Reference in New Issue
Block a user