mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-24 23:55:50 +00:00
ios: close support chat for invitee when accepted (#5873)
This commit is contained in:
@@ -387,6 +387,7 @@ final class ChatModel: ObservableObject {
|
||||
|
||||
// ItemsModel for secondary chat view (such as support scope chat), as opposed to ItemsModel.shared used for primary chat
|
||||
@Published var secondaryIM: ItemsModel? = nil
|
||||
@Published var secondaryPendingInviteeChatOpened = false
|
||||
|
||||
static var ok: Bool { ChatModel.shared.chatDbStatus == .ok }
|
||||
|
||||
|
||||
@@ -2285,11 +2285,17 @@ func processReceivedMsg(_ res: ChatEvent) async {
|
||||
}
|
||||
}
|
||||
case let .userJoinedGroup(user, groupInfo):
|
||||
// TODO [knocking] close support scope for this group if it's currently opened
|
||||
if active(user) {
|
||||
await MainActor.run {
|
||||
m.updateGroup(groupInfo)
|
||||
}
|
||||
if m.chatId == groupInfo.id,
|
||||
case .memberSupport(nil) = m.secondaryIM?.groupScopeInfo {
|
||||
await MainActor.run {
|
||||
m.secondaryPendingInviteeChatOpened = false
|
||||
m.secondaryIM = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
case let .joinedGroupMember(user, groupInfo, member):
|
||||
if active(user) {
|
||||
|
||||
@@ -234,6 +234,7 @@ struct ChatView: View {
|
||||
groupInfo.membership.memberPending {
|
||||
let secIM = ItemsModel(secondaryIMFilter: .groupChatScopeContext(groupScopeInfo: userSupportScopeInfo))
|
||||
secIM.loadOpenChat(chat.id) {
|
||||
chatModel.secondaryPendingInviteeChatOpened = true
|
||||
showUserSupportChatSheet = true
|
||||
}
|
||||
}
|
||||
@@ -268,6 +269,11 @@ struct ChatView: View {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
.onChange(of: chatModel.secondaryPendingInviteeChatOpened) { opened in
|
||||
if im.secondaryIMFilter != nil && !opened {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
.onChange(of: chatModel.openAroundItemId) { openAround in
|
||||
if let openAround {
|
||||
closeSearch()
|
||||
|
||||
Reference in New Issue
Block a user