Skip to content

Component factories for channel info screens #5812

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

andremion
Copy link
Contributor

🎯 Goal

Introduce component factories for the channel info screens.

🛠 Implementation details

Introduce the following factories:

  • Factory method for creating the top bar of the channel info screen.
    DirectChannelInfoTopBar

  • Factory method for creating the avatar container in the direct channel info screen.
    DirectChannelInfoAvatarContainer

  • Factory method for creating the top bar of the group channel info screen.
    GroupChannelInfoTopBar

  • Factory method for creating the channel info separator item.
    ChannelInfoSeparatorItem

  • Factory method for creating the channel info option item used in direct and group channel info screens.
    ChannelInfoOptionItem

  • Factory method for creating the member item in the group channel info screen.
    GroupChannelInfoMemberItem

  • Factory method for creating the expand member item in the group channel info screen.
    GroupChannelInfoExpandMemberItem

  • Factory method for creating the channel info screen modal.
    ChannelInfoScreenModal

  • Factory method for creating the top bar of the member info modal sheet in the group channel info screen.
    ChannelInfoMemberInfoModalSheetTopBar

  • Factory method for creating the channel info member option item.
    ChannelInfoMemberOptionItem

🎉 GIF

gif

@andremion andremion requested a review from Copilot June 5, 2025 12:20
@andremion andremion added the compose Jetpack Compose label Jun 5, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds new component factories for channel info screens and refactors existing screens to use these factories and a new CompoundComponentFactory wrapper.

  • Introduces factory methods in ChatComponentFactory for direct and group channel info UI elements.
  • Refactors DirectChannelInfoScreen and GroupChannelInfoScreen to use scaffold/composable wrappers and the new factories.
  • Updates the sample ChatsActivity to use CompoundComponentFactory and renames some extension functions.

Reviewed Changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated no comments.

Show a summary per file
File Description
stream-chat-android-ui-common/src/main/res/values/strings.xml Adds “Group info” string for group channel info title
CompoundComponentFactory.kt New composable to wrap and extend the existing ChatComponentFactory
ChatComponentFactory.kt Adds new factory methods for channel info screen components
ChatsScreen.kt Replaces direct LocalComponentFactory injection with CompoundComponentFactory
GroupChannelInfoScreen.kt Refactors to use ChatComponentFactory methods and scaffolding
DirectChannelInfoScreen.kt Refactors to use ChatComponentFactory methods and scaffolding
ChannelInfoScreenModal.kt Updates modal call to use ChatComponentFactory
ChannelInfoOptionItem.kt, ChannelInfoMemberOptionItem.kt, ChannelInfoMemberInfoModalSheet.kt, ChannelInfoScreenDefaults.kt Renames and scopes component functions to align with factory usage
ChatsActivity.kt (sample) Updates to use remember, CompoundComponentFactory, and renames event handlers
Comments suppressed due to low confidence (5)

stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/chats/ChatsActivity.kt:304

  • [nitpick] Method calls in Kotlin should start with a lowercase letter. Consider renaming OnChannelInfoEvents to onChannelInfoEvents.
viewModel.OnChannelInfoEvents(onNavigateUp, onNavigateToPinnedMessages)

stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/chats/ChatsActivity.kt:393

  • [nitpick] Extension function names should be camelCase starting with lowercase. Rename OnChannelInfoEvents to onChannelInfoEvents to follow Kotlin conventions.
private fun ChannelInfoViewModel.OnChannelInfoEvents(

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channel/info/ChannelInfoMemberInfoModalSheet.kt:136

  • The Member type is not imported in this file, leading to a compilation error. Please add import io.getstream.chat.android.models.Member.
internal fun ChannelInfoMemberInfoModalSheetTopBar(member: Member) {

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt:2892

  • The factory signature takes headerState and listState but doesn’t pass these to the underlying DirectChannelInfoTopBar, so elevation won’t respond to scroll state. Update the underlying composable to accept and use these parameters or adjust the factory signature.
io.getstream.chat.android.compose.ui.channel.info.DirectChannelInfoTopBar(

stream-chat-android-ui-common/src/main/res/values/strings.xml:73

  • [nitpick] Capitalization inconsistency: consider changing the string to Group Info to match title casing used elsewhere (e.g., Channel Info).
<string name="stream_ui_channel_info_group_title">Group info</string>

Copy link
Contributor

github-actions bot commented Jun 5, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 3.16 MB 3.16 MB 0.00 MB 🟢
stream-chat-android-offline 3.38 MB 3.38 MB 0.00 MB 🟢
stream-chat-android-ui-components 10.43 MB 10.43 MB 0.00 MB 🟢
stream-chat-android-compose 12.52 MB 12.53 MB 0.01 MB 🟢

@andremion andremion marked this pull request as ready for review June 5, 2025 13:26
@andremion andremion requested a review from a team as a code owner June 5, 2025 13:26
@andremion andremion force-pushed the AND-507-xml-channel-info-screen branch from e074f06 to 445ff0f Compare June 12, 2025 15:15
@andremion andremion force-pushed the AND-547-Component-factories-for-channel-info-screens branch from 0d223e3 to d355c17 Compare June 12, 2025 15:18
@andremion andremion force-pushed the AND-507-xml-channel-info-screen branch from df3ca5d to a288c89 Compare June 16, 2025 15:32
@andremion andremion force-pushed the AND-547-Component-factories-for-channel-info-screens branch from d355c17 to 6769be3 Compare June 16, 2025 15:43
@andremion andremion force-pushed the AND-507-xml-channel-info-screen branch from a288c89 to 86a90a7 Compare June 17, 2025 08:20
@andremion andremion force-pushed the AND-547-Component-factories-for-channel-info-screens branch from 6769be3 to 1d00ed0 Compare June 17, 2025 08:21
@andremion andremion force-pushed the AND-507-xml-channel-info-screen branch from 86a90a7 to 1c6b3b1 Compare June 17, 2025 09:48
@andremion andremion force-pushed the AND-547-Component-factories-for-channel-info-screens branch from 1d00ed0 to bb1c95d Compare June 17, 2025 09:48
Base automatically changed from AND-507-xml-channel-info-screen to develop June 17, 2025 10:08
@andremion andremion force-pushed the AND-547-Component-factories-for-channel-info-screens branch from bb1c95d to d40cc64 Compare June 17, 2025 10:09
andremion added 13 commits June 18, 2025 13:07
…ing local composition

This commit introduces a public `CompoundComponentFactory` composable function. This function allows users to create a new `ChatComponentFactory` by composing it with the existing one.

This change is useful for:
- Creating custom components.
- Modifying existing components without directly altering the original factory.

The `ChatsActivity` in the sample app and the `ChatsScreen` in the Compose UI library have been updated to utilize this new `CompoundComponentFactory`.
…suppressed in the interface declaration level
The top bars in `DirectChannelInfoScreen` and `GroupChannelInfoScreen` are now separate from the content and are customizable through the `ChatComponentFactory`.

The `DirectChannelInfoTopBar` and `GroupChannelInfoTopBar` in `ChatComponentFactory` now accept a `ChannelHeaderViewState` as a parameter.

The `GroupChannelInfoTopBar` now displays a "Group info" title along with the channel name. This string has been added to `strings.xml`.
@andremion andremion force-pushed the AND-547-Component-factories-for-channel-info-screens branch from d40cc64 to bd9c798 Compare June 18, 2025 12:08
@andremion andremion enabled auto-merge (squash) June 18, 2025 15:09
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
58.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@andremion andremion merged commit 94a2704 into develop Jun 18, 2025
12 of 13 checks passed
@andremion andremion deleted the AND-547-Component-factories-for-channel-info-screens branch June 18, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compose Jetpack Compose
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants