Skip to main content

Set global do not disturb

The client can configure a silent notification time window to implement global do not disturb functionality. This feature sets a recurring daily time window that remains effective until modified or removed.

Chat UI doesn't provide direct UI for global do not disturb settings. You need to use methods from the Chat SDK. See the global do not disturb capabilities in NCEngine.

tip

For Chat UI integrations, we recommend using the NCEngine interface in Chat SDK that allows simultaneous configuration of both the time window and "do not disturb level".

During the global do not disturb period configured through the SDK:

  • When the client runs in background, new messages in channels won't trigger notification alerts, though message content will still be received
  • When the client is offline, no remote notifications will be received
  • Exception: @mentions are high-priority messages that bypass global do not disturb and always trigger notifications

Set global do not disturb

NCEngine provides the setNoDisturbTimeWithParams:completion: method to configure both the time window and do not disturb level. Create NCNoDisturbTimeParams with initWithStartTime:spanMinutes:.

swift
let params = NCNoDisturbTimeParams(startTime: "22:00:00", spanMinutes: 480)
params.level = .muted
NCEngine.setNoDisturbTime(with: params) { error in }

Get global do not disturb settings

The client can actively retrieve the latest global do not disturb configuration.

swift
NCEngine.getNoDisturbTime { info, error in }

Remove global do not disturb

swift
NCEngine.removeNoDisturbTime { error in }