Group channel collection
A GroupChannelCollection
instance allows you to swiftly create a channel list view that remains up to date on all channel-related events. This page explains how to draw a view using the collection.
Create a collection
First, create a GroupChannelListQuery
instance. This determines which channel to include in the channel list and how to list channels in order.
Once the collection is created, you should call loadMore()
.
Pagination
A GroupChannelCollection
instance retrieves more channels to display in the view through the loadMore()
method.
Whenever a scroll reaches the bottom of the channel list view, the loadMore()
method is called and hasMore
first checks if there are more channels to load. If so, loadMore()
fetches them.
The loadMore()
method should also be called after you've created a GroupChannelCollection
instance.
Channel events
Use the handler
property in GroupChannelCollection
constructor to determine how the client app reacts to channel-related events.
This is called whenever a new channel is created as a real-time event when the client app is back online.
The following table shows possible cases where each event handler can be called.
Event | Called when |
---|---|
onChannelsAdded() | - A new group channel is created as a real-time event. |
onChannelsUpdated() | - The channel information that is included in the user's current chat view is updated as a real-time event. |
onChannelsDeleted() | - A group channel is deleted as a real-time event. |
Dispose of the collection
The dispose()
method should be called when you destroy the channel list screen to notify the SDK that this collection is no longer visible.