UnbluClient

public protocol UnbluClient : AnyObject

A protocol describing functionality of the UnbluClient.

  • The view into which Unblu content will be rendered.

    Declaration

    Swift

    var view: UnbluView { get }
  • 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

    var enableDebugOutput: Bool { get set }
  • Defines the log level of the Unblu SDK. Messages with a lower level will not be logged.

    The default value is LogLevel.info.

    Declaration

    Swift

    var logLevel: LogLevel { get set }
  • Stops the UI from scrolling when the keyboard is shown or hidden.

    This setting should only be changed if it causes issues. If it is disabled, the user of the SDK has to ensure that the UI container/the webview inside is resized correctly when necessary.

    Declaration

    Swift

    var preventScrollingByKeyboard: Bool { get set }
  • Custom loading view creator used whenever a loading view is displayed.

    Declaration

    Swift

    var customLoadingViewCreator: UnbluCustomLoadingViewCreator? { get set }
  • Sets or updates the named area. This can be done independently of the state of the client, but it has a different effect depending on the current client state.

    • If the client has not been started when you set the named area, the configuration of the named area is loaded as soon as the client is started.
    • If you set the named area and the client has already been started, it can only be used on the Agent Desk to filter incoming requests in the queue. No specific configuration will be loaded for the named area.
    • If a conversation is already open, setting the named area has no effect until one of two events occur:
      • The UnbluClient is started again, which loads the configuration of the named area.
      • A new conversation is started, which results in the queue being filtered by the newly set named area

    Declaration

    Swift

    var namedArea: String? { get set }
  • Sets or updates custom cookies. When set, the UnbluCookie objects are passed to the Unblu WebView, which then uses them in future network requests. This can be done independently of the client’s current state. If the client has already been started, setting customCookies overwrites any existing cookies with the same key in the WebView. The other cookies are not affected. Cookies set here will be used by the WebView whether it’s waiting to be started or already running.

    Declaration

    Swift

    var customCookies: Set<UnbluCookie> { get set }
  • The current displayed UnbluConversation, or nil if there is no conversation currently displayed.

    Declaration

    Swift

    var openConversation: UnbluConversation? { get }
  • The current unread messages count

    Declaration

    Swift

    var unreadMessagesCount: Int { get }
  • Initializes the Unblu client.

    Connects to the unblu server and makes the API ready for further calls.

    This is an asynchronous call. Any further calls can be made in the success callback or after receiving the ApiIsInitialized notification.

    Subsequent calls without deinitialization beforehand will be ignored. The callbacks, however, will be triggered as soon as there is a Result.

    Declaration

    Swift

    func start(_ completion: @escaping (Result<Void, UnbluClientInitializeError>) -> Void)

    Parameters

    completion

    The callback that will be called with a Result type once the client has been initialized successfully, or with an UnbluApiInitializeError if initialization failed.

  • Deinitializes the Unblu client.

    Calling this method will free all resources allocated to the Unblu client.

    This is an asynchronous call. Use the callback to check for success or failure.

    Consecutive calls (without initializing inbetween) will be ignored, but the callback will also be triggered, as soon as there is a result.

    Declaration

    Swift

    func stop(_ completion: ((Result<Void, UnbluDeinitializeError>) -> Void)?)

    Parameters

    completion

    completion: The (optional) callback that will be called with a Result type once the Unblu client has been deinitialized successfully, or with an UnbluApiDeinitializeError if deinitialization failed.

  • Returns true if the Unblu client was initialized and the initialization was successful, and false if the Unblu client is not initialized or is in an error state.

    This is an asynchronous call. Use the callbacks to check for success or failure.

    Declaration

    Swift

    func isInitialized(success: @escaping (Bool) -> Void)

    Parameters

    success

    The callback called with true if the Unblu client is initialized and with false otherwise.

  • Returns true if the client is in error state, and false otherwise.

    This is an asynchronous call. Use the callbacks to check for success or failure.

    Declaration

    Swift

    func isInErrorState(success: @escaping (Bool) -> Void)

    Parameters

    success

    The callback called with true if the Unblu client is in an error state and with false otherwise.

  • Opens and displays a conversation with the given ID in the UnbluView.

    Declaration

    Swift

    func openConversation(_ conversationId: String, onComplete: @escaping (Result<UnbluConversation, UnbluOpenConversationError>) -> Void)

    Parameters

    conversationId

    The ID of the conversation to open.

    onComplete

    A Result containing the UnbluConversation that was opened, or an UnbluApiOpenConversationError if opening failed.

  • Opens the conversation overview.

    Declaration

    Swift

    func openConversationOverview(onComplete: @escaping (Result<Void, UnbluOpenConversationOverviewError>) -> Void)

    Parameters

    onComplete

    A Result representing success if the conversation overview was opened, or an UnbluApiOpenConversationOverviewError if opening the overview failed.

  • Returns the information on the person currently interacting with the Unblu client.

    Declaration

    Swift

    func getPersonInfo(onComplete: @escaping (Result<PersonInfo, UnbluRetrievePersonInfoError>) -> Void)

    Parameters

    onComplete

    A Result containing the current PersonInfo of the person currently identified, or an UnbluApiRetrievePersonInfoError if retrieving the person’s information failed.

Convenience methods

  • stop() Extension method

    Undocumented

    Declaration

    Swift

    func stop()