Class UnbluClientConfiguration.Builder

  • Enclosing class:
    UnbluClientConfiguration

    public static final class UnbluClientConfiguration.Builder
    extends java.lang.Object
    • Constructor Detail

      • Builder

        public Builder​(@NonNull
                       UnbluClientConfiguration unbluClientConfiguration)
        Constructs an API configuration. The configuration is an immutable instance of UnbluClientConfiguration.
        Parameters:
        unbluClientConfiguration - The current UnbluConfiguration object
      • Builder

        public Builder​(@NonNull
                       java.lang.String unbluBaseUrl,
                       @NonNull
                       java.lang.String apiKey,
                       @NonNull
                       UnbluPreferencesStorage preferencesStorage,
                       @NonNull
                       UnbluDownloadHandler downloadHandler,
                       UnbluExternalLinkHandler externalLinkHandler)
        Constructs an API configuration. The configuration is an immutable instance of UnbluClientConfiguration.

        The default implementations can be used for the UnbluPreferencesStorage, the UnbluDownloadHandler, and the UnbluExternalLinkHandler.

        Parameters:
        unbluBaseUrl - The URL to the Unblu server. (base URL: http(s)://domain:port)
        apiKey - The Unblu API key you want to use for your mobile application
        preferencesStorage - The storage implementation to save and retrieve preferences of the SDK
        downloadHandler - The download handler implementation to handle file downloads
        externalLinkHandler - The link handler used by Unblu to determine what action to take when an external link is tapped in a conversation.
    • Method Detail

      • setUnbluBaseUrl

        public UnbluClientConfiguration.Builder setUnbluBaseUrl​(@NonNull
                                                                java.lang.String unbluBaseUrl)
        Sets the base URL of the Unblu server (http(s)://domain:port)
      • setApiKey

        public UnbluClientConfiguration.Builder setApiKey​(@NonNull
                                                          java.lang.String apiKey)
        Sets the Unblu API key within this Builder instance.
        Parameters:
        apiKey - The Unblu API key you want to use for your mobile application
        Returns:
        The configuration to chain multiple calls
      • setInternalUrlPatternWhitelist

        public UnbluClientConfiguration.Builder setInternalUrlPatternWhitelist​(@NonNull
                                                                               java.util.List<java.util.regex.Pattern> internalUrlPatternWhitelist)
        Sets the list of URL patterns that may be accessed by the WebView.

        The pattern whitelist restricts access to:

        • URLs loaded in the WebView
        • all assets (CSS, JS, images and so on)
        • AJAX requests

        The baseURL of the configuration is automatically added to the list.

        The list is mainly required if you use redirects from the initial base URL to a different domain, or if you load resources such web fonts from other locations, for example Google Fonts.

        Parameters:
        internalUrlPatternWhitelist - A list of URL patterns which may be accessed by the WebView
        Returns:
        The configuration to chain multiple calls
      • setUnbluExternalLinkHandler

        public UnbluClientConfiguration.Builder setUnbluExternalLinkHandler​(@NonNull
                                                                            UnbluExternalLinkHandler externalLinkPatternWhitelist)
        Sets the list of link patterns that may be opened in the system browser. This determines what action to take when a user taps on an external link in a chat.

        The following patterns are added by default:

        • ^\Qhttps://\E.*
        • ^\Qmailto://\E.*
        • ^\Qtel:\E.*
        Calling this function overrides the default patterns.

        If a link doesn't match any of the patterns above, tapping it has no effect.

        Parameters:
        externalLinkPatternWhitelist - A list of URL patterns which may be opened in the system browser
        Returns:
        The configuration to chain multiple calls
      • setEntryPath

        public UnbluClientConfiguration.Builder setEntryPath​(@Nullable
                                                             java.lang.String entryPath)
        Sets the Unblu entry path to connect to the Unblu server. The default is null, which will use the entry paths "/unblu" and "/app" for the visitor and agent clients, respectively.
        Remember to include a leading slash!
        Parameters:
        entryPath - The entry path used to connect to the Unblu server The default values are "/unblu" (for visitor clients) and "/app" (for agent clients).
        Returns:
        The configuration to chain multiple calls
      • setCustomCookies

        public UnbluClientConfiguration.Builder setCustomCookies​(@NonNull
                                                                 java.util.Set<UnbluCookie> customCookies)
        Configures a Set of cookies which will be set on the configured base URL. The SDK only stores a copy of the given Set.
        Parameters:
        customCookies - The cookies to set on the configured base URL
        Returns:
        The configuration to chain multiple calls
      • setLanguage

        public UnbluClientConfiguration.Builder setLanguage​(@Nullable
                                                            java.lang.String language)
        Sets the language to send to the Unblu server. This defines the language used within the UI. If no language is defined explicitly, the system language of the device is used.
        Parameters:
        language - The language to send to the Unblu server
        Returns:
        The configuration to chain multiple calls
      • setNamedArea

        public UnbluClientConfiguration.Builder setNamedArea​(@Nullable
                                                             java.lang.String namedArea)
        Sets the named area for which the configuration is loaded when the API is initializing. When sessions are started and subsequently put into the queue on the Agent Desk, they can be filtered by the defined named area. The named area must be configured in the Unblu Account Configuration interface.

        You can change the named area after initializing the API by calling UnbluVisitorClient.setNamedArea(String).

        Parameters:
        namedArea - The meta-tag ID of the named area, as configured in the Unblu Account Configuration interface
        Returns:
        The configuration to chain multiple calls
      • setNotificationsEnabled

        public UnbluClientConfiguration.Builder setNotificationsEnabled​(boolean notificationsEnabled)
        Enables or disables notifications via Unblu. By default notifications are enabled.
        Parameters:
        notificationsEnabled - If true, notifications are enabled, otherwise they're disabled.
        Returns:
        The configuration to chain multiple calls
      • setCameraUploadsEnabled

        public UnbluClientConfiguration.Builder setCameraUploadsEnabled​(boolean cameraUploadsEnabled)
        Enables or disables direct uploads from the camera app. This has the same effect as enabling both photo uploads and video uploads. By default, direct uploads are enabled.
        The images captured via the camera app are stored in a temporary file inside the external storage folder, where they may be accessed by other apps with the permission Manifest.permission.READ_EXTERNAL_STORAGE.

        This will set both setVideoUploadsEnabled(boolean) and setPhotoUploadsEnabled(boolean) to the specified value.

        Parameters:
        cameraUploadsEnabled - If set to true, uploads directly via the camera app are enabled.
        Returns:
        The configuration to chain multiple calls
      • setVideoUploadsEnabled

        public UnbluClientConfiguration.Builder setVideoUploadsEnabled​(boolean videoUploadsEnabled)
        Enables or disables direct video uploads from the camera app. By default, they're enabled.
        The videos captured are stored in a temporary file inside the external storage folder, where they may be accessed by other apps with the permission Manifest.permission.READ_EXTERNAL_STORAGE.
        Parameters:
        videoUploadsEnabled - If set to true, video uploads directly via the camera app are enabled.
        Returns:
        The configuration to chain multiple calls
      • setAudioUploadsEnabled

        public UnbluClientConfiguration.Builder setAudioUploadsEnabled​(boolean audioUploadsEnabled)
        Enables or disables direct audio uploads from the app. By default, they're enabled.

        Note: For audio uploads to work, the device where the app is installed must have an app that handles the action MediaStore.Audio.Media.RECORD_SOUND_ACTION to perform and deliver the recording.

        Parameters:
        audioUploadsEnabled - If set to true, direct audio uploads are enabled.
        Returns:
        The configuration to chain multiple calls
      • setPhotoUploadsEnabled

        public UnbluClientConfiguration.Builder setPhotoUploadsEnabled​(boolean photoUploadsEnabled)
        Enables or disables direct photo uploads from the camera app. By default, they're enabled.
        The images captured via the camera app are stored in a temporary file in the external storage folder, where they may be accessed by other apps with the permission Manifest.permission.READ_EXTERNAL_STORAGE.
        Parameters:
        photoUploadsEnabled - If set to true, photo uploads directly via the camera app are enabled.
        Returns:
        The configuration to chain multiple calls
      • registerModule

        public UnbluClientConfiguration.Builder registerModule​(@NonNull
                                                               UnbluModule module)
        Registers a module that you want to use in your app, for example, for calls or mobile co-browsing. You must register the modules of features you want to use or they won't work.
        Parameters:
        module - The module to register
        Returns:
        The configuration to chain multiple calls
      • unregisterModule

        public UnbluClientConfiguration.Builder unregisterModule​(@NonNull
                                                                 UnbluModule module)
        Unregisters a module which should no longer be used, for example, for calls or mobile co-browsing.
        Parameters:
        module - The module to unregister
        Returns:
        The configuration to chain multiple calls
      • setNotificationInterceptor

        public UnbluClientConfiguration.Builder setNotificationInterceptor​(NotificationInterceptor notificationInterceptor)
        Specifies a notification interceptor to transform notification before they're displayed.
        Parameters:
        notificationInterceptor - An implementation of NotificationInterceptor that should be used to transform notifications
        Returns:
        The configuration to chain multiple calls
      • setAccessToken

        public UnbluClientConfiguration.Builder setAccessToken​(@NonNull
                                                               java.lang.String accessToken)
        Defines the access token for visitor single sign-on (SSO). It's ignored for agent sessions.
        Parameters:
        accessToken - The string value for the access token. This should be a JSON Web Token.
        Returns:
        The configuration to chain multiple calls
      • setUnbluClientCertRequestData

        public UnbluClientConfiguration.Builder setUnbluClientCertRequestData​(@Nullable
                                                                              UnbluClientCertRequestData unbluClientCertRequestData)
        Defines the UnbluClientCertRequestData data required for a client certificate request in the Unblu SDK.
        Parameters:
        unbluClientCertRequestData - Instance of the data required for a client certificate request in the Unblu SDK
        Returns:
        The configuration; used to chain multiple calls
      • build

        public UnbluClientConfiguration build()
        Generates the immutable UnbluConfiguration instance based on the state of the builder at the time when it's called.