Protocol
V2TIMConversationListener
public protocol V2TIMConversationListener : AnyObject
Definition of V2TIMConversationListener
Relationships
Conforms To
AnyObject
Requirements
onSyncServerStart()
func onSyncServerStart()
The SDK started to synchronize server conversations. The SDK automatically synchronizes server conversations after a successful login or network reconnection. You can monitor this event and display information about the progress on the UI.
onSyncServerFinish()
func onSyncServerFinish()
Server conversations have been synchronized. If a conversation changes, the SDK will notify you via onNewConversation or onConversationChanged.
onSyncServerFailed()
func onSyncServerFailed()
Server conversation synchronization failed
onNewConversation(conversationList:)
func onNewConversation(conversationList: Array<V2TIMConversation>)
A new conversation was added. This occurs when, for example, the user received a one-to-one chat message from a new colleague or was added to a new group. You can resort conversations based on "orderKey".
onConversationChanged(conversationList:)
func onConversationChanged(conversationList: Array<V2TIMConversation>)
The key information of some conversations changed. This occurs when, for example, the unread message count of a conversation changes or the last message is updated. You can resort conversations based on "orderKey".
onConversationDeleted(conversationIDList:)
func onConversationDeleted(conversationIDList: Array<String>)
Conversations are deleted. (supported by 7.2 and later versions)
-
conversationIDList indicates the deleted conversations' unique IDs. For one-to-one chats, the value format is [NSString stringWithFormat:@"c2c_%@",userID], "userID"). For group chats, the value format is [NSString stringWithFormat:@"group_%@",groupID].
onTotalUnreadMessageCountChanged(totalUnreadCount:)
func onTotalUnreadMessageCountChanged(totalUnreadCount: UInt)
Notify the changes of the total unread message count of all conversations (supported by 5.3.425 and later versions)
-
After you call getTotalUnreadMessageCount to obtain the total number of unread messages for all conversations, the newest value will be notified to you through this callback when unread message count of any conversation changed.
-
The total unread message count excludes the unread message count of muted conversations (conversations whose message receiving option is V2TIM_NOT_RECEIVE_MESSAGE or V2TIM_RECEIVE_NOT_NOTIFY_MESSAGE or V2TIM_RECEIVE_NOT_NOTIFY_MESSAGE_EXCEPT_AT).
onUnreadMessageCountChangedByFilter(filter:totalUnreadCount:)
func onUnreadMessageCountChangedByFilter(filter: V2TIMConversationListFilter, totalUnreadCount: UInt)
Notify the changes of the total unread message count of conversations by filter (supported by 7.0 and later versions)
-
You can call subscribeUnreadMessageCountByFilter to monitor the total unread message count of specified conversations. When the count changes, the SDK will send you the new count via this callback.
-
The filter parameter in this callback is the same as the filter you specify when calling subscribeUnreadMessageCountByFilter. It includes three fields: conversationType, conversationGroup, and markType. If you have specified multiple filters, you can tell which conversations' unread message count has changed based on the three fields from the callback you receive.
-
The total unread message count excludes the unread message count of Do-Not-Disturb conversations (conversations whose message receiving option is V2TIMMessage.V2TIM_NOT_RECEIVE_MESSAGE or V2TIMMessage.V2TIM_RECEIVE_NOT_NOTIFY_MESSAGE or V2TIMMessage.V2TIM_RECEIVE_NOT_NOTIFY_MESSAGE_EXCEPT_AT).
onConversationGroupCreated(groupName:conversationList:)
func onConversationGroupCreated(groupName: String, conversationList: Array<V2TIMConversation>)
Conversation group notification(supported only in 6.5 and later versions) Conversation group has been created.
onConversationGroupDeleted(groupName:)
func onConversationGroupDeleted(groupName: String)
Conversation group has been deleted.
onConversationGroupNameChanged(oldName:newName:)
func onConversationGroupNameChanged(oldName: String, newName: String)
Conversation group name has been chaned.
onConversationsAddedToGroup(groupName:conversationList:)
func onConversationsAddedToGroup(groupName: String, conversationList: Array<V2TIMConversation>)
New conversations have been added to this conversation group.
onConversationsDeletedFromGroup(groupName:conversationList:reason:)
func onConversationsDeletedFromGroup(groupName: String, conversationList: Array<V2TIMConversation>, reason:UInt32)
Conversations have been deleted from this conversation group.
-
reason : Indicates the reason why the conversation was deleted from the conversation group, its values are:
-
When reason is 0, it means that it is triggered by the user actively calling deleteConversationsFromGroup.
-
When reason is 1, it means that the number of conversations added to the conversation group exceeds 1000, and the earliest conversation added to the group will be eliminated.
onConversationsDeletedFromGroup(groupName:conversationList:)
@available(*, deprecated, message: "Use onConversationsDeletedFromGroup(groupName:conversationList:reason:) instead")
func onConversationsDeletedFromGroup(groupName: String, conversationList: Array<V2TIMConversation>)
Conversations have been deleted from this conversation group.(This API will be deprecated. Please call onConversationsDeletedFromGroup(groupName:conversationList:reason:) instead)