SBBNotificationManagerProtocol Protocol Reference

Conforms to SBBBridgeAPIManagerProtocol
Declared in SBBNotificationManager.h

Overview

This protocol defines the interface to the SBBNotificationManager’s non-constructor, non-initializer methods. The interface is abstracted out for use in mock objects for testing, and to allow selecting among multiple implementations at runtime.

– registerWithDeviceToken:completion: required method

Register the push notifications deviceId (provided by iOS when registering for push notifications) with Bridge.

- (nullable NSURLSessionTask *)registerWithDeviceToken:(NSData *)deviceToken completion:(nullable SBBNotificationManagerCompletionBlock)completion

Parameters

deviceToken

The device token passed in to the app delegate upon registering with iOS for push notifications via the AppDelegate’s application:didRegisterForRemoteNotificationsWithDeviceToken: method (or application(_:didRegisterForRemoteNotificationsWithDeviceToken:) in Swift).

completion

An SBBNotificationManagerCompletionBlock to be called upon completion.

Return Value

An NSURLSessionTask object so you can cancel or suspend/resume the request.

Discussion

You should call this method in the AppDelegate’s application:didRegisterForRemoteNotificationsWithDeviceToken: method (or application(_:didRegisterForRemoteNotificationsWithDeviceToken:) in Swift). If this account is not already registered with Bridge for push notifications, it will be registered. If it is, the registration will be updated in case the deviceToken has changed.

Declared In

SBBNotificationManager.h

– unregisterWithCompletion: required method

Unregister for push notifications from Bridge.

- (nullable NSURLSessionTask *)unregisterWithCompletion:(nullable SBBNotificationManagerCompletionBlock)completion

Parameters

completion

An SBBNotificationManagerCompletionBlock to be called upon completion.

Return Value

An NSURLSessionTask object so you can cancel or suspend/resume the request.

Discussion

You should call this method if the participant changes their notification permission settings to not allow push notifications.

Declared In

SBBNotificationManager.h

– getSubscriptionStatuses: required method

Get current notification topic subscription statuses from Bridge.

- (nullable NSURLSessionTask *)getSubscriptionStatuses:(nullable SBBNotificationManagerSubscriptionStatusCompletionBlock)completion

Parameters

completion

An SBBNotificationManagerSubscriptionStatusCompletionBlock to be called upon completion.

Return Value

An NSURLSessionTask object so you can cancel or suspend/resume the request.

Declared In

SBBNotificationManager.h

– subscribeToTopicGuids:completion: required method

Update notification topic subscriptions to Bridge.

- (nullable NSURLSessionTask *)subscribeToTopicGuids:(NSArray<NSString*> *)topicGuids completion:(SBBNotificationManagerSubscriptionStatusCompletionBlock)completion

Parameters

topicGuids

An array of topicGuid strings to which the account should be subscribed. Any topics whose guids are not in this array will be unsubscribed. Passing in an empty NSArray will unsubscribe the participant from all topics.

completion

An SBBNotificationManagerSubscriptionStatusCompletionBlock to be called upon completion.

Return Value

An NSURLSessionTask object so you can cancel or suspend/resume the request.

Discussion

If the app is not currently registered for push notifications with Bridge, this will return nil and will call the completion handler with error code SBBErrorCodeNotRegisteredForPushNotifications.

Declared In

SBBNotificationManager.h