SBUChannelListViewController filtered by customType showing group channels with different customTypes when the message is received

Hi @Tez

PODS:

  • SendBirdSDK (3.0.195)
  • SendBirdUIKit (1.1.2):
    • SendBirdSDK (~> 3.0.190)

I found a scenario:

I have derived from SBUChannelListViewController and presented this viewcontroller passing in a customType to filter my channel list.

I send a message to my user to a different customType than the currently presented customType and see my group channel show up that is for a different customType than currently being used to filter my list.

If dismiss the viewcontroller and re-present my viewcontroller using my customType to filter, then I see my expected list again.

This is the test case I am using:

  1. On device A, present SBUChannelListViewController using customType = “1”
  2. On Device B, create a group channel to the user on device A with customType = “2” and send message
  3. On device A, observe that the message to a group channel with customType = “2” shows up and is visible when the customType = “1”

Let me know if there is a way that I can prevent messages to group channels with different customTypes than being used in the currently displayed SBUChannelListViewController.

Hello @Eric,

If you want to set customType in ChannelList and user it, you need to do two things.

  1. When initializing the channelList, you need to set the channelListQuery with customTypeFilter set.

    let query = SBDGroupChannel.createMyGroupChannelListQuery()
    query?.customTypesFilter = [YOUR_CUSTOM_TYPE]
    let vc = SBUChannelListViewController(channelListQuery: query)
    ...
    
  2. Override the channelWasChanged function of SBDChannelDelegate so that when a channel is updated, it is not precessed unless it is a channel of a specific type.

    override func channelWasChanged(_ sender: SBDBaseChannel) {
        guard let channel = sender as? SBDGroupChannel,
        channel.customType == YOUR_CUSTOM_TYPE else { return }
            
        super.channelWasChanged(sender)        
    }
    

I hope these two things will help.
Please check these, and reply. :pray:t2:

Thanks @Tez!

I was missing the channelWasChanged override and was able to use your example to get my test case working quickly.

Thank you

1 Like