UnbluCoreApi

@objc
open class UnbluCoreApi : 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)
}
  • Enables the debug output of the Unblu SDK. This contains additional information on log messages and is independent of the log level defined with logLevel.

    Declaration

    Swift

    public static var enableDebugOutput: Bool
  • Enables logging of capturing performance (e.g. FPS)

    IMPORTANT: This only has effect, if enableDebugOutput is set to true and the log level is set to debug via logLevel!

    Declaration

    Swift

    public static var enableCapturingPerformanceLogging: Bool
  • Defines the log level of the Unblu SDK. All messages with a lower level will not be logged.

    Default value is LogLevel.info

    Declaration

    Swift

    public static var logLevel: LogLevel
  • Prevents the scrolling of the ui when the keyboard is shown/hidden

    This setting should only be changed, if it does create issues. If it is disabled, the user of the sdk has to take care that the ui container/the webview inside is correctly resize if needed

    Declaration

    Swift

    public static var preventScrollingByKeyboard: Bool
  • The time used for the fade in and fade out animation when showing/hiding the ui

    Declaration

    Swift

    public static let ANIMATION_TIME: TimeInterval
  • As the Unblu SDK defines an own UIWindow with a UIViewController, iOS uses this controller to define the StatusBarStyle. There is no proper way of checking for the real active UIViewController from which this value should be taken. Therefor it is required to also set the correct StatusBarStyle for the UIViewController inside the SDK.

    Declaration

    Swift

    @objc
    public dynamic var preferredStatusBarStyle: UIStatusBarStyle
  • Configures the unblu api. Use #initializeApi() to be able start new conversation and use other API features.

    Note:

  • This should only be called once with the correct configuration.
  • This method should be called from the application function of the AppDelegate class.

  • configuration: The configuration for the unblu api
  • Throws

    Throws an error if the api was already initialized. The api needs to be deinitialized to configure it.

Declaration

Swift

public func configureApi(configuration: UnbluApiConfiguration) throws

Parameters

configuration

The configuration for the unblu api