Classes

The following classes are available globally.

  • Configuration for the unblu api. Changes to an instance are not considered after the configuration was already given to the UnbluApi#configureApi call. There is a base configuration which needs to be given when constructing it. All other configurations are optional

    See more

    Declaration

    Swift

    @objc
    public class UnbluApiConfiguration : NSObject
  • The API to use to access unblu suite functionality like showing, opening conversations

    Before calling any other function #configureApi should be called inside the AppDelegate.

    Use the constants of UnbluEventApi to register for events and access their user info data

    A typical flow for the usage would be:

    AppDelegate#application() {
       UnbluCoreApi.instance.configureApi(UnbluApiConfiguration(unbluBaseUrl: "<base-url>", apiKey: "<apiKey>"))
    
       //register for general errors and/or also other events
       NotificationCenter.default.addObserver(self, selector: #selector(AppDelegate.handleErrorEvent(notification:)), name: Notification.Name.UnbluError, object: nil)
    
       //start the api. This could also be done later when it is needed, but it will take a while until the api is ready
       UnbluCoreApi.instance.initApi(success: {<success handling>}, failure: {<error handling>})
    }
    
    SomeViewController#showConversations() {
       //the conversations should be shown
       UnbluCoreApi.instance.showUi(visible: true)
    }
    
    See more

    Declaration

    Swift

    @objc
    open class UnbluCoreApi : NSObject
  • Interface to use notifications with unblu. As Firebase Cloud Messaging (FCM) SDK is build as a static library, we can not include it here. Most functions of this api should be called for specific notification callbacks typically fired in the AppDelegate.

    Use UnbluUiApplicationDelegate as a base class for your AppDelegate to automatically get all functionalities. The source file for UnbluUiApplicationDelegate is shipped together with the SDK.

    Unblu will display/handle notifications as shown in the following table. Api helper to check mainly if notifications are from unblu or not

    Unblu will display/handle notifications as shown in the following table.

    | App state | New Message | Incoming Call |


    | background | show notification | show notification |


    | foreground unblu UI closed | show notification | Trigger UnbluUiEventApi.UiVisibilityRequest |


    | foreground unblu UI open | Does nothing | Does nothing |


    Whenever a notification is clicked, the event {@link com.unblu.coresdk.ui.IUnbluUiEventApi.UiVisibilityRequest} is triggered.

    See more

    Declaration

    Swift

    @objc
    public class UnbluNotificationApi : NSObject
  • A notification center delegate which checks if a notification is from unblu or not. it will then decide to display it or not, while the app is open. This handler is always set at startapp to the current notification center. If you want to use your own implementation of UNUserNotificationCenterDelegate, you can instanciate a new instance of this class and provide a delegate to it. Then assign it to the current UNNotificationCenter. This class will then forward all requests (except for the unblu notifications) to your implementation.

    See more

    Declaration

    Swift

    public class UnbluNotificationCenterDelegate : NSObject, UNUserNotificationCenterDelegate
  • Basic implementation of UIApplicationDelegate. It is needed to intercept some application callbacks, which are not available through some other api (e.g. NotificationCenter). Always call the super implementation of the delegate first, before handling the functions by your own.

    Do not use this delegate if you do NOT want to use Firebase Cloud Messaging (FCM).

    See more

    Declaration

    Swift

    @objc
    open class UnbluUiApplicationDelegate : UIResponder, UIApplicationDelegate, MessagingDelegate
  • Information about a person

    See more

    Declaration

    Swift

    public class PersonInfo
  • Button to control the visibility of the unblu UI. While the UI is visible, the superview of this button is overlayed with a semi transparent overlay. When the overlay or the button is pressed, the UI will close again.

    If there are new messages and the ui is not displayed, the button displays a badge in its upper right corner with the number of unread messages.

    This button is visible as soon as the unblu visitor/agent api is initialized.

    The button can be used programmatically or via the interface builder (create a view and set its class to UnbluUiButton).

    The button can be placed automatically or absolute. If it is constructed with only a size or empty constructor, it places itself into the lower right corner of its superview.

    See more

    Declaration

    Swift

    @IBDesignable
    @objc
    open class UnbluUiButton : UIControl