From e5d590fccd5b8ecddfc7740b645c27ddf0032a72 Mon Sep 17 00:00:00 2001 From: Khalid Date: Wed, 1 Oct 2025 14:28:34 +0300 Subject: [PATCH 01/14] open ChannelInfoViewModel control proprties --- .../ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift index 9c1c474c..4c9051f5 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift @@ -36,7 +36,7 @@ open class ChatChannelInfoViewModel: ObservableObject, ChatChannelControllerDele @Published public var addUsersShown = false @Published public var selectedParticipant: ParticipantInfo? - public var shouldShowLeaveConversationButton: Bool { + open var shouldShowLeaveConversationButton: Bool { if channel.isDirectMessageChannel { channel.ownCapabilities.contains(.deleteChannel) } else { @@ -44,11 +44,11 @@ open class ChatChannelInfoViewModel: ObservableObject, ChatChannelControllerDele } } - public var canRenameChannel: Bool { + open var canRenameChannel: Bool { channel.ownCapabilities.contains(.updateChannel) } - public var shouldShowAddUserButton: Bool { + open var shouldShowAddUserButton: Bool { if channel.isDirectMessageChannel { false } else { From 55b5a0bad5ae032b4c7a5a9777afaf3c34f6df31 Mon Sep 17 00:00:00 2001 From: Khalid Date: Thu, 2 Oct 2025 12:29:56 +0300 Subject: [PATCH 02/14] fix ios26 navigationBarTrailing style --- .../ChatChannel/ChannelInfo/ChatChannelInfoView.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift index 7c0d9abc..a0b2d4bb 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift @@ -170,6 +170,7 @@ public struct ChatChannelInfoView: View, KeyboardReadable .background(colors.tintColor) .clipShape(Circle()) } + .buttonStyle(.plain) } } } From 562d874f9849a2f08fa168effe2b7a6f23c5b042 Mon Sep 17 00:00:00 2001 From: Khalid Date: Thu, 16 Oct 2025 14:44:03 +0300 Subject: [PATCH 03/14] open mute channel control property for ChannelInfoViewModel --- .../ChannelInfo/ChatChannelInfoHelperViews.swift | 16 +++++++++------- .../ChannelInfo/ChatChannelInfoViewModel.swift | 4 ++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoHelperViews.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoHelperViews.swift index d5f7a9f3..8676db76 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoHelperViews.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoHelperViews.swift @@ -76,13 +76,15 @@ public struct ChatInfoOptionsView: View { Divider() - ChannelInfoItemView( - icon: images.muted, - title: viewModel.mutedText, - verticalPadding: 12 - ) { - Toggle(isOn: $viewModel.muted) { - EmptyView() + if viewModel.shouldShowMuteChannelButton { + ChannelInfoItemView( + icon: images.muted, + title: viewModel.mutedText, + verticalPadding: 12 + ) { + Toggle(isOn: $viewModel.muted) { + EmptyView() + } } } diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift index 4c9051f5..cf0620fe 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift @@ -43,6 +43,10 @@ open class ChatChannelInfoViewModel: ObservableObject, ChatChannelControllerDele channel.ownCapabilities.contains(.leaveChannel) } } + + open var shouldShowMuteChannelButton: Bool { + channel.ownCapabilities.contains(.muteChannel) + } open var canRenameChannel: Bool { channel.ownCapabilities.contains(.updateChannel) From b00daffa5a17e1dd591c63d9bfed96d3c0b4b6b3 Mon Sep 17 00:00:00 2001 From: Khalid Date: Thu, 16 Oct 2025 15:49:12 +0300 Subject: [PATCH 04/14] open channel info leave actions title --- .../ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift index cf0620fe..32a1c761 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift @@ -91,7 +91,7 @@ open class ChatChannelInfoViewModel: ObservableObject, ChatChannelControllerDele } } - public var leaveButtonTitle: String { + open var leaveButtonTitle: String { if channel.isDirectMessageChannel { L10n.Alert.Actions.deleteChannelTitle } else { @@ -99,7 +99,7 @@ open class ChatChannelInfoViewModel: ObservableObject, ChatChannelControllerDele } } - public var leaveConversationDescription: String { + open var leaveConversationDescription: String { if channel.isDirectMessageChannel { L10n.Alert.Actions.deleteChannelMessage } else { From 19e65dc2722984ff454f37305eca5bce41e5cfd3 Mon Sep 17 00:00:00 2001 From: Khalid Date: Fri, 17 Oct 2025 14:26:26 +0300 Subject: [PATCH 05/14] cleanup --- .../ChatChannel/ChannelInfo/ChatChannelInfoView.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift index a0b2d4bb..7c0d9abc 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift @@ -170,7 +170,6 @@ public struct ChatChannelInfoView: View, KeyboardReadable .background(colors.tintColor) .clipShape(Circle()) } - .buttonStyle(.plain) } } } From 0360af48e1372b561519ad8504a7245122755114 Mon Sep 17 00:00:00 2001 From: KhaledKamal Date: Sat, 18 Oct 2025 18:24:39 +0300 Subject: [PATCH 06/14] Fix:Owner user not marked as owner in channel/group details screen --- .../ChatInfoParticipantsView.swift | 24 +++++++++++++------ .../StreamChatSwiftUI/Generated/L10n.swift | 2 ++ .../Resources/en.lproj/Localizable.strings | 2 ++ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatInfoParticipantsView.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatInfoParticipantsView.swift index 2bf11a91..3f9ef88d 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatInfoParticipantsView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatInfoParticipantsView.swift @@ -41,14 +41,24 @@ public struct ChatInfoParticipantsView: View { ) factory.makeMessageAvatarView(for: displayInfo) - VStack(alignment: .leading, spacing: 4) { - Text(participant.displayName) - .lineLimit(1) - .font(fonts.bodyBold) - Text(participant.onlineInfoText) - .font(fonts.footnote) - .foregroundColor(Color(colors.textLowEmphasis)) + HStack(alignment:.center){ + VStack(alignment: .leading, spacing: 4) { + Text(participant.displayName) + .lineLimit(1) + .font(fonts.bodyBold) + Text(participant.onlineInfoText) + .font(fonts.footnote) + .foregroundColor(Color(colors.textLowEmphasis)) + } + Spacer() + + if factory.chatClient.currentUserId == participant.chatUser.id { + Text(L10n.chatGroupInfoOwner) + .font(fonts.footnote) + .foregroundColor(Color(colors.textLowEmphasis)) + } } + Spacer() } .padding(.all, 8) diff --git a/Sources/StreamChatSwiftUI/Generated/L10n.swift b/Sources/StreamChatSwiftUI/Generated/L10n.swift index 9c4dcf11..8f8754e7 100644 --- a/Sources/StreamChatSwiftUI/Generated/L10n.swift +++ b/Sources/StreamChatSwiftUI/Generated/L10n.swift @@ -6,6 +6,8 @@ import Foundation // MARK: - Strings internal enum L10n { + /// Owner + internal static var chatGroupInfoOwner: String { L10n.tr("Localizable", "chat_group_info_owner") } /// %d of %d internal static func currentSelection(_ p1: Int, _ p2: Int) -> String { return L10n.tr("Localizable", "current-selection", p1, p2) diff --git a/Sources/StreamChatSwiftUI/Resources/en.lproj/Localizable.strings b/Sources/StreamChatSwiftUI/Resources/en.lproj/Localizable.strings index 619e24b3..dbfb37f4 100644 --- a/Sources/StreamChatSwiftUI/Resources/en.lproj/Localizable.strings +++ b/Sources/StreamChatSwiftUI/Resources/en.lproj/Localizable.strings @@ -236,3 +236,5 @@ "thread.error.message" = "Error loading threads"; "thread.no-content.message" = "No threads here yet..."; "thread.item.replied-to" = "replied to: %@"; + +"chat_group_info_owner" = "Owner"; From 9781f2034a4d52636910e7f6b22b880c5d9041b6 Mon Sep 17 00:00:00 2001 From: KhaledKamal Date: Mon, 20 Oct 2025 14:26:29 +0300 Subject: [PATCH 07/14] Fix:Some items in chat screens need UI enhancement -Fix space between search bar and screen frame -Fix space between user picture and screen frame --- DemoAppSwiftUI/CreateGroupView.swift | 2 +- .../ChatChannel/ChannelInfo/ChatChannelInfoView.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DemoAppSwiftUI/CreateGroupView.swift b/DemoAppSwiftUI/CreateGroupView.swift index 13fb7977..8bd0b4d3 100644 --- a/DemoAppSwiftUI/CreateGroupView.swift +++ b/DemoAppSwiftUI/CreateGroupView.swift @@ -48,7 +48,7 @@ struct CreateGroupView: View, KeyboardReadable { } } .listStyle(.plain) - } + }.padding(.top) .toolbarThemed(content: { ToolbarItem(placement: .navigationBarTrailing) { NavigationLink { diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift index a6a8837d..996ccb8c 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift @@ -101,7 +101,7 @@ public struct ChatChannelInfoView: View, KeyboardReadable ) } } - } + }.padding(.top) } .overlay( popupShown ? From 2f171a31531397784a089379ae8da0cc555583e0 Mon Sep 17 00:00:00 2001 From: KhaledKamal Date: Mon, 20 Oct 2025 15:32:12 +0300 Subject: [PATCH 08/14] Fix:Remove channel / group options icon --- .../ChatChannelSwipeableListItem.swift | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelSwipeableListItem.swift b/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelSwipeableListItem.swift index 511d043d..03c9759a 100644 --- a/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelSwipeableListItem.swift +++ b/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelSwipeableListItem.swift @@ -282,14 +282,16 @@ public struct TrailingSwipeActionsView: View { Spacer() ZStack { HStack(spacing: 0) { - ActionItemButton(imageName: "ellipsis", action: { - withAnimation { - leftButtonTapped(channel) - } - }) - .frame(width: buttonWidth) - .foregroundColor(Color(colors.text)) - .background(Color(colors.background1)) + if channel.ownCapabilities.contains(.moreOptionsChannel) { + ActionItemButton(imageName: "ellipsis", action: { + withAnimation { + leftButtonTapped(channel) + } + }) + .frame(width: buttonWidth) + .foregroundColor(Color(colors.text)) + .background(Color(colors.background1)) + } if channel.ownCapabilities.contains(.deleteChannel) { ActionItemButton(imageName: "trash", action: { @@ -331,3 +333,11 @@ public struct ActionItemButton: View { } } } + +/* + If you wanna add this button to 'ChannelCapability' of ChatChannel manual + */ +extension ChannelCapability { + /// Ability to add more Options the channel. + public static let moreOptionsChannel: Self = "moreOptions-channel" +} From b2be7fad470984e5b174bdff1034678079c3aed6 Mon Sep 17 00:00:00 2001 From: KhaledKamal Date: Mon, 20 Oct 2025 18:26:16 +0300 Subject: [PATCH 09/14] Fix: Number of users in channel not updated after adding a new members --- .../ChatChannel/ChannelInfo/ChatChannelInfoView.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift index a6a8837d..59c8afc5 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift @@ -158,7 +158,8 @@ struct ChatChannelInfoViewHeaderViewModifier: ViewModifier { @Injected(\.colors) private var colors @Injected(\.fonts) private var fonts - let viewModel: ChatChannelInfoViewModel + @ObservedObject var viewModel: ChatChannelInfoViewModel + func body(content: Content) -> some View { if #available(iOS 26.0, *) { From 49ae19adcb0e61943227023265aef498692a843e Mon Sep 17 00:00:00 2001 From: KhaledKamal Date: Mon, 20 Oct 2025 18:39:06 +0300 Subject: [PATCH 10/14] Fix: checking owner condition --- .../ChatChannel/ChannelInfo/ChatChannelInfoView.swift | 1 + .../ChatChannel/ChannelInfo/ChatInfoParticipantsView.swift | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift index a6a8837d..349f9e38 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift @@ -53,6 +53,7 @@ public struct ChatChannelInfoView: View, KeyboardReadable ChatInfoParticipantsView( factory: factory, participants: viewModel.displayedParticipants, + channel: viewModel.channel, onItemAppear: viewModel.onParticipantAppear(_:), selectedParticipant: $viewModel.selectedParticipant ) diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatInfoParticipantsView.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatInfoParticipantsView.swift index 3f9ef88d..aed501ce 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatInfoParticipantsView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatInfoParticipantsView.swift @@ -16,16 +16,19 @@ public struct ChatInfoParticipantsView: View { let factory: Factory var participants: [ParticipantInfo] var onItemAppear: (ParticipantInfo) -> Void + private let channel: ChatChannel public init( factory: Factory = DefaultViewFactory.shared, participants: [ParticipantInfo], + channel: ChatChannel, onItemAppear: @escaping (ParticipantInfo) -> Void, selectedParticipant: Binding = .constant(nil) ) { self.factory = factory self.participants = participants self.onItemAppear = onItemAppear + self.channel = channel _selectedParticipant = selectedParticipant } @@ -41,7 +44,7 @@ public struct ChatInfoParticipantsView: View { ) factory.makeMessageAvatarView(for: displayInfo) - HStack(alignment:.center){ + HStack(alignment: .center) { VStack(alignment: .leading, spacing: 4) { Text(participant.displayName) .lineLimit(1) @@ -52,7 +55,7 @@ public struct ChatInfoParticipantsView: View { } Spacer() - if factory.chatClient.currentUserId == participant.chatUser.id { + if channel.createdBy?.id == participant.chatUser.id { Text(L10n.chatGroupInfoOwner) .font(fonts.footnote) .foregroundColor(Color(colors.textLowEmphasis)) From 53227c71bb941312e8dab3a5349031c764a020e7 Mon Sep 17 00:00:00 2001 From: KhaledKamal Date: Tue, 21 Oct 2025 15:50:30 +0300 Subject: [PATCH 11/14] Refact: make removeUserAction optional and open for override --- .../ChannelInfo/ChatChannelInfoViewModel.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift index 32a1c761..7bc04cc2 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift @@ -282,7 +282,7 @@ open class ChatChannelInfoViewModel: ObservableObject, ChatChannelControllerDele } open func participantActions(for participant: ParticipantInfo) -> [ParticipantAction] { - var actions = [ParticipantAction]() + var actions = [ParticipantAction?]() var directMessageAction = ParticipantAction( title: L10n.Channel.Item.sendDirectMessage, @@ -343,7 +343,7 @@ open class ChatChannelInfoViewModel: ObservableObject, ChatChannelControllerDele actions.append(cancel) - return actions + return actions.compactMap({$0}) } public func muteAction( @@ -407,11 +407,11 @@ open class ChatChannelInfoViewModel: ObservableObject, ChatChannelControllerDele return unmuteUser } - public func removeUserAction( + open func removeUserAction( participant: ParticipantInfo, onDismiss: @escaping () -> Void, onError: @escaping (Error) -> Void - ) -> ParticipantAction { + ) -> ParticipantAction? { let action = { [weak self] in guard let self else { onError(ClientError.Unexpected("Self is nil")) From 0fe4ac99f0dc9774309ff2f43b28da7c73a85dd6 Mon Sep 17 00:00:00 2001 From: KhaledKamal Date: Wed, 22 Oct 2025 12:20:44 +0300 Subject: [PATCH 12/14] Update action DirectMessage icon from message.circle.fill to message --- .../ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift index 32a1c761..6cd475c8 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift @@ -286,7 +286,7 @@ open class ChatChannelInfoViewModel: ObservableObject, ChatChannelControllerDele var directMessageAction = ParticipantAction( title: L10n.Channel.Item.sendDirectMessage, - iconName: "message.circle.fill", + iconName: "message", action: {}, confirmationPopup: nil, isDestructive: false From 7c91fb8b0f5e7c9c38c386bc7d99137a142969a7 Mon Sep 17 00:00:00 2001 From: KhaledKamal Date: Wed, 22 Oct 2025 12:36:58 +0300 Subject: [PATCH 13/14] hide trailing swipe when actions is empty --- .../ChatChannelSwipeableListItem.swift | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelSwipeableListItem.swift b/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelSwipeableListItem.swift index 03c9759a..594005f8 100644 --- a/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelSwipeableListItem.swift +++ b/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelSwipeableListItem.swift @@ -132,7 +132,6 @@ public struct ChatChannelSwipeableListItem Void var rightButtonTapped: (ChatChannel) -> Void + + var hasActions: Bool { + channel.ownCapabilities.contains(.moreOptionsChannel) || + channel.ownCapabilities.contains(.deleteChannel) + } public var body: some View { HStack { From 811275434c73d986cae723831afb2f351b03e478 Mon Sep 17 00:00:00 2001 From: KhaledKamal Date: Thu, 23 Oct 2025 13:28:16 +0300 Subject: [PATCH 14/14] open some ChatChannelInfoViewModel methods for inheritance --- .../ChannelInfo/ChatChannelInfoViewModel.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift index 32a1c761..b768c8d3 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift @@ -184,7 +184,7 @@ open class ChatChannelInfoViewModel: ObservableObject, ChatChannelControllerDele loadAdditionalUsers() } - public func leaveConversationTapped(completion: @escaping () -> Void) { + open func leaveConversationTapped(completion: @escaping () -> Void) { if !channel.isDirectMessageChannel { removeUserFromConversation(completion: completion) } else { @@ -229,9 +229,7 @@ open class ChatChannelInfoViewModel: ObservableObject, ChatChannelControllerDele addUsersShown = false } - // MARK: - private - - private func removeUserFromConversation(completion: @escaping () -> Void) { + public func removeUserFromConversation(completion: @escaping () -> Void) { guard let userId = chatClient.currentUserId else { return } channelController.removeMembers(userIds: [userId]) { [weak self] error in if error != nil { @@ -241,7 +239,9 @@ open class ChatChannelInfoViewModel: ObservableObject, ChatChannelControllerDele } } } - + + // MARK: - private + private func deleteChannel(completion: @escaping () -> Void) { channelController.deleteChannel { [weak self] error in if error != nil {