Documentation Index
Fetch the complete documentation index at: https://wukong.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
同步最近会话列表
需要实现最近会话数据源 最近会话数据源
只有第一次打开应用时,需要同步最近会话列表, 后续最近会话列表的变化,通过监听来获取
const conversations = await WKSDK.shared().conversationManager.sync({})
监听最近会话列表
const listen = (conversation: Conversation, action: ConversationAction) => {
if (action === ConversationAction.add) { // 新增最近会话
} else if (action === ConversationAction.update) { // 更新最近会话
} else if (action === ConversationAction.remove) { // 删除最近会话
}
}
添加监听
WKSDK.shared().conversationManager.addConversationListener(listen);
移出监听
WKSDK.shared().conversationManager.removeConversationListener(listen)
其他常用方法
获取某个频道的最近会话
const conversation = WKSDK.shared().conversationManager.findConversation(channel)
移除一个频道的最近会话
WKSDK.shared().conversationManager.removeConversation(channel)
获取所有红点数量
const unreadCount = WKSDK.shared().conversationManager.getAllUnreadCount()
创建一个空会话
WKSDK.shared().conversationManager.createEmptyConversation(channel)