Interface UnbluClient
-
- All Known Subinterfaces:
UnbluAgentClient
,UnbluVisitorClient
public interface UnbluClient
Minumum Requirements:
Android API version 24
Collaboration server 6.33.x or newer.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
deinitClient(SuccessVoidCallback success, DeinitializeExceptionCallback failure)
Deinitializes the UnbluClient.ICustomLoadingViewCreator
getCustomLoadingViewCreator()
Returns the currently configured loading view creatorandroid.view.View
getMainView()
Returns the Unblu UI component to interact with (Chat, Calls, Video, Co-Browsing) as aView
UnbluNotificationApi
getNotificationApi()
Returns the low level notification API which can be used if the Unblu firebase notification module is not used.io.reactivex.rxjava3.core.Observable<java.util.Optional<UnbluConversation>>
getOpenConversation()
Get the current open conversation as an observable.UnbluConversation
getOpenConversationValue()
Get the current open conversationPersonInfo
getPersonInfo()
Returns the information of the current person.int
getUnreadMessagesCount()
Returns the number of unread messagesio.reactivex.rxjava3.core.Observable<java.lang.Boolean>
isCallUiOpen()
Fired when the call ui is opened or closed.void
isCallUiOpen(SuccessCallback<java.lang.Boolean> success, NotInitializedExceptionCallback failure)
Checks if the call UI for an audio/video call is open or not.boolean
isDeInitialized()
Used to check if a UnbluClient instance is currently deInitializedboolean
isInErrorState()
io.reactivex.rxjava3.core.Observable<java.util.Optional<java.lang.Void>>
onApiDeInitialized()
Fired when the UnbluClient is deInitialized.io.reactivex.rxjava3.core.Observable<UnbluCustomConversationActionInvocation>
onCustomConversationActionInvocationReceived()
This method is responsible for handling the invocation of custom actions related to a conversation.io.reactivex.rxjava3.core.Observable<UnbluMessageCustomActionInvocation>
onMessageCustomActionInvocationReceived()
This method is responsible for handling the invocation of custom actions related to a specific message in a conversation.io.reactivex.rxjava3.core.Observable<java.lang.Long>
onPersonActivityChanged()
Used to check for the UTC timestamp of the last activity by the userio.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.3io.reactivex.rxjava3.core.Observable<UnbluPersonCustomActionInvocation>
onPersonCustomActionInvocationReceived()
This method is responsible for handling the invocation of custom actions related to a person.io.reactivex.rxjava3.core.Observable<java.util.Optional<java.lang.Void>>
onUiPreloaded()
Used to check if a UnbluClient instance is currently deInitializedio.reactivex.rxjava3.core.Observable<java.util.Optional<java.lang.Void>>
onUiReady()
Fired when the UI is ready.io.reactivex.rxjava3.core.Observable<java.lang.Integer>
onUnreadMessagesCount()
Fired when the number of unread messages changes.void
openConversation(java.lang.String conversationId, SuccessVoidCallback success, OpenConversationExceptionCallback failure)
Opens the conversation for the given id.void
openConversationOverview(SuccessVoidCallback success, OpenConversationOverviewExceptionCallback failure)
Opens the overview over all conversations.void
setAccessToken(java.lang.String token)
Set the OAuth 2.0 token to pass to the service worker and add to the HTTP header.void
setApplicationContext(android.app.Application application)
Set the application.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 aBackButtonCallback
configured which handles the back presses by itself.void
setBackButtonCallback(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.void
setBackButtonPressTriggerEvent(BackButtonPressTriggerEvent event)
Defines the event type for back button press triggervoid
setCustomCookies(java.util.Set<UnbluCookie> customCookies)
Sets the given cookies for the configured Unblu base url.void
setCustomLoadingViewCreator(ICustomLoadingViewCreator customLoadingViewCreator)
Sets a custom loading view creator.
-
-
-
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.
-
setCustomCookies
void setCustomCookies(@NonNull java.util.Set<UnbluCookie> customCookies)
Sets the given cookies for the configured Unblu base url.This will set additional cookies and will overwrite existing ones.
To delete a cookie, it must be set with an expired date.
If the instance was already initialized and cookies were already placed, it will overwrite cookies with the same key. Others will not be touched.
All cookies will be removed when
deinitClient(SuccessVoidCallback, DeinitializeExceptionCallback)
was called. Constructors for UnbluCookie:UnbluCookie(String, String, Date)
Factory Methods:
- Parameters:
customCookies
- The cookies which will be send with request to the configured base url.
-
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 aBackButtonCallback
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, ifsetAutoHideUiOnBack(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
-
setBackButtonPressTriggerEvent
void setBackButtonPressTriggerEvent(@NonNull BackButtonPressTriggerEvent event)
Defines the event type for back button press trigger- Parameters:
event
- The event which will be listened for the back button trigger
-
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 notfailure
- 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 openedfailure
- 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 openedfailure
- 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 information of the current person. If you are working with aUnbluVisitorClient
instance, it is recommended to useUnbluVisitorClient.getPersonInfoAsync()
instead. This ensures that there is a value present as due to some internal optimizations, there may not be any value present if e.g. the UI has never been displayed.
-
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
- TheUnbluApplication
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 anInteger
-
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 emitsPersonInfo
-
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.
-
getOpenConversationValue
@Nullable UnbluConversation getOpenConversationValue()
Get the current open conversation- Returns:
UnbluConversation
which is currently 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 emitsBoolean
-
getMainView
android.view.View getMainView()
Returns the Unblu UI component to interact with (Chat, Calls, Video, Co-Browsing) as aView
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
, whenActivity.onDestroy()
is called, this instance will detach itself from the parent. Note: if you attached to a view inside anActivity
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 thegetMainView()
from its parentView
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 FragmentView
gets destroyed, you should callViewGroup.removeView(View)
from mainView's parent. You can achieve this by adding anLifecycleObserver
to theLifecycle
in yourFragment
: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
-
setAccessToken
void setAccessToken(java.lang.String token)
Set the OAuth 2.0 token to pass to the service worker and add to the HTTP header.- Parameters:
token
- The token received from an identity provider
-
onCustomConversationActionInvocationReceived
io.reactivex.rxjava3.core.Observable<UnbluCustomConversationActionInvocation> onCustomConversationActionInvocationReceived()
This method is responsible for handling the invocation of custom actions related to a conversation. It returns an Observable ofUnbluCustomConversationActionInvocation
that emits on each new invocation.- Returns:
- Observable of
UnbluCustomConversationActionInvocation
- The observable stream of custom conversation action invocations. - See Also:
UnbluCustomConversationActionInvocation
-
onPersonCustomActionInvocationReceived
io.reactivex.rxjava3.core.Observable<UnbluPersonCustomActionInvocation> onPersonCustomActionInvocationReceived()
This method is responsible for handling the invocation of custom actions related to a person. It returns an Observable ofUnbluPersonCustomActionInvocation
that emits on each new invocation.- Returns:
- Observable of
UnbluPersonCustomActionInvocation
- The observable stream of custom person action invocations. - See Also:
UnbluPersonCustomActionInvocation
-
onMessageCustomActionInvocationReceived
io.reactivex.rxjava3.core.Observable<UnbluMessageCustomActionInvocation> onMessageCustomActionInvocationReceived()
This method is responsible for handling the invocation of custom actions related to a specific message in a conversation. It returns an Observable ofUnbluMessageCustomActionInvocation
that emits on each new invocation.- Returns:
- Observable of
UnbluMessageCustomActionInvocation
- The observable stream of custom message action invocations.. - See Also:
UnbluMessageCustomActionInvocation
-
-