diff --git a/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/MessagesActivity.kt b/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/MessagesActivity.kt index 821ac957002..fe30e3672b2 100644 --- a/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/MessagesActivity.kt +++ b/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/MessagesActivity.kt @@ -29,7 +29,7 @@ import io.getstream.chat.android.compose.sample.data.customSettings import io.getstream.chat.android.compose.sample.feature.channel.isGroupChannel import io.getstream.chat.android.compose.sample.ui.channel.DirectChannelInfoActivity import io.getstream.chat.android.compose.sample.ui.channel.GroupChannelInfoActivity -import io.getstream.chat.android.compose.sample.ui.component.CustomChatComponentFactory +import io.getstream.chat.android.compose.sample.ui.location.LocationComponentFactory import io.getstream.chat.android.compose.sample.vm.SharedLocationViewModelFactory import io.getstream.chat.android.compose.ui.messages.ChannelScreen import io.getstream.chat.android.compose.ui.theme.AttachmentPickerConfig @@ -75,7 +75,7 @@ class MessagesActivity : ComponentActivity() { private fun SetupChatTheme() { val locationViewModelFactory = SharedLocationViewModelFactory(cid) SampleChatTheme( - componentFactory = CustomChatComponentFactory(locationViewModelFactory = locationViewModelFactory), + componentFactory = LocationComponentFactory(locationViewModelFactory = locationViewModelFactory), config = ChatUiConfig( composer = ComposerConfig( linkPreviewEnabled = ChatApp.isComposerLinkPreviewEnabled, diff --git a/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/SampleChatTheme.kt b/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/SampleChatTheme.kt index e9a62bbcc1a..1e12774cf0e 100644 --- a/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/SampleChatTheme.kt +++ b/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/SampleChatTheme.kt @@ -25,7 +25,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.testTagsAsResourceId import io.getstream.chat.android.compose.sample.ChatApp -import io.getstream.chat.android.compose.sample.ui.component.CustomChatComponentFactory import io.getstream.chat.android.compose.ui.theme.ChannelOptionsTheme import io.getstream.chat.android.compose.ui.theme.ChatComponentFactory import io.getstream.chat.android.compose.ui.theme.ChatTheme @@ -33,12 +32,12 @@ import io.getstream.chat.android.compose.ui.theme.ChatUiConfig /** * Sample app wrapper around [ChatTheme] that enables test tags as resource IDs for UIAutomator - * E2E tests and sets [ChatApp.dateFormatter] and [CustomChatComponentFactory] as defaults. + * E2E tests and sets [ChatApp.dateFormatter] as defaults. */ @Composable internal fun SampleChatTheme( config: ChatUiConfig = ChatUiConfig(), - componentFactory: ChatComponentFactory = CustomChatComponentFactory(), + componentFactory: ChatComponentFactory = object : ChatComponentFactory {}, channelOptionsTheme: ChannelOptionsTheme = ChannelOptionsTheme.defaultTheme(), content: @Composable () -> Unit, ) { diff --git a/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/component/CustomChatComponentFactory.kt b/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/component/CustomChatComponentFactory.kt deleted file mode 100644 index efc409cd68e..00000000000 --- a/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/component/CustomChatComponentFactory.kt +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2014-2026 Stream.io Inc. All rights reserved. - * - * Licensed under the Stream License; - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://github.com/GetStream/stream-chat-android/blob/main/LICENSE - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.getstream.chat.android.compose.sample.ui.component - -import androidx.compose.foundation.lazy.LazyItemScope -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import io.getstream.chat.android.compose.sample.ui.location.LocationComponentFactory -import io.getstream.chat.android.compose.sample.vm.SharedLocationViewModelFactory -import io.getstream.chat.android.compose.ui.channels.list.ChannelItem -import io.getstream.chat.android.compose.ui.channels.list.LocalSwipeRevealCoordinator -import io.getstream.chat.android.compose.ui.channels.list.SwipeableChannelItem -import io.getstream.chat.android.compose.ui.theme.ChannelListItemContentParams -import io.getstream.chat.android.compose.ui.theme.ChannelSwipeActionsParams -import io.getstream.chat.android.compose.ui.theme.ChatComponentFactory -import io.getstream.chat.android.compose.ui.theme.ChatTheme - -class CustomChatComponentFactory( - private val locationViewModelFactory: SharedLocationViewModelFactory? = null, - private val delegate: ChatComponentFactory = LocationComponentFactory(locationViewModelFactory), -) : ChatComponentFactory by delegate { - - @Composable - override fun LazyItemScope.ChannelListItemContent(params: ChannelListItemContentParams) { - val coordinator = LocalSwipeRevealCoordinator.current - val swipeEnabled = ChatTheme.config.channelList.swipeActionsEnabled && coordinator != null - - if (swipeEnabled) { - SwipeableChannelItem( - modifier = Modifier.animateItem(), - channelCid = params.channelItem.channel.cid, - backgroundColor = ChatTheme.colors.backgroundCoreApp, - swipeActions = { ChannelSwipeActions(ChannelSwipeActionsParams(params.channelItem)) }, - ) { - ChannelItem( - channelItem = params.channelItem, - currentUser = params.currentUser, - onChannelClick = params.onChannelClick, - onChannelLongClick = params.onChannelLongClick, - ) - } - } else { - ChannelItem( - modifier = Modifier.animateItem(), - channelItem = params.channelItem, - currentUser = params.currentUser, - onChannelClick = params.onChannelClick, - onChannelLongClick = params.onChannelLongClick, - ) - } - } -}