Set Do Not Disturb by Conversation
Set Message Do Not Disturb Status for a Conversation
Method
IM service users can set the Do Not Disturb level for a specified conversation or ultra group, supporting one-to-one chat, group chat, and ultra group conversations.
Future<int> changeConversationNotificationLevel(RCIMIWConversationType type, String targetId, String? channelId, RCIMIWPushNotificationLevel level, {IRCIMIWChangeConversationNotificationLevelCallback? callback});
Parameter Description
Parameter | Type | Description |
---|---|---|
type | RCIMIWConversationType | Conversation type. Note the following restrictions:
|
targetId | String | Conversation ID/Ultra Group ID |
channelId | String | Channel ID for the ultra group conversation. Pass null for other types.
|
level | RCIMIWPushNotificationLevel | Do Not Disturb level, refer to Do Not Disturb Overview |
callback | IRCIMIWChangeConversationNotificationLevelCallback | Event callback. The SDK supports callback from version 5.3.1. If the callback parameter is passed, only the callback is triggered. |
Return Value
Return Value | Description |
---|---|
Future<int> | The status code of the current operation. 0 indicates success. Specific results require implementing the interface callback. Non-zero indicates the current operation failed, and the interface callback will not be triggered. Refer to the error code for details. |
Code Example
IRCIMIWChangeConversationNotificationLevelCallback? callback = IRCIMIWChangeConversationNotificationLevelCallback(onConversationNotificationLevelChanged: (int? code) {
//...
});
int? ret = await engine?.changeConversationNotificationLevel(type, targetId, channelId, level, callback:callback);
Callback Method
- onConversationNotificationLevelChanged
Function(int? code, RCIMIWConversationType? type, String? targetId, String? channelId, RCIMIWPushNotificationLevel? level)? onConversationNotificationLevelChanged;
Parameter Description
Parameter | Type | Description |
---|---|---|
code | int | The status code of the interface callback. 0 indicates success, non-zero indicates an exception. |
type | RCIMIWConversationType | Conversation type |
targetId | String | Conversation ID |
channelId | String | Channel ID, only supported for ultra groups. Pass null for other conversation types. |
level | RCIMIWPushNotificationLevel | Message notification level |
Code Example
engine?.onConversationNotificationLevelChanged = (int? code, RCIMIWConversationType? type, String? targetId, String? channelId, RCIMIWPushNotificationLevel? level) {
//...
};
Get Do Not Disturb Status for a Conversation
Query the Do Not Disturb level set by the current user for a specified conversation.
Method
Future<int> getConversationNotificationLevel(RCIMIWConversationType type, String targetId, String? channelId, {IRCIMIWGetConversationNotificationLevelCallback? callback});
Parameter Description
Parameter | Type | Description |
---|---|---|
type | RCIMIWConversationType | Conversation type. Note the following restrictions:
|
targetId | String | Conversation ID/Ultra Group ID |
channelId | String | Channel ID for the ultra group conversation. Pass null for other types.
|
callback | IRCIMIWGetConversationNotificationLevelCallback | Event callback. The SDK supports callback from version 5.3.1. If the callback parameter is passed, only the callback is triggered. |
Return Value
Return Value | Description |
---|---|
Future<int> | The status code of the current operation. 0 indicates success. Specific results require implementing the interface callback. Non-zero indicates the current operation failed, and the interface callback will not be triggered. Refer to the error code for details. |
Code Example
IRCIMIWGetConversationNotificationLevelCallback? callback = IRCIMIWGetConversationNotificationLevelCallback(onSuccess: (RCIMIWPushNotificationLevel? t) {
//...
}, onError: (int? code) {
//...
});
int? ret = await engine?.getConversationNotificationLevel(type, targetId, channelId, callback:callback);
Callback Method
- onConversationNotificationLevelLoaded
Function(int? code, RCIMIWConversationType? type, String? targetId, String? channelId, RCIMIWPushNotificationLevel? level)? onConversationNotificationLevelLoaded;
Parameter Description
Parameter | Type | Description |
---|---|---|
code | int | The status code of the interface callback. 0 indicates success, non-zero indicates an exception. |
type | RCIMIWConversationType | Conversation type |
targetId | String | Conversation ID |
channelId | String | Channel ID, only supported for ultra groups. Pass null for other conversation types. |
level | RCIMIWPushNotificationLevel | Current conversation's message notification level |
Code Example
engine?.onConversationNotificationLevelLoaded = (int? code, RCIMIWConversationType? type, String? targetId, String? channelId, RCIMIWPushNotificationLevel? level) {
//...
};
Get Do Not Disturb Status List
Get the list of all conversations with Do Not Disturb enabled.
Method
Future<int> getBlockedConversations(List<RCIMIWConversationType> conversationTypes, String? channelId, {IRCIMIWGetBlockedConversationsCallback? callback});
Parameter Description
Future<int> getBlockedConversations(List<RCIMIWConversationType> conversationTypes, String? channelId, {IRCIMIWGetBlockedConversationsCallback? callback});
Return Value
Return Value | Description |
---|---|
Future<int> | The status code of the current operation. 0 indicates success. Specific results require implementing the interface callback. Non-zero indicates the current operation failed, and the interface callback will not be triggered. Refer to the error code for details. |
Code Example
IRCIMIWGetBlockedConversationsCallback? callback = IRCIMIWGetBlockedConversationsCallback(onSuccess: (List<RCIMIWConversation>? t) {
//...
}, onError: (int? code) {
//...
});
int? ret = await engine?.getBlockedConversations(conversationTypesInt, channelId, callback:callback);
Callback Method
- onBlockedConversationsLoaded
Function(int? code, List<RCIMIWConversationType>? conversationTypes, String? channelId, List<RCIMIWConversation>? conversations)? onBlockedConversationsLoaded;
Parameter Description
Parameter | Type | Description |
---|---|---|
code | int | The status code of the interface callback. 0 indicates success, non-zero indicates an exception. |
conversationTypes | List<RCIMIWConversationType> | Collection of conversation types |
channelId | String | Channel ID, only supported for ultra groups. Pass null for other conversation types. |
conversations | List<RCIMIWConversation> | Retrieved collection of conversations |
Code Example
engine?.onBlockedConversationsLoaded = (int? code, List<RCIMIWConversationType>? conversationTypes, String? channelId, List<RCIMIWConversation>? conversations) {
//...
};