Skip to content

Conversation

nuno-vieira
Copy link
Member

@nuno-vieira nuno-vieira commented Oct 24, 2024

🔗 Issue Link

Resolves https://stream-io.atlassian.net/browse/PBE-6220

🎯 Goal

Adds support for Channel Search in the Channel List.

Usage:

Provide a searchType of .channels when creating the ChatChannelListView:

ChatChannelListView(
   viewFactory: DemoAppFactory.shared,
   channelListController: channelListController,
   searchType: .channels
)

Docs PR: GetStream/stream-chat-swift#3471

🛠 Implementation

A new searchType is introduced when creating a Channel List. The channel list view model will use this property to decide to perform a search by channels or by messages.

Another alternative approach was to introduce some kind of ChatChannelListSearchResultsProvider, which would abstract how the search implementation is done. However, the implementation was a bit more extensive and complex, so for now, this simple switch-case approach works fine and is easy to understand. In case we need a more scalable implementation in the future, we can consider this approach again. Here is the WIP implementation: b4ac2df

🧪 Testing

Change the DemoAppSwiftUIApp.channelListSearchType to .channels in the code.

Since there is no Configuration Screen in the SwiftUI app to test this, it needs to be done using Xcode.

☑️ Checklist

  • I have signed the Stream CLA (required)
  • Changelog is updated with client-facing changes
  • New code is covered by unit tests
  • Affected documentation updated (docusaurus, tutorial, CMS (task created)

@nuno-vieira nuno-vieira requested a review from a team as a code owner October 24, 2024 17:21
@Stream-SDK-Bot
Copy link
Collaborator

Stream-SDK-Bot commented Oct 24, 2024

SDK Size

title develop branch diff status
StreamChatSwiftUI 7.97 MB 7.99 MB +18 KB 🟢

Copy link

Copy link
Contributor

@martinmitrevski martinmitrevski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just one question - also relates to the UIKit search. At the moment, this only works with channel names, wonder if we can extend it to channel member names?
(But this is out of scope for this PR)

@nuno-vieira
Copy link
Member Author

nuno-vieira commented Oct 24, 2024

Looks great! Just one question - also relates to the UIKit search. At the moment, this only works with channel names, wonder if we can extend it to channel member names? (But this is out of scope for this PR)

Yes this is also possible, is just a question of changing the autocomplete from .name to .memberName and then we can add an additional search type like .channelMembers 👍 It should take 1 hour max to add this additional search type

@nuno-vieira nuno-vieira merged commit 4f6ed70 into develop Oct 24, 2024
11 checks passed
@nuno-vieira nuno-vieira deleted the add/channel-search-support branch October 24, 2024 22:45
@spartan-tinhnguyen
Copy link

Hi, could we release this version soon? I need this feature so that my app can be released soon. Thanks!

@nuno-vieira
Copy link
Member Author

Hi @spartan-tinhnguyen,

The ETA is most likely next week.

@spartan-tinhnguyen
Copy link

Hi @nuno-vieira , I’m sorry to ask this here, but could we also make this value public in the next version?
internal var messagePreviewFormatter = MessagePreviewFormatter()
It is in Utils class.

@Stream-SDK-Bot Stream-SDK-Bot mentioned this pull request Nov 6, 2024
@spartan-tinhnguyen
Copy link

Hi @nuno-vieira
I've applied the channel search, but it isn't working. Could you please help check it?

ChatChannelListView(
      viewFactory: CustomChatFactory.shared,
      embedInNavigationView: false,
      searchType: .channels
    )
Screenshot 2024-11-07 at 22 34 31 Screenshot 2024-11-07 at 22 35 07

@nuno-vieira
Copy link
Member Author

Hi @spartan-tinhnguyen,

If that is a DM channel, then it won't work, because the channel search, at the moment only searches for Channel Names. DM Channels do not have channel names

@spartan-tinhnguyen
Copy link

@nuno-vieira Do you have another way to customize the DM channel search?

@nuno-vieira
Copy link
Member Author

@spartan-tinhnguyen Can you create an issue here on the Repo? So that we can discuss it there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants