DND settings by channel type
Set the Do Not Disturb (DND) level for all channels of a specific type. Supported types: Direct Channel, Group channel, Community channel.
tip
Under user-level DND settings, DND by channel type has the lowest priority. Priorities: Global DND > DND by channel ID > DND by channel > DND by channel type. See DND Overview.
Supported DND levels
| Enum value | Numeric value | Description |
|---|---|---|
NCChannelNoDisturbLevelAllMessage | -1 | Notify for all messages. |
NCChannelNoDisturbLevelDefaultLevel | 0 | Not set — inherits from app-level settings. |
NCChannelNoDisturbLevelMention | 1 | Notify only for @mention messages (@user and @everyone). |
NCChannelNoDisturbLevelMentionUsers | 2 | Notify only when the current user is specifically @mentioned. |
NCChannelNoDisturbLevelMentionAll | 4 | Notify only for @everyone messages. |
NCChannelNoDisturbLevelMuted | 5 | Suppress all notifications, including mentions. |
Set the DND level for a channel type
Create NCChannelTypeNoDisturbLevelParams and call the class method on NCDirectChannel, NCGroupChannel, or the base channel class:
- Swift
- Objective-C
swift
import NexconnChatSDK
let params = NCChannelTypeNoDisturbLevelParams()
params.channelType = .group; // Direct = 1, Group = 3, Community = 10
params.level = NCChannelNoDisturbLevelMuted
GroupChannel setChannelTypeNoDisturbLevelWithParams:params
completion:^(NCError *error) {
if (error == nil) {
// NSLog("DND level set for all group channels.")
} else {
// NSLog("Failed: %", error)
}
}
Objective C
NCChannelTypeNoDisturbLevelParams *params = [[NCChannelTypeNoDisturbLevelParams alloc] init];
params.channelType = NCChannelTypeGroup; // Direct = 1, Group = 3, Community = 10
params.level = NCChannelNoDisturbLevelMuted;
[NCGroupChannel setChannelTypeNoDisturbLevelWithParams:params
completion:^(NCError *error) {
if (error == nil) {
NSLog(@"DND level set for all group channels.");
} else {
NSLog(@"Failed: %@", error);
}
}];
Remove the DND level for a channel type
Pass NCChannelNoDisturbLevelDefaultLevel to reset:
- Swift
- Objective-C
swift
import NexconnChatSDK
let params = NCChannelTypeNoDisturbLevelParams()
params.channelType = .group
params.level = NCChannelNoDisturbLevelDefaultLevel
GroupChannel setChannelTypeNoDisturbLevelWithParams:params completion:^(NCError *error) {}
Objective C
NCChannelTypeNoDisturbLevelParams *params = [[NCChannelTypeNoDisturbLevelParams alloc] init];
params.channelType = NCChannelTypeGroup;
params.level = NCChannelNoDisturbLevelDefaultLevel;
[NCGroupChannel setChannelTypeNoDisturbLevelWithParams:params completion:^(NCError *error) {}];