Notifications

@objc(GetSocialNotifications)
@objcMembers
public class Notifications : NSObject

Interface for managing notifications.

  • Get the list of notifications of current user.

    Declaration

    Swift

    @objc(getWithQuery:success:failure:)
    public static func get(_ query: NotificationsPagingQuery, success: @escaping ResultCallback<NotificationsPagingResult>, failure: @escaping FailureCallback)

    Parameters

    query

    Query to filter notifications.

    success

    Called with list of notifications.

    failure

    Called if operation failed.

  • Get the number of notifications of current user based on the provided query.

    Declaration

    Swift

    @objc(countWithQuery:success:failure:)
    public static func count(_ query: NotificationsQuery, success: @escaping ResultCallback<Int>, failure: @escaping FailureCallback)

    Parameters

    query

    Query to filter notifications.

    success

    Called with the number of notifications.

    failure

    Called if operation failed.

  • Set notifications status.

    Declaration

    Swift

    @objc(setStatusTo:notificationIds:success:failure:)
    public static func setStatus(_ newStatus: String, notificationIds: [String], success: @escaping SuccessCallback, failure: @escaping FailureCallback)

    Parameters

    newStatus

    New status.

    notificationIds

    List of notifications ids.

    success

    Called if operation finished.

    failure

    Called if operation failed.

  • Enable or disable receiving Push Notifications.

    If set to false current user won’t receive GetSocial Push Notifications anymore, until same method called with true.

    Declaration

    Swift

    @objc(setPushNotificationsEnabled:success:failure:)
    public static func setPushNotificationsEnabled(_ enabled: Bool, success: @escaping SuccessCallback, failure: @escaping FailureCallback)

    Parameters

    enabled

    Enable or disable Push Notifications.

    success

    Called if operation succeeded.

    failure

    Called if operation failed.

  • Check if Push Notifications are enabled for current user.

    Declaration

    Swift

    @objc(arePushNotificationsEnabledWithSuccess:failure:)
    public static func arePushNotificationsEnabled(success: @escaping ResultCallback<Bool>, failure: @escaping FailureCallback)

    Parameters

    success

    Called with true if Push Notifications are enabled, otherwise false.

    failure

    Called if operation failed.

  • Send notification to any GetSocial user.

    Declaration

    Swift

    @objc(sendNotificationContent:target:success:failure:)
    public static func send(_ content: NotificationContent, target: SendNotificationTarget, success: @escaping SuccessCallback, failure: @escaping FailureCallback)

    Parameters

    content

    Notification content to send.

    target

    Notification recipients.

    success

    Called with the number of successfully delivered notifications.

    failure

    Called if operation failed.

  • Register device for Push Notifications.

    Declaration

    Swift

    @objc(registerDevice)
    public static func registerDevice()
  • Set listener to be invoked when a Push Notification was clicked.

    Declaration

    Swift

    @objc(setOnNotificationClickedListener:)
    public static func setOnNotificationClickedListener(_ listener: @escaping OnNotificationClickedListener)

    Parameters

    listener

    Handler to be invoked.

  • Set listener to be invoked when a Push Notification was received.

    Declaration

    Swift

    @objc(setOnNotificationReceivedListener:)
    public static func setOnNotificationReceivedListener(_ listener: @escaping OnNotificationReceivedListener)

    Parameters

    listener

    Listener to be invoked.

  • Set listener to be invoked when device was registered for Push Notifications.

    Declaration

    Swift

    @objc(setOnTokenReceivedListener:)
    public static func setOnTokenReceivedListener(_ listener: @escaping OnTokenReceivedListener)

    Parameters

    listener

    Listener to be invoked.