Package Restructure

Chat SDK V6 brings some package changes that need to be addressed in order to successfully complete the transition from v5 to v6.

Android Manifest

First of all, let’s look at the AndroidManifest.xml changes. The following changes are required to be made in the AndroidManifest.xml file in case you’ve used the Stream’s classes directly in your manifest:

Was: io.getstream.chat.android.ui.common.ChatUIInitializer
Now: io.getstream.chat.android.ui.initializer.ChatUIInitializer

Was: io.getstream.chat.android.ui.gallery.AttachmentGalleryActivity
Now: io.getstream.chat.android.ui.feature.gallery.AttachmentGalleryActivity

Was: io.getstream.chat.android.ui.gallery.AttachmentMediaActivity
Now: io.getstream.chat.android.ui.feature.gallery.AttachmentMediaActivity

Was: io.getstream.chat.android.ui.gallery.AttachmentActivity
Now: io.getstream.chat.android.ui.feature.gallery.AttachmentActivity

Was: io.getstream.chat.android.ui.channel.ChannelListActivity
Now: io.getstream.chat.android.ui.feature.channels.ChannelListActivity

Was: io.getstream.chat.android.ui.message.MessageListActivity
Now: io.getstream.chat.android.ui.feature.messages.MessageListActivity

// UI Common
Was: com.getstream.sdk.chat.view.activity.AttachmentDocumentActivity
Now: io.getstream.chat.android.ui.common.feature.documents.AttachmentDocumentActivity

View Components

Second of all, any XML layouts that were using the Stream’s classes directly should be updated to use the new package names along with imports in a codebase.

If you forget to update the XML layouts, you may get an error at compile time, something like this:

Type mismatch: inferred type is ChannelListView but
io.getstream.chat.android.ui.feature.channels.list.ChannelListView was expected

Alternatively it may crash at runtime with the error similar to this:

android.view.InflateException: Binary XML file line #58
  in io.getstream.chat.ui.sample.debug:layout/fragment_channels:
    Binary XML file line #58 in io.getstream.chat.ui.sample.debug:layout/fragment_channels:
      Error inflating class io.getstream.chat.android.ui.search.list.SearchResultListView

Here you can find elaborated examples of the changes that are required to be made:

Was: io.getstream.chat.android.ui.avatar.UserAvatarView
Now: io.getstream.chat.android.ui.widgets.avatar.UserAvatarView

Was: io.getstream.chat.android.ui.avatar.ChannelAvatarView
Now: io.getstream.chat.android.ui.widgets.avatar.ChannelAvatarView

Was: io.getstream.chat.android.ui.channel.list.header.ChannelListHeaderView
Now: io.getstream.chat.android.ui.feature.channels.header.ChannelListHeaderView

Was: io.getstream.chat.android.ui.channel.list.ChannelListView
Now: io.getstream.chat.android.ui.feature.channels.list.ChannelListView

Was: io.getstream.chat.android.ui.message.list.header.MessageListHeaderView
Now: io.getstream.chat.android.ui.feature.messages.list.header.MessageListHeaderView

Was: io.getstream.chat.android.ui.message.list.MessageListView
Now: io.getstream.chat.android.ui.feature.messages.list.MessageListView

Was: io.getstream.chat.android.ui.message.composer.MessageComposerView
Now: io.getstream.chat.android.ui.feature.messages.composer.MessageComposerView

Was: io.getstream.chat.android.ui.pinned.list.PinnedMessageListView
Now: io.getstream.chat.android.ui.feature.pinned.list.PinnedMessageListView

Was: io.getstream.chat.android.ui.search.SearchInputView
Now: io.getstream.chat.android.ui.feature.search.SearchInputView

Was: io.getstream.chat.android.ui.search.list.SearchResultListView
Now: io.getstream.chat.android.ui.feature.search.list.SearchResultListView

Was: io.getstream.chat.android.ui.gallery.overview.MediaAttachmentGridView
Now: io.getstream.chat.android.ui.feature.gallery.overview.MediaAttachmentGridView

Was: io.getstream.chat.android.ui.typing.TypingIndicatorView
Now: io.getstream.chat.android.ui.widgets.typing.TypingIndicatorView

Was: io.getstream.chat.android.ui.mention.list.MentionListView
Now: io.getstream.chat.android.ui.feature.mentions.list.MentionListView

Was: io.getstream.chat.android.ui.message.composer.content.DefaultMessageComposer*
Now: io.getstream.chat.android.ui.feature.messages.composer.content.DefaultMessageComposer*

ChatUI customization

Thirdly, you may need to update imports of Stream’s classes in case you’ve used them while customizing ChatUI:

Was: io.getstream.chat.android.ui.common.navigation.ChatNavigator
Now: io.getstream.chat.android.ui.navigation.ChatNavigator

Was: com.getstream.sdk.chat.utils.DateFormatter
Now: io.getstream.chat.android.ui.common.helper.DateFormatter

Was: com.getstream.sdk.chat.images.ImageHeadersProvider
Now: io.getstream.chat.android.ui.common.helper.ImageHeadersProvider

Was: io.getstream.chat.android.ui.common.ChannelNameFormatter
Now: io.getstream.chat.android.ui.helper.ChannelNameFormatter

Was: io.getstream.chat.android.ui.message.composer.attachment.preview.**Now: io.getstream.chat.android.ui.feature.messages.composer.attachment.preview.**

Was: io.getstream.chat.android.ui.message.list.adapter.viewholder.attachment.*
Now: io.getstream.chat.android.ui.feature.messages.list.adapter.viewholder.attachment.*

Was: io.getstream.chat.android.ui.common.style.*
Now: io.getstream.chat.android.ui.font.*

Was: io.getstream.chat.android.ui.transformer.*
Now: io.getstream.chat.android.ui.helper.transformer.*

Was: io.getstream.chat.android.ui.*
Now: io.getstream.chat.android.ui.helper.*

TransformStyle Changes

ImageAttachmentViewStyle was replaced by MediaAttachmentViewStyle.

Next step could be updating imports related to any customizations you might’ve made using TransformStyle:

Was: io.getstream.chat.android.ui.TransformStyle
Now: io.getstream.chat.android.ui.helper.TransformStyle

Was: io.getstream.chat.android.ui.StyleTransformer
Now: io.getstream.chat.android.ui.helper.StyleTransformer

Was: io.getstream.chat.android.ui.avatar.AvatarStyle
Now: io.getstream.chat.android.ui.widgets.avatar.AvatarStyle

Was: io.getstream.chat.android.ui.typing.TypingIndicatorViewStyle
Now: io.getstream.chat.android.ui.widgets.typing.TypingIndicatorViewStyle

Was: io.getstream.chat.android.ui.pinned.list.PinnedMessageListViewStyle
Now: io.getstream.chat.android.ui.feature.pinned.list.PinnedMessageListViewStyle

Was: io.getstream.chat.android.ui.gallery.options.AttachmentGalleryOptionsViewStyle
Now: io.getstream.chat.android.ui.feature.gallery.options.AttachmentGalleryOptionsViewStyle

Was: io.getstream.chat.android.ui.mention.list.MentionListViewStyle
Now: io.getstream.chat.android.ui.feature.mentions.list.MentionListViewStyle

Was: io.getstream.chat.android.ui.message.list.header.MessageListHeaderViewStyle
Now: io.getstream.chat.android.ui.feature.messages.header.MessageListHeaderViewStyle

Was: io.getstream.chat.android.ui.message.preview.MessagePreviewStyle
Now: io.getstream.chat.android.ui.feature.messages.preview.MessagePreviewStyle

Was: io.getstream.chat.android.ui.message.list.**.*Style
Now: io.getstream.chat.android.ui.feature.messages.list.**.*Style

Was: io.getstream.chat.android.ui.message.composer.**.*Style
Now: io.getstream.chat.android.ui.feature.messages.composer.**.*Style

Was: io.getstream.chat.android.ui.channel.list.*ViewStyle
Now: io.getstream.chat.android.ui.feature.channels.**.*ViewStyle

Was: io.getstream.chat.android.ui.search.**.*ViewStyle
Now: io.getstream.chat.android.ui.feature.search.**.*ViewStyle

ViewBinding Changes

In addition, view bindings’ packages were also updated. If you appeared using Stream’s bindings such as MessageListViewModelBinding, ChannelListViewModelBinding and others, you’ll need to update related imports as well:

Was: io.getstream.chat.android.ui.message.composer.viewmodel.bindView
Now: io.getstream.chat.android.ui.viewmodel.messages.bindView

Was: io.getstream.chat.android.ui.message.list.viewmodel.bindView
Now: io.getstream.chat.android.ui.viewmodel.messages.bindView

Was: io.getstream.chat.android.ui.message.list.header.viewmodel.bindView
Now: io.getstream.chat.android.ui.viewmodel.messages.bindView

Was: io.getstream.chat.android.ui.channel.list.viewmodel.bindView
Now: io.getstream.chat.android.ui.viewmodel.channels.bindView

Was: io.getstream.chat.android.ui.search.list.viewmodel.bindView
Now: io.getstream.chat.android.ui.viewmodel.search.bindView

Was: io.getstream.chat.android.ui.channel.list.header.viewmodel.bindView
Now: io.getstream.chat.android.ui.viewmodel.channels.bindView

Was: io.getstream.chat.android.ui.mention.list.viewmodel.bindView
Now: io.getstream.chat.android.ui.viewmodel.mentions.bindView

Was: io.getstream.chat.android.ui.pinned.list.viewmodel.bindView
Now: io.getstream.chat.android.ui.viewmodel.pinned.bindView

Was: io.getstream.chat.android.ui.typing.viewmodel.bindView
Now: io.getstream.chat.android.ui.viewmodel.typing.bindView

ViewModel Changes

In case of using any of Stream’s view models and view model factories you’ll need to update their imports as well:

Was: io.getstream.chat.android.ui.message.composer.viewmodel.MessageComposerViewModel
Now: io.getstream.chat.android.ui.viewmodel.messages.MessageComposerViewModel

Was: io.getstream.chat.android.ui.message.list.viewmodel.factory.MessageListViewModelFactory
Now: io.getstream.chat.android.ui.viewmodel.messages.MessageListViewModelFactory

Was: io.getstream.chat.android.ui.message.list.header.viewmodel.MessageListHeaderViewModel
Now: io.getstream.chat.android.ui.viewmodel.messages.MessageListHeaderViewModel

Was: io.getstream.chat.android.ui.search.list.viewmodel.SearchViewModel
Now: io.getstream.chat.android.ui.viewmodel.search.SearchViewModel

Was: io.getstream.chat.android.ui.mention.list.viewmodel.MentionListViewModel
Now: io.getstream.chat.android.ui.viewmodel.mentions.MentionListViewModel

Was: com.getstream.sdk.chat.viewmodel.messages.**Now: io.getstream.chat.android.ui.viewmodel.messages.**

Was: io.getstream.chat.android.ui.channel.list.viewmodel.**Now: io.getstream.chat.android.ui.viewmodel.channels.**

Was: io.getstream.chat.android.ui.channel.list.header.viewmodel.*
Now: io.getstream.chat.android.ui.viewmodel.channels.*

Was: io.getstream.chat.android.ui.pinned.list.viewmodel.*
Now: io.getstream.chat.android.ui.viewmodel.pinned.*

Was: io.getstream.chat.android.ui.typing.viewmodel.*
Now: io.getstream.chat.android.ui.viewmodel.typing.*

Other Import Changes

Most likely, you won’t need these changes. However, in case your customization was deeper than usual, you might also need to update some other imports, such as:

Was: io.getstream.chat.android.compose.state.messages.MessagesState
Now: io.getstream.chat.android.ui.common.state.messages.list.MessageListState

Was: com.getstream.sdk.chat.adapter.MessageListItem
Now: io.getstream.chat.android.ui.feature.messages.list.adapter.MessageListItem

Was: com.getstream.sdk.chat.view.messages.MessageListItemWrapper
Now: io.getstream.chat.android.ui.model.MessageListItemWrapper

Was: io.getstream.chat.android.ui.common.navigation.ChatNavigator
Now: io.getstream.chat.android.ui.navigation.ChatNavigator

Was: com.getstream.sdk.chat.navigation.destinations.ChatDestination
Now: io.getstream.chat.android.ui.navigation.destinations.ChatDestination

Was: com.getstream.sdk.chat.view.EndlessMessageListScrollListener
Now: io.getstream.chat.android.ui.feature.messages.list.EndlessMessageListScrollListener

Was: com.getstream.sdk.chat.view.EndlessScrollListener
Now: io.getstream.chat.android.ui.widgets.EndlessScrollListener

Was: com.getstream.sdk.chat.utils.GridSpacingItemDecoration
Now: io.getstream.chat.android.ui.widgets.GridSpacingItemDecoration

Was: io.getstream.chat.android.ui.common.navigation.destinations.AttachmentDestination
Now: io.getstream.chat.android.ui.navigation.destinations.AttachmentDestination

Was: io.getstream.chat.android.ui.message.list.background.MessageBackgroundFactory
Now: io.getstream.chat.android.ui.feature.messages.list.background.MessageBackgroundFactory

Was: io.getstream.chat.android.ui.message.list.reactions.view.getUserReactionOrientation
Now: io.getstream.chat.android.ui.feature.messages.list.reactions.view.getUserReactionOrientation

Was: io.getstream.chat.android.ui.common.internal.FullScreenDialogFragment
Now: io.getstream.chat.android.ui.widgets.FullScreenDialogFragment

Was: com.getstream.sdk.chat.utils.Utils
Now: io.getstream.chat.android.ui.common.utils.Utils

Was: io.getstream.chat.android.ui.common.Debouncer
Now: io.getstream.chat.android.ui.utils.Debouncer

Was: io.getstream.chat.android.ui.common.extensions.*
Now: io.getstream.chat.android.ui.utils.extensions.*

Was: com.getstream.sdk.chat.utils.extensions.*
Now: io.getstream.chat.android.ui.utils.extensions.*

Was: io.getstream.chat.android.ui.channel.list.adapter.**Now: io.getstream.chat.android.ui.feature.channels.list.**

Was: io.getstream.chat.android.ui.gallery.*
Now: io.getstream.chat.android.ui.feature.gallery.*

Was: io.getstream.chat.android.ui.message.list.adapter.*
Now: io.getstream.chat.android.ui.feature.messages.list.adapter.*

Was: io.getstream.chat.android.ui.message.list.options.message.*
Now: io.getstream.chat.android.ui.feature.messages.list.options.message.*

Was: io.getstream.chat.android.ui.message.composer.**Now: io.getstream.chat.android.ui.feature.messages.composer.**

Was: io.getstream.chat.android.ui.avatar.*
Now: io.getstream.chat.android.ui.widgets.avatar.*
© Getstream.io, Inc. All Rights Reserved.