ChatBuilder

interface ChatBuilder

Definition of builder used to create Chat instance.

All options in the builder are now optional, but it is recommended to set either authorization (to the non-default value) or username.

Types

Link copied to clipboard
object Companion
Link copied to clipboard
fun interface OnChatBuiltCallback

Callback allowing to listen to chat instance provisioning.

Link copied to clipboard

Callback allowing to listen to chat instance provisioning.

Functions

Link copied to clipboard

Build an instance of chat asynchronously. Previously this method guaranteed an instance to be returned via callback, this is no longer the case. If there is an communication issue with the server, this method will throw a runtime exception.

Builds an instance of chat asynchronously. Any standard issue which may happen during will be reported as IllegalStateException in Result.onFailure. All failures are logged if setDevelopmentMode is set.

Link copied to clipboard
abstract fun setAuthorization(authorization: Authorization): ChatBuilder

Sets authorization for newly created instance of the chat. It's used in the case where Authorization is enabled in the backend configuration.

Link copied to clipboard

Sets optional ChatStateListener which will be notified about changes to availability of chat functionality. It is highly recommended to supply this listener.

Link copied to clipboard
abstract fun setDevelopmentMode(enabled: Boolean): ChatBuilder

Sets a development mode. This can have various effects throughout the SDK such as verbose logging.

Link copied to clipboard
abstract fun setDeviceToken(token: String): ChatBuilder

Sets optional device token of for purpose of receiving push messages.

Link copied to clipboard
abstract fun setUserName(first: String, last: String): ChatBuilder

Sets a default username. If the username changes invoke this method again and build the new chat to apply the changes. Usually, this should be done with app's lifecycle events automatically. Name is updated with every eligible event, likely will be updated during the authorization step when running build.