Interface UnbluClient

  • All Known Subinterfaces:
    UnbluAgentClient, UnbluVisitorClient

    public interface UnbluClient

    Minumum Requirements:

    Android API version 24

    Collaboration server 6.33.x or newer.

    • Method Detail

      • deinitClient

        void deinitClient​(@Nullable
                          SuccessVoidCallback success,
                          @Nullable
                          DeinitializeExceptionCallback failure)
        Deinitializes the UnbluClient.

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

        Calling this method will free all resources allocated by the UnbluClient .

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

        Parameters:
        success - Optional callback that will be called once the API has been successfully deinitialized.
        failure - Optional callback that will be called if the deinitialization of the API fails.
      • isInErrorState

        boolean isInErrorState()
        Returns:
        true if the UnbluClient is in error state. false otherwise.
      • setAutoHideUiOnBack

        void setAutoHideUiOnBack​(boolean autoHideUiOnBack)
        If set to true, the Unblu UI will hide automatically if the user presses the back button and there is no more navigation inside the Unblu UI.
        Also this option has no effect if there is a BackButtonCallback configured which handles the back presses by itself.
        Parameters:
        autoHideUiOnBack - True to enabled hiding the UI when back button is pressed, false to disable it
      • setBackButtonCallback

        void setBackButtonCallback​(@Nullable
                                   BackButtonCallback backButtonCallback)
        Defines the callback for back button presses while the Unblu UI is displayed.
        If it is null, the SDK will handle all back button presses itself. In this case it will navigate up inside the webView or, if setAutoHideUiOnBack(boolean) is true, it will hide the UI when the top level of the UI is reached.
        Parameters:
        backButtonCallback - The listener which handles the back button press
      • isCallUiOpen

        void isCallUiOpen​(@NonNull
                          SuccessCallback<java.lang.Boolean> success,
                          @Nullable
                          NotInitializedExceptionCallback failure)
        Checks if the call UI for an audio/video call is open or not. If the call UI is minimized, the result is also false.
        If you need to check if a call is active or not, use the call module api.
        This is an asynchronous call. Use the callbacks to check for success / failure.
        Parameters:
        success - Optional callback that will be called with the result if the UI is open or not
        failure - Optional callback that will be called if the api was not initialized
      • openConversation

        void openConversation​(@NonNull
                              java.lang.String conversationId,
                              @Nullable
                              SuccessVoidCallback success,
                              @Nullable
                              OpenConversationExceptionCallback failure)
        Opens the conversation for the given id.
        Parameters:
        conversationId - The id of the conversation which should be opened.
        success - Called after the conversation was opened
        failure - Called if there was an error opening the conversation
      • openConversationOverview

        void openConversationOverview​(@Nullable
                                      SuccessVoidCallback success,
                                      @Nullable
                                      OpenConversationOverviewExceptionCallback failure)
        Opens the overview over all conversations.
        Parameters:
        success - Called when the overview was opened
        failure - Called if there was an error opening the overview
      • getUnreadMessagesCount

        int getUnreadMessagesCount()
        Returns the number of unread messages
        Returns:
        the number of unread messages
      • getPersonInfo

        @Nullable
        PersonInfo getPersonInfo()
        Returns the info of the current person
        Returns:
        the info of the current person
        Throws:
        java.lang.IllegalStateException - if the API is not initialized
        UnsupportedCollaborationServerVersionException - if the used collaboration server is not of version 5.x newer than 5.17 or newer than 6.3
      • setCustomLoadingViewCreator

        void setCustomLoadingViewCreator​(@Nullable
                                         ICustomLoadingViewCreator customLoadingViewCreator)
        Sets a custom loading view creator.
        Parameters:
        customLoadingViewCreator - The loading view creator which should be used whenever a loading view is displayed
      • getCustomLoadingViewCreator

        @Nullable
        ICustomLoadingViewCreator getCustomLoadingViewCreator()
        Returns the currently configured loading view creator
        Returns:
        the currently configured loadingView creator
      • getNotificationApi

        UnbluNotificationApi getNotificationApi()
        Returns the low level notification API which can be used if the Unblu firebase notification module is not used.
        Returns:
        The notification api instance
      • setApplicationContext

        void setApplicationContext​(@NonNull
                                   android.app.Application application)
        Set the application. This is only for internal purpose
        Parameters:
        application - The UnbluApplication or a class which should inherit it.
      • onUnreadMessagesCount

        io.reactivex.rxjava3.core.Observable<java.lang.Integer> onUnreadMessagesCount()
        Fired when the number of unread messages changes. Also fired if there are no longer unread messages
        Returns:
        Observable which emits an Integer
      • onPersonChanged

        io.reactivex.rxjava3.core.Observable<PersonInfo> onPersonChanged()
        Fired when the current person changes.
        This is only triggered when the used collaboration server is of version newer than 5.17 or newer than 6.3
        Returns:
        Observable which emits PersonInfo
      • getOpenConversation

        io.reactivex.rxjava3.core.Observable<java.util.Optional<UnbluConversation>> getOpenConversation()
        Get the current open conversation as an observable. It will always emit the current conversation. An empty optional will be emitted, if there is no open conversation.
        Returns:
        Observable which emits the open conversation or empty optional if there is none open.
      • isCallUiOpen

        io.reactivex.rxjava3.core.Observable<java.lang.Boolean> isCallUiOpen()
        Fired when the call ui is opened or closed. Closed can be minized or the call ended. Check the instance for callActive to determine if a call is active or not.
        Returns:
        Observable which emits Boolean
      • getMainView

        android.view.View getMainView()
        Returns the Unblu UI component to interact with (Chat, Calls, Video, Co-Browsing) as a View

        This instance should work as any other widget extending View, with the following exception:

        - If the instance is attached to a view inside an Activity, when Activity.onDestroy() is called, this instance will detach itself from the parent. Note: if you attached to a view inside an Activity whose category in the manifest is "android.intent.category.LAUNCHER", you may not always get this behaviour as these categorised activities usually only get destroyed alongside the application instance.

        Otherwise, if you intend to reuse the instance after it was attached to a View, you will need to make sure you first remove the getMainView() from its parent View or you will get the following error:

        IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

        Example: When attaching the mainView inside a Fragment, when eventually the Fragment View gets destroyed, you should call ViewGroup.removeView(View) from mainView's parent. You can achieve this by adding an LifecycleObserver to the Lifecycle in your Fragment:

        lifecycle.addObserver(LifecycleEventObserver { _, event -> if(event.targetState == Lifecycle.State.DESTROYED){ //remove mainView from its parent } })

        Returns:
        the Unblu Ui View instance
      • onApiDeInitialized

        io.reactivex.rxjava3.core.Observable<java.util.Optional<java.lang.Void>> onApiDeInitialized()
        Fired when the UnbluClient is deInitialized. This alerts you that the API cannot be used because it was deinitialized.
        Returns:
        an Observable which emits on deinitialization.
      • onUiReady

        io.reactivex.rxjava3.core.Observable<java.util.Optional<java.lang.Void>> onUiReady()
        Fired when the UI is ready.
        Returns:
        an Observable that emits once, when the UI is preloaded.
      • onUiPreloaded

        io.reactivex.rxjava3.core.Observable<java.util.Optional<java.lang.Void>> onUiPreloaded()
        Used to check if a UnbluClient instance is currently deInitialized
        Returns:
        true if the instance is deInitialized
      • isDeInitialized

        boolean isDeInitialized()
        Used to check if a UnbluClient instance is currently deInitialized
        Returns:
        if the instance is deInitialized
      • onPersonActivityChanged

        io.reactivex.rxjava3.core.Observable<java.lang.Long> onPersonActivityChanged()
        Used to check for the UTC timestamp of the last activity by the user
        Returns:
        an Observable that will emit the last activity timestamp