-
Notifications
You must be signed in to change notification settings - Fork 298
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
Component factories for channel info screens #5812
Conversation
There was a problem hiding this 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
andGroupChannelInfoScreen
to use scaffold/composable wrappers and the new factories. - Updates the sample
ChatsActivity
to useCompoundComponentFactory
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
toonChannelInfoEvents
.
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
toonChannelInfoEvents
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 addimport 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
andlistState
but doesn’t pass these to the underlyingDirectChannelInfoTopBar
, 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>
SDK Size Comparison 📏
|
e074f06
to
445ff0f
Compare
0d223e3
to
d355c17
Compare
df3ca5d
to
a288c89
Compare
d355c17
to
6769be3
Compare
a288c89
to
86a90a7
Compare
6769be3
to
1d00ed0
Compare
86a90a7
to
1c6b3b1
Compare
1d00ed0
to
bb1c95d
Compare
bb1c95d
to
d40cc64
Compare
...in/java/io/getstream/chat/android/compose/ui/channel/info/ChannelInfoMemberInfoModalSheet.kt
Outdated
Show resolved
Hide resolved
...e/src/main/java/io/getstream/chat/android/compose/ui/channel/info/DirectChannelInfoScreen.kt
Outdated
Show resolved
Hide resolved
...oid-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt
Show resolved
Hide resolved
...oid-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt
Outdated
Show resolved
Hide resolved
...tream.chat.android.compose.ui.channel.info_GroupChannelInfoContentTest_collapsed_members.png
Outdated
Show resolved
Hide resolved
…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`.
d40cc64
to
bd9c798
Compare
|
🎯 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