Skip to content

Commit 17d17e9

Browse files
Fixed dismissing the channel when leaving a group (#519)
1 parent 473ec8d commit 17d17e9

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
77
- Thread replies shown in channel indicator [#518](https://github.com/GetStream/stream-chat-swiftui/pull/518)
88

99
### 🐞 Fixed
10+
- Dismiss the channel when leaving a group [#519](https://github.com/GetStream/stream-chat-swiftui/pull/519)
1011
- Dismiss keyboard when tapping on the empty message list [#513](https://github.com/GetStream/stream-chat-swiftui/pull/513)
1112
- Reset composer text when there is provisional text (e.g. Japanese - kana keyboard) but the text is reset to empty string [#512](https://github.com/GetStream/stream-chat-swiftui/pull/512)
1213

Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,9 @@ public struct ChatChannelInfoView: View, KeyboardReadable {
8484
message: Text(message),
8585
primaryButton: .destructive(Text(buttonTitle)) {
8686
viewModel.leaveConversationTapped {
87+
presentationMode.wrappedValue.dismiss()
8788
if shownFromMessageList {
8889
notifyChannelDismiss()
89-
} else {
90-
presentationMode.wrappedValue.dismiss()
9190
}
9291
}
9392
},

Sources/StreamChatSwiftUI/ChatChannel/ChatChannelView.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ public struct ChatChannelView<Factory: ViewFactory>: View, KeyboardReadable {
160160
.onReceive(keyboardWillChangePublisher, perform: { visible in
161161
keyboardShown = visible
162162
})
163+
.onReceive(NotificationCenter.default.publisher(
164+
for: NSNotification.Name(dismissChannel)
165+
), perform: { _ in
166+
presentationMode.wrappedValue.dismiss()
167+
})
163168
.onAppear {
164169
viewModel.onViewAppear()
165170
if utils.messageListConfig.becomesFirstResponderOnOpen {

Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ open class ChatChannelListViewModel: ObservableObject, ChatChannelListController
435435
}
436436
}
437437

438-
private let dismissChannel = "io.getstream.dismissChannel"
438+
internal let dismissChannel = "io.getstream.dismissChannel"
439439

440440
private let hideTabBarNotification = "io.getstream.hideTabBar"
441441

0 commit comments

Comments
 (0)