Notifications

public final class Notifications : NSObject
extension Notifications: UNUserNotificationCenterDelegate

A notifications manager.

  • A message reference: channel id + message id.

    Declaration

    Swift

    public typealias MessageReference = (channelId: String, channelType: ChannelType, messageId: String)
  • A custom local notification content.

    Declaration

    Swift

    public typealias LocalNotificationContent = (Message, Channel) -> UNNotificationContent
  • A callback type to open a chat view controller with a given message reference.

    Declaration

    Swift

    public typealias OnNewMessage = (MessageReference) -> Void
  • A callback to create a custom local notification for a new message when the app in the background.

    Declaration

    Swift

    public var localNotificationContent: LocalNotificationContent?
  • A shared instance of notifications manager.

    Declaration

    Swift

    public static let shared: Notifications
  • A callback to open a chat view controller with a given message id and channel id.

    Declaration

    Swift

    public var onNewMessage: OnNewMessage?
  • Enable clearing application icon badge number when app become active.

    Declaration

    Swift

    public var clearApplicationIconBadgeNumberOnAppActive: Bool { get set }
  • Prevent the display of local notifications.

    Declaration

    Swift

    public var disableLocalNotifications: Bool
  • Ask for permissions for notifications.

    Declaration

    Swift

    public func askForPermissionsIfNeeded()

Message

  • Show a notification with a given message from a channel if the app in the background.

    Declaration

    Swift

    public func showIfNeeded(newMessage message: Message, in channel: Channel)

    Parameters

    message

    a message.

    channel

    a channel.

  • Show a notification with a given message from a channel.

    Declaration

    Swift

    public func show(newMessage message: Message, in channel: Channel)

    Parameters

    message

    a message.

    channel

    a channel.

UNUserNotificationCenterDelegate