DND by channel ID
Set the Do Not Disturb (DND) level for a specific sub-channel within a Community channel.
tip
Within user-level DND settings, the priority order is: 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 channel or 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 DND for a community channel sub-channel
Create an NCCommunitySubChannelIdentifier with the Community channel ID and sub-channel ID, then instantiate the channel and set the DND level:
- Swift
- Objective-C
swift
import NexconnChatSDK
CommunitySubChannel *subChannel =
[CommunitySubChannel alloc initWithChannelId:@"communityId"
subChannelId:"subChannelId"]
subChannel setNoDisturbLevel:NCChannelNoDisturbLevelMuted
completion:^(NCError *error) {
if (error == nil) {
// NSLog("Sub-channel DND set.")
} else {
// NSLog("Failed: %", error)
}
}
Objective C
NCCommunitySubChannel *subChannel =
[[NCCommunitySubChannel alloc] initWithChannelId:@"communityId"
subChannelId:@"subChannelId"];
[subChannel setNoDisturbLevel:NCChannelNoDisturbLevelMuted
completion:^(NCError *error) {
if (error == nil) {
NSLog(@"Sub-channel DND set.");
} else {
NSLog(@"Failed: %@", error);
}
}];
Remove the DND level
Pass NCChannelNoDisturbLevelDefaultLevel to reset to the default:
- Swift
- Objective-C
swift
import NexconnChatSDK
subChannel setNoDisturbLevel:NCChannelNoDisturbLevelDefaultLevel
completion:^(NCError *error) {}]
Objective C
[subChannel setNoDisturbLevel:NCChannelNoDisturbLevelDefaultLevel
completion:^(NCError *error) {}];