Skip to content
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
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

# Upcoming

### ✅ Added
- Make `CreatePollView` public [#685](https://github.com/GetStream/stream-chat-swiftui/pull/685)
- Allow customizing channel and message search in the `ChatChannelListViewModel` [#XYZ](ADD)
- Allow overriding `ChatChannelListViewModel.performChannelSearch` and `ChatChannelListViewModel.performMessageSearch`
- Make `ChatChannelListViewModel.channelListSearchController` and `ChatChannelListViewModel.messageSearchController` public
### 🐞 Fixed
- Fix message thread reply footnote view not shown if parent message not in cache [#681](https://github.com/GetStream/stream-chat-swiftui/pull/681)
### ⚡ Performance
- Improve message search performance [#680](https://github.com/GetStream/stream-chat-swiftui/pull/680)
### ✅ Added
- Make `CreatePollView` public [#685](https://github.com/GetStream/stream-chat-swiftui/pull/685)
### 🔄 Changed
- Update `VoiceRecordingContainerView` background colors and layout by moving the message text outside of the recording cell [#689](https://github.com/GetStream/stream-chat-swiftui/pull/689/)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ open class ChatChannelListViewModel: ObservableObject, ChatChannelListController
}

private let searchType: ChannelListSearchType
internal var channelListSearchController: ChatChannelListController?
internal var messageSearchController: ChatMessageSearchController?
/// The channel search controller which should be created only by ``performChannelSearch()``.
public var channelListSearchController: ChatChannelListController?
/// The message search controller which should be created only by ``performMessageSearch()``.
public var messageSearchController: ChatMessageSearchController?

/// Serial queue used to process the search results.
private let queue = DispatchQueue(label: "com.getstream.stream-chat-swiftui.ChatChannelListViewModel")
Expand Down Expand Up @@ -388,7 +390,8 @@ open class ChatChannelListViewModel: ObservableObject, ChatChannelListController
}
}

private func performMessageSearch() {
/// Creates a new message search controller, sets its delegate, and triggers the search operation.
open func performMessageSearch() {
messageSearchController = chatClient.messageSearchController()
messageSearchController?.delegate = self
loadingSearchResults = true
Expand All @@ -397,14 +400,16 @@ open class ChatChannelListViewModel: ObservableObject, ChatChannelListController
}
}

private func performChannelSearch() {
/// Creates a new channel search controller, sets its delegate, and triggers the search operation.
open func performChannelSearch() {
guard let userId = chatClient.currentUserId else { return }
var query = ChannelListQuery(
filter: .and([
.autocomplete(.name, text: searchText),
.containMembers(userIds: [userId])
])
)
// Do not start watching any of the searched channels.
query.options = []
channelListSearchController = chatClient.channelListController(query: query)
loadingSearchResults = true
Expand Down
Loading