Skip to content

Commit

Permalink
Fixed dismissing the channel when leaving a group
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmitrevski committed Jun 19, 2024
1 parent 2f07f70 commit cc5657b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,9 @@ public struct ChatChannelInfoView: View, KeyboardReadable {
message: Text(message),
primaryButton: .destructive(Text(buttonTitle)) {
viewModel.leaveConversationTapped {
presentationMode.wrappedValue.dismiss()
if shownFromMessageList {
notifyChannelDismiss()
} else {
presentationMode.wrappedValue.dismiss()
}
}
},
Expand Down
5 changes: 5 additions & 0 deletions Sources/StreamChatSwiftUI/ChatChannel/ChatChannelView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ public struct ChatChannelView<Factory: ViewFactory>: View, KeyboardReadable {
.onReceive(keyboardWillChangePublisher, perform: { visible in
keyboardShown = visible
})
.onReceive(NotificationCenter.default.publisher(
for: NSNotification.Name(dismissChannel)
), perform: { _ in
presentationMode.wrappedValue.dismiss()
})
.onAppear {
viewModel.onViewAppear()
if utils.messageListConfig.becomesFirstResponderOnOpen {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ open class ChatChannelListViewModel: ObservableObject, ChatChannelListController
}
}

private let dismissChannel = "io.getstream.dismissChannel"
internal let dismissChannel = "io.getstream.dismissChannel"

private let hideTabBarNotification = "io.getstream.hideTabBar"

Expand Down

0 comments on commit cc5657b

Please sign in to comment.