Closed srgray closed 3 years ago
thank you for sharing this, looks like the relevant bits of code is
private lazy var chatChannelListVC: CNChatChannelListVC = {
let chatChannelsVC = CNChatChannelListVC()
let userIds = [userId] //show channels that have me in them
let channelListController = ChatClient.shared
.channelListController(
query: ChannelListQuery(
filter: Filter.and([
.containMembers(userIds: userIds),
.equal(.type, to: .messaging)
])
)
)
chatChannelsVC.controller = channelListController
return chatChannelsVC
}()
which looks correct, we are looking into it
quick update, the ChannelListQuery you use creates the right JSON payload:
{"limit":20,"watch":true,"message_limit":25,"filter_conditions":{"$and":[{"members":{"$in":["a","b"]}},{"type":{"$eq":"messaging"}}]}}
more digging required
Hello @srgray ,
This happens because of the recent API we introduced in PR #1460 Basically,
messaging
, let's call it messagingController
livestream
, you get livestream
channels saved to DBmessagingController
gets callback shouldListNewChannel
for these channels, and default answer is true
messagingController
lists these channelsYou should implement the delegate callback shouldListNewChannel
and return false
for non-messaging channels
We're aware this is not ideal and looking for ways to improve this.
Hi @b-onc ,
Thanks for the suggested work-around. I am not able to get my delegate callback to fire, it is only using the default implementation declared in the protocol extension. Can you take a quick look and let me know if I am doing something wrong? StreamChannelListDelegateWorkaround.zip
Hello @srgray , Thanks a lot for the sample project, it helped tremendously. There are 2 issues, 1 comes from user error and 1 comes from SDK User Error: You assign ViewController as delegate to ChannelListController, but ChannelListVC assigns itself as delegate, overriding yours. Your implementations won't be called. SDK Error: You can't override delegate methods in your ChannelListVC subclass because ChannelListVC doesn't implement them.
I'll PR the fix for SDK error shortly and then you'll be able to override delegate methods in your ChannelListVC subclass and return false
for type != .messaging
channels.
What did you do?
Attempt to display ChatChannelListVC for only
.messaging
channels of which my user is a memberWhat did you expect to happen?
Only
.messaging
channels that my user is a member of should be displayedWhat happened instead?
ChatChannelListVC displays some channels that are
.livestream
typeGetStream Environment
GetStream Chat version: 4.0.1 GetStream Chat frameworks: StreamChat, StreamChatUI
Additional context
See attached sample project: StreamChannelList.zip
Steps to reproduce: