NotificationManagerDelegate
public protocol NotificationManagerDelegate: NSObjectProtocol
Allow a container application (iOS native) to make decision and extensions to notifications that will be sent to a web client (Hybrid).
An example of this would be to allow an application to process and filter notifications in a background thread before allowing notification to be sent to the web client running in the webview.
-
Called when a notification is going to be sent to the web client.
Because this function will stall sending notifications to the web client it should not spend much time doing logic or waiting on other events. Though this delegate call may be called on a background thread it may be terminated if it does not respond in a timely manner.
If it is determined that the web client should not take action on this notification the function should pass false to the complete closure.
Example:
func willSendNotification(name: String, payload: Any?, javaScrintFunction: String, complete: @escaping (_ sendNotifcationToWebClient: Bool) -> Void) { if name ==
DocumentChangedNotification/
{ let documentId = String(name(from:DocumentChangedNotification/
.count)) if documentId ==noop
{ complete(false) return } }complete(true)
Declaration
Swift
func willSendNotification(name: String, payload: Any?, javaScriptFunction: String?, complete: @escaping (_ sendNotifcationToWebClient: Bool) -> Void)
Parameters
name
The name of the notification that will be sent if approved
payload
The data for the given notification
javaScriptFuction
The JavaScript function that will be called with the notification
complete
A callback closure that tells the SDK to send or not send notification to the hybrid web client }