- Android
- iOS
- JavaScript
- Flutter
- ReactNative
- HarmonyOS
Code Example
int count = JIM.getInstance().getConversationManager().getTotalUnreadCount();
Code Example
int count = [JIM.shared.conversationManager getTotalUnreadCount];
Get the total unread count for all conversations of the current user. Filtering by conversationTypes and ignoreConversations is supported; the two conditions use an AND relationship.
Parameters
| Name | Type | Required | Default | Description | Version |
|---|---|---|---|---|---|
| params | Object | No | None | Query conditions | 1.0.0 |
| params.conversationTypes | Array | No | None | Specified conversation types | 1.0.0 |
| params.ignoreConversations | Array | No | None | Ignore specified conversations | 1.0.0 |
Code Example
// Method 1: Get the total unread count for all conversations
jim.getTotalUnreadcount().then(({ count }) => {
console.log('Current user's total unread count:', count);
})
/**
Method 2: Get the total unread count after applying filters
Filter description: Get the total unread count for all private chats except userid2
*/
let params = {
conversationTypes: [ConversationType.PRIVATE],
ignoreConversations: [
{
conversationType: ConversationType.PRIVATE,
conversationId: 'userid2'
}
]
};
jim.getTotalUnreadcount(params).then(({ count }) => {
console.log('Current user's total unread count:', count);
})
Get the total unread count for all conversations of the current user. Filtering by ConversationType is also supported.
Code Example
// get the total unread count for all conversations
int count = await JuggleIm.instance.getTotalUnreadCount();
// get the total unread count for all private chat conversations
int count = await JuggleIm.instance.getTotalUnreadCount([ConversationType.private]);
// get the total unread count for all group conversations
int count = await JuggleIm.instance.getTotalUnreadCount([ConversationType.group]);
// get the total unread count for all private chat and group conversations
int count = await JuggleIm.instance.getTotalUnreadCount([ConversationType.private, ConversationType.group]);
Get the total unread count for all conversations of the current user. Conditional filtering is supported.
Code Example
import JuggleIM from 'juggleim-rnsdk';
// get the total unread count for all conversations
const count = await JuggleIM.getTotalUnreadCount();
// get the total unread count for all private chat conversations
const count = await JuggleIM.getTotalUnreadCount([1]);
// get the total unread count for all group conversations
const count = await JuggleIM.getTotalUnreadCount([2]);
// get the total unread count for all private chat and group conversations
const count = await JuggleIM.getTotalUnreadCount([1, 2]);
Code Example
JuggleIm.instance.getConversationManager().getTotalUnreadCount((code,count)=>{
})