iOS delegates
SyneriseDelegate
A delegate to handle the SDK lifecycle events.
To set your object as delegate, you must use this method.
Synerise.setDelegate(YOUR_OBJECT)
snr_initialized()
This method is called when the Synerise SDK is initialized.
func snr_initialized() -> Void
snr_initializationError(error: Error)
This method is called when an error occurs while initializing the Synerise SDK.
func snr_initializationError(error: Error) -> Void
Parameter | Type | Description |
---|---|---|
error | NSError | The error that occurred. |
snr_registerForPushNotificationsIsNeeded()
This method is called when Synerise needs registration for push notifications.
See Configuring push notifications for more details.
func snr_registerForPushNotificationsIsNeeded() -> Void
snr_registerForPushNotificationsIsNeeded(origin: PushNotificationsRegistrationOrigin)
This method is called when Synerise needs registration for push notifications.
See Configuring push notifications for more details.
func snr_registerForPushNotificationsIsNeeded(origin: PushNotificationsRegistrationOrigin) -> Void
Parameter | Type | Description |
---|---|---|
origin | PushNotificationsRegistrationOrigin | Origin of the push notifications registration from the SDK. |
snr_handledAction(url: URL)
This method is called when Synerise handles URL action from campaign activities.
func snr_handledAction(url: URL) -> Void
Parameter | Type | Description |
---|---|---|
url | NSURL | URL value from the action of the activity. |
snr_handledAction(url: URL, activity: SyneriseActivity, completionHandler: SyneriseActivityCompletionHandler)
This method is called when Synerise handles URL action from campaign activities.
func snr_handledAction(url: URL, activity: SyneriseActivity, completionHandler: SyneriseActivityCompletionHandler) -> Void
Parameter | Type | Description |
---|---|---|
url | NSURL | URL value from the action of the activity. |
activity | SyneriseActivity | Identifies Synerise campaign activity (SyneriseActivity). |
completionHandler | SyneriseActivityAction | A block/closure that should be invoked with SyneriseActivityAction parameters and a completion block to execute. |
snr_handledAction(deepLink: String)
This method is called when Synerise handles deeplink action from campaign activities.
func snr_handledAction(deepLink: String) -> Void
Parameter | Type | Description |
---|---|---|
deeplink | String | Deep link value from the action of the activity. |
snr_handledAction(deepLink: String, activity: SyneriseActivity, completionHandler: SyneriseActivityCompletionHandler)
This method is called when Synerise handles deeplink action from campaign activities.
func snr_handledAction(deepLink: String, activity: SyneriseActivity, completionHandler: SyneriseActivityCompletionHandler) -> Void
Parameter | Type | Description |
---|---|---|
deeplink | String | Deep link value from the action of the activity. |
activity | SyneriseActivity | Identifies Synerise campaign activity (SyneriseActivity). |
completionHandler | SyneriseActivityAction | A block/closure that should be invoked with parameters: SyneriseActivityAction and completion block to execute. |
NotificationDelegate
A delegate to handle events from Synerise notifications.
See Configuring push notifications for more details.
To set your object as delegate, you must use this method.
Synerise.setNotificationDelegate(YOUR_OBJECT)
snr_notificationDidReceive(notificationInfo: NotificationInfo)
This method is called when a Synerise notification is received.
snr_notificationDidReceive(notificationInfo: NotificationInfo)
Parameter | Type | Description |
---|---|---|
notificationInfo | NotificationInfo | Object providing information about the notification. |
snr_notificationDidDissmis(notificationInfo: NotificationInfo)
This method is called when a Synerise notification is dismissed.
func snr_notificationDidDissmis(notificationInfo: NotificationInfo)
Parameter | Type | Description |
---|---|---|
notificationInfo | NotificationInfo | Object providing information about the notification. |
snr_notificationClicked(notificationInfo: NotificationInfo)
This method is called when a Synerise notification is clicked.
func snr_notificationClicked(notificationInfo: NotificationInfo)
Parameter | Type | Description |
---|---|---|
notificationInfo | NotificationInfo | Object providing information about the notification. |
snr_notificationClicked(notificationInfo: NotificationInfo, actionButton: String)
This method is called when an action button is clicked in a Synerise notification.
func snr_notificationClicked(notificationInfo: NotificationInfo, actionButton: String)
Parameter | Type | Description |
---|---|---|
notificationInfo | NotificationInfo | Object providing information about the notification. |
actionButton | String | Text on the clicked action button. |
ClientStateDelegate
A delegate to handle customer’s sign-in state changes.
To set your object as delegate, you must use this method.
Client.setClientStateDelegate(YOUR_OBJECT)
snr_clientIsSignedIn()
This method is called when a customer signs in.
func snr_clientIsSignedIn()
snr_clientIsSignedOut(reason: ClientSessionEndReason)
This method is called when a customer signs out.
func snr_clientIsSignedOut(reason: ClientSessionEndReason)
Parameter | Type | Description |
---|---|---|
reason | ClientSessionEndReason | Specifies the reason for signing out. |
InjectorInAppMessageDelegate
A delegate to handle the states of in-app message.
To set your object as delegate, you must use this method.
Injector.setInAppMessageDelegate(YOUR_OBJECT)
snr_shouldInAppMessageAppear(data: InAppMessageData) -> Bool
This method is called after an in-app message is loaded and Synerise SDK asks for permission to show it.
func snr_shouldInAppMessageAppear(data: InAppMessageData) -> Bool
Parameter | Type | Description |
---|---|---|
data | InAppMessageData | Model representation of the in-app message. |
snr_inAppMessageDidAppear(data: InAppMessageData)
This method is called after an in-app message appears.
func snr_inAppMessageDidAppear(data: InAppMessageData)
Parameter | Type | Description |
---|---|---|
data | InAppMessageData | Model representation of the in-app message. |
snr_inAppMessageDidDisappear(data: InAppMessageData)
This method is called after an in-app message disappears.
func snr_inAppMessageDidDisappear(data: InAppMessageData)
Parameter | Type | Description |
---|---|---|
data | InAppMessageData | Model representation of the in-app message. |
snr_inAppMessageDidChangeSize(rect: CGRect)
This method is called when an in-app message changes its size.
func snr_inAppMessageDidChangeSize(rect: CGRect)
Parameter | Type | Description |
---|---|---|
data | InAppMessageData | Model representation of the in-app message. |
snr_inAppMessageContextIsNeeded(data: InAppMessageData) -> [AnyHashable: Any]?
This method is called when an individual context (for example a profile ID, an item SKU) for an in-app message is needed.
func snr_inAppMessageContextIsNeeded(data: InAppMessageData) -> [AnyHashable: Any]?
Parameter | Type | Description |
---|---|---|
data | InAppMessageData | Model representation of the in-app message. |
snr_inAppMessageHandledAction(data: InAppMessageData, url: URL)
This method is called when the SRInApp.openUrl(url)
method is used in an in-app message.
func snr_inAppMessageHandledAction(data: InAppMessageData, url: URL)
Parameter | Type | Description |
---|---|---|
data | InAppMessageData | Model representation of the in-app message. |
url | URL | URL value from the action of the activity. |
snr_inAppMessageHandledAction(data: InAppMessageData, deeplink: String)
This method is called when the SRInApp.openDeeplink(url)
method is used in an in-app message.
func snr_inAppMessageHandledAction(data: InAppMessageData, deeplink: String)
Parameter | Type | Description |
---|---|---|
data | InAppMessageData | Model representation of the in-app message. |
deeplink | String | Deep link value from the action of the activity. |
snr_inAppMessageHandledCustomAction(data: InAppMessageData, name: String, parameters: [AnyHashable: Any])
This method is called when the SRInApp.handleCustomAction(name, params)
method is used in an in-app message.
func snr_inAppMessageHandledCustomAction(data: InAppMessageData, name: String, parameters: [AnyHashable: Any])
Parameter | Type | Description |
---|---|---|
data | InAppMessageData | Model representation of the in-app message. |
name | String | Custom action name for identification. |
parameters | [AnyHashable: Any] | Custom action parameters. |
TrackerDelegate
A delegate to handle events from the Tracker.
To set your object as delegate, you must use this method.
Tracker.setDelegate(YOUR_OBJECT)
snr_locationUpdateRequired()
This method is called when the Tracker module requests a location update.
func snr_locationUpdateRequired()
NotificationServiceExtensionDelegate
A delegate to handle events from Notification Extension Service.
To set your object as delegate, you must use this code in your Notification Service Extension.
NotificationServiceExtension.setDelegate(YOUR_OBJECT)
notificationServiceExtensionDidFailDecryptionWithError(_: Error)
This method is called when the decryption process fails.
func notificationServiceExtensionDidFailDecryptionWithError(_: Error)
Parameter | Type | Description |
---|---|---|
error | NSError | The error that occurred |
notificationServiceExtensionDidFailProcessingWithError(_: Error)
This method is called when the processing notification operation fails.
func notificationServiceExtensionDidFailProcessingWithError(_: Error)
Parameter | Type | Description |
---|---|---|
error | NSError | The error that occurred |
ContentWidgetDelegate
A delegate to handle Content Widget actions.
To set your object as delegate, you must use this code below.
let widget = ContentWidget(options: widgetOptions, appearance: widgetAppearance)
widget.delegate = YOUR_OBJECT
snr_widgetDidLoad(widget: ContentWidget)
This method is called after a widget is loaded.
func snr_widgetDidLoad(widget: ContentWidget)
Parameter | Type | Description |
---|---|---|
widget | ContentWidget | The widget instance that called the delegate method. |
snr_widgetDidNotLoad(widget:ContentWidget error: Error)
This method is called when an error occurs while loading a widget.
func snr_widgetDidNotLoad(widget:ContentWidget error: Error)
Parameter | Type | Description |
---|---|---|
widget | ContentWidget | The widget instance that called the delegate method. |
error | NSError | The error that occurred. |
snr_widgetDidReceiveClickAction(widget:ContentWidget model: BaseModel)
This method is called when the customer clicks a widget’s item.
func snr_widgetDidReceiveClickAction(widget:ContentWidget model: BaseModel)
Parameter | Type | Description |
---|---|---|
widget | ContentWidget | The widget instance that called the delegate method. |
model | BaseModel | The model’s object that was clicked. |
snr_widgetIsLoading(widget: ContentWidget isLoading: Bool)
This method is called when the widget’s loading state changes.
func snr_widgetIsLoading(widget: ContentWidget isLoading: Bool)
Parameter | Type | Description |
---|---|---|
widget | ContentWidget | The widget instance that called the delegate method. |
isLoading | Bool | Widget’s loading state. |
snr_widgetDidChangeSize(widget: ContentWidget size: CGSize)
This method is called when the widget’s size changes.
func snr_widgetDidChangeSize(widget: ContentWidget size: CGSize)
Parameter | Type | Description |
---|---|---|
widget | ContentWidget | The widget instance that called the delegate method. |
size | CGSize | Widget’s new size. |