Silent Mode Guide
Configure which in-app notifications the StreamLayer iOS SDK displays, or disable all notifications with Silent Mode.
The StreamLayer SDK supports flexible notification configuration through SLRNotificationsMode. You can enable or disable specific notification types individually, or suppress all notifications at once using Silent Mode.
Notification Types
SLRNotificationsMode is an OptionSet, so you can combine types as needed:
/// StreamLayer SDK support different notification modes for different modules.
/// You can combine/disable/enable notifications as you want.
public struct SLRNotificationsMode: OptionSet {
public let rawValue: Int
public init(rawValue: Int) {
self.rawValue = rawValue
}
/// Chat notifications
static let messaging = SLRNotificationsMode(rawValue: 1)
/// Notifications with promotions
static let promotion = SLRNotificationsMode(rawValue: 1 << 1)
/// Notifications about friends online
static let arrival = SLRNotificationsMode(rawValue: 1 << 2)
/// Twitter module notifications
static let twitter = SLRNotificationsMode(rawValue: 1 << 3)
/// Notifications from voting/trivias modules
static let vote = SLRNotificationsMode(rawValue: 1 << 4)
/// Enabling all notifications. It's a default mode
static let all: SLRNotificationsMode = [.messaging,
.promotion,
.arrival,
.twitter,
.vote
]
/// All notifications are disabled
static let silent: SLRNotificationsMode = []
}Enable Silent Mode
You can enable Silent Mode in two ways.
Option 1: Set the notification mode directly
StreamLayer.config.noticationMode = SLRNotificationsMode.silentOption 2: Use the built-in silent configuration
The SDK provides StreamLayerSilentModeConfig, a pre-built configuration that disables all notifications and hides social features:
public struct StreamLayerSilentModeConfig: StreamLayerConfig {
public init() {}
public var isAlwaysOpened: Bool = false
public var phoneContactsSyncEnabled: Bool = true
public var whoIsWatchingEnabled: Bool = false
public var isUserProfileOverlayHidden: Bool = true
public var notificationsMode: SLRNotificationsMode = .silent
public var appStyle: SLRStyle = .blue {
didSet {
applyStyle()
}
}
}Apply it with:
StreamLayer.config = StreamLayerSilentModeConfig()Related
- Integration Guide — Full SDK setup including configuration options
- In-App Notifications — Overview of all notification types
Updated 14 days ago
