let cid = "channel-id"
let messageId = "message-id"
let threadVC = ChatThreadVC()
threadVC.channelController = ChatClient.shared.channelController(for: cid)
threadVC.messageController = ChatClient.shared.messageController(
cid: cid,
messageId: messageId
)
navigationController?.show(threadVC, sender: self)Thread
The ChatThreadVC is very similar with the ChatChannelVC, the difference is that instead of displaying messages, it displays the replies of a message thread. Just like the ChatChannelVC it also contains the ComposerVC component to create new replies.
The following diagram shows the components hierarchy of ChatThreadVC:
Overview
ChatThreadHeaderViewis responsible to display the thread information in thenavigationItem.titleView.ChatMessageListVCis the component that handles the rendering of the replies.ComposerVCis the component that handles the creation of new replies.
Usage
By default, the ChatThreadVC is created when you click to see the replies of a message in the ChatMessageListVC component. But in case you want to create it programmatically, you can use the following code:
In this section we are going to use ChatClient as a singleton, you can find more information about that here
UI Customization
You can customize how the ChatThreadVC looks by subclassing it and swap the component in Components configuration:
Components.default.threadVC = CustomChatThreadVC.selfYou can find more information on how the components configuration works here.
Just like the ChatChannelVC, the ChatThreadVC is only responsible for composing the ChatThreadHeaderView, ChatMessageListVC and ChatMessageComposerVC components together. In case you want to customize the rendering of the replies, you should read the Message documentation.