Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed dismissing the channel when leaving a group #519

Merged
merged 3 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Thread replies shown in channel indicator [#518](https://github.com/GetStream/stream-chat-swiftui/pull/518)

### 🐞 Fixed
- Dismiss the channel when leaving a group [#519](https://github.com/GetStream/stream-chat-swiftui/pull/519)
- Dismiss keyboard when tapping on the empty message list [#513](https://github.com/GetStream/stream-chat-swiftui/pull/513)
- 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)

Expand Down
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 @@ -160,6 +160,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
Loading