Skip to main content
Version: 5.21.0

Migration

Migrating to 5.x from 4.x

In version 5.0, the SDK interface has changed; UI configuration is now done through themes.

  1. The library address and the module package have changed. Module package name: "edna.chatcenter.ui". Library address: "implementation 'edna.chatcenter.ui.android:release:5.X'" for the release version and "implementation 'edna.chatcenter.ui.android:debug:5.1'" for debug
  2. The entire public API has changed: UI settings, other settings. The classes "ChatStyle", "Threads", etc. no longer exist. For more details on integration, see the "Configuration", "Advanced Configuration" sections, as well as the method documentation in the dedicated section

Example of migrating from ChatStyle to the new styling system

For example, in 4.x you have the following ChatStyle configuration

val chatStyle = ChatStyle().apply {
setDefaultFontBold(LATO_BOLD_FONT_PATH)
setDefaultFontLight(LATO_LIGHT_FONT_PATH)
setDefaultFontRegular(LATO_REGULAR_FONT_PATH)
setScrollChatToEndIfUserTyping(false)

//UI
setConsultSearchingProgressColor(R.color.light_toolbar)
setChatBodyIconsTint(R.color.light_toolbar)
enableLinkPreview()
setChatTitleStyle(
R.string.app_name,
R.string.demo_alt_threads_operator_subtitle,
R.color.light_toolbar,
R.color.alt_threads_chat_toolbar_text,
R.color.light_statusbar,
R.bool.alt_threads_chat_is_light_status_bar,
R.color.light_toolbar,
R.color.alt_threads_chat_toolbar_hint,
true
)
setOutgoingMessageBubbleColor(R.color.light_outgoing_bubble)
setScrollDownButtonIcon(R.drawable.alt_threads_scroll_down_icon_light)
setRecordButtonBackgroundColor(R.color.light_toolbar)
setOutgoingMessageTextColor(R.color.black_color)
setOutgoingImageTimeBackgroundColor(R.color.light_outgoing_image_time_background)
setOutgoingMessageTimeColor(R.color.light_outgoing_time_text)
setMessageSendingResources(null, R.color.light_icons)
setMessageSentResources(null, R.color.light_icons)
setMessageDeliveredResources(null, R.color.light_icons)
setMessageReadResources(null, R.color.light_icons)
setMessageFailedResources(null, R.color.light_icons)
setChatHighlightingColor(R.color.light_highlighting)
setIncomingMessageLinkColor(R.color.light_links)
setOutgoingMessageLinkColor(R.color.light_links)
}


In 5.x, this would look as follows:

val ednaTypography = ChatTypography().apply {
defaultFontRegularPath = LATO_BOLD_FONT_PATH
defaultFontLightPath = LATO_LIGHT_FONT_PATH
defaultFontRegularPath = LATO_REGULAR_FONT_PATH
}
val chatConfig = ChatConfig(
transportConfig, // your network configs
networkConfig, // required parameters
autoScrollToLatest = true,
linkPreviewEnabled = true
)
val components = ChatComponents(
applicationContext,
typography = ednaTypography
).apply {
navigationBarStyle = navigationBarStyle.copy(closeButtonEnabled = false)
chatMainComponent.iconsTintColor = R.color.light_icons
}

val flows = ChatFlows(components).apply {
searchFlow.loaderStyle?.tintColor = R.color.white_color
chatFlow.navigationBar.toolbarHeaderText.text?.text = "Edna Chat"
chatFlow.navigationBar.toolbarSubtitleText.text?.text = "Subtitle"
chatFlow.navigationBar.backgroundColor = R.color.blue_color
chatFlow.navigationBar.statusBarColor = R.color.blue_color_dark
chatFlow.outcomeMessages.chatBubble.tintColor = R.color.white_color
chatFlow.outcomeMessages.mainText.textColor = R.color.black_color
chatFlow.outcomeMessages.timeText.backgroundColor = R.color.black_color
chatFlow.outcomeMessages.statusIcons = chatFlow.outcomeMessages.statusIcons?.copy(
messageSendingStatusIcon = R.drawable.ecc_message_sent,
messageSendingStatusColor = R.color.blue_color
// same for other statuses
)
chatFlow.highlightingColor = R.color.light_highlighting
chatFlow.incomeMessages.openGraphLinkText.textColor = R.color.light_links
chatFlow.outcomeMessages.openGraphLinkText.textColor = R.color.dark_links
chatFlow.scrollDownButton.tintColor = R.color.gray_color
chatFlow.inputView.voiceButton.style.backgroundColor = R.color.white_color
}