-
Notifications
You must be signed in to change notification settings - Fork 295
[AND-556] Introduce the member info modal sheet of the channel info screen #5785
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
[AND-556] Introduce the member info modal sheet of the channel info screen #5785
Conversation
SDK Size Comparison 📏
|
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 pull request introduces a member info modal sheet for the channel info screen, adding new events and actions for member-related interactions (such as messaging, banning, unbanning, and removing members) and integrating them into the Compose UI.
- Added new sealed interfaces and data classes for channel member view events and actions.
- Updated view controllers, view models, and Compose UI screens (with associated previews and tests) to support member info modals.
Reviewed Changes
Copilot reviewed 53 out of 53 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
ChannelInfoMemberViewEvent.kt | Added new events representing member actions (message, ban, unban, remove). |
ChannelInfoMemberViewController.kt | Introduced a new view controller to emit events from member actions and integrated a placeholder for messaging. |
ChannelInfoMemberViewAction.kt | Added new sealed actions for member interactions. |
Compose UI files & Tests | Updated Compose screens, previews, and tests to integrate modal behavior for member info along with dark mode support. |
ViewModel and Factory Classes | Added support for handling member view events in the view models and updated documentation accordingly. |
Comments suppressed due to low confidence (1)
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channel/info/ChannelInfoMemberInfoModalSheet.kt:195
- [nitpick] The preview helper function overload that accepts a Boolean flag 'banned' can be confusing. Consider renaming it (e.g., to 'ChannelInfoMemberInfoModalSheetContentPreview') to better convey its purpose and improve code clarity.
ChannelInfoMemberInfoModalSheetContent(banned = true)
.../io/getstream/chat/android/ui/common/feature/channel/info/ChannelInfoMemberViewController.kt
Show resolved
Hide resolved
426fe92
to
3f87ebf
Compare
0cb07f9
to
24197bc
Compare
ee1a608
to
d034181
Compare
f0aa685
to
b472933
Compare
b472933
to
30c14ed
Compare
...main/kotlin/io/getstream/chat/android/ui/common/feature/channel/info/ChannelInfoViewEvent.kt
Show resolved
Hide resolved
...kotlin/io/getstream/chat/android/ui/common/feature/channel/info/ChannelInfoViewController.kt
Outdated
Show resolved
Hide resolved
.../io/getstream/chat/android/ui/common/feature/channel/info/ChannelInfoMemberViewController.kt
Show resolved
Hide resolved
.../kotlin/io/getstream/chat/android/ui/common/state/channel/info/ChannelInfoMemberViewState.kt
Show resolved
Hide resolved
.../kotlin/io/getstream/chat/android/ui/common/state/channel/info/ChannelInfoMemberViewState.kt
Outdated
Show resolved
Hide resolved
...otlin/io/getstream/chat/android/ui/common/feature/channel/info/ChannelInfoMemberViewEvent.kt
Show resolved
Hide resolved
...at.android.compose.ui.channel.info_ChannelInfoMemberInfoModalSheetTest_not_banned_member.png
Outdated
Show resolved
Hide resolved
...in/java/io/getstream/chat/android/compose/ui/channel/info/ChannelInfoMemberInfoModalSheet.kt
Outdated
Show resolved
Hide resolved
This commit introduces a new composable `ChannelInfoMemberInfo` to display user avatar, name, and last seen status. It also adds a new modal for displaying member information when a member is clicked in the group channel info screen. - Created `ChannelInfoMemberInfo.kt` with the new composable. - Integrated `ChannelInfoMemberInfo` into `DirectChannelInfoScreen`. - Added `ChannelInfoViewAction.MemberClick` and `ChannelInfoViewEvent.MemberInfoModal` to handle member click actions and display the new modal. - Implemented the `MemberInfoSheet` composable within `ChannelInfoScreenModal.kt` for the new modal. - Updated `GroupChannelInfoScreen` to trigger the `MemberClick` action. - Added previews for the new modal and updated existing previews.
This commit introduces the ability to perform actions on members within the channel info screen, such as messaging, removing, banning, and unbanning. **Key changes:** - **Added Member Actions:** - `ChannelInfoViewAction`: Introduced new actions for messaging, removing, banning, and unbanning members. - `ChannelInfoViewEvent`: Added corresponding events for member info modals, navigation to channel, and error handling for ban/unban actions. - `ChannelInfoViewState.Content.Option`: Added new options for messaging, removing, banning, and unbanning members. - **UI Updates:** - `ChannelInfoContentOption`: Implemented UI components for the new member actions. - `GroupChannelInfoScreen`: Updated to handle member clicks and display banned members with a visual indicator. - `ChannelInfoScreenModal`: Enhanced to display member-specific options in a bottom sheet. - **Controller Logic:** - `ChannelInfoViewController`: - Stores channel capabilities to determine available member actions. - Implemented logic to handle member clicks and build appropriate option lists based on capabilities. - Added methods for removing, banning, and unbanning members. - **Resources:** - Added new string resources for member action options and error messages. - **Sample App:** - Updated `DirectChannelInfoActivity` and `GroupChannelInfoActivity` to handle new error events related to member actions. - **API:** - Updated the public API surface to reflect the new actions, events, and view state options. - **Snapshots:** - Updated UI snapshots to include the visual changes for banned members.
The `ChannelInfoMemberInfo` component has been updated to include an `avatarAlignment` parameter, which controls the vertical alignment of the user's avatar. This allows for more flexibility in the layout of the component. Additionally, the `ModalBottomSheet` in `ChannelInfoScreenModal` now uses `skipPartiallyExpanded = true` to prevent the bottom sheet from being partially expanded.
…ng interaction with the current user's member item in the member list.
This commit introduces a new bottom sheet for displaying channel member information, along with its associated ViewModel, ViewController, state, event, and action classes. Key changes: - Added `ChannelInfoMemberInfoSheet.kt` to display member information in a modal bottom sheet. - Created `ChannelInfoMemberViewModel.kt` and `ChannelInfoMemberViewModelFactory.kt` to manage the state and logic for the member info sheet. - Implemented `ChannelInfoMemberViewController.kt` to handle business logic and interactions for the member info sheet. - Defined `ChannelInfoMemberViewState.kt`, `ChannelInfoMemberViewEvent.kt`, and `ChannelInfoMemberViewAction.kt` to model the UI state, events, and actions. - Added `ChannelInfoMemberOption.kt` to represent individual options within the member info sheet. - Created `ChannelInfoMemberInfoConfirmationModal.kt` for confirmation dialogs related to member actions. - Updated `ChannelInfoViewController.kt` to include the `cid` in the `MemberInfoModal` event. - Refactored `ChannelInfoScreenModal.kt` to use the new `ChannelInfoMemberInfoSheet`. - Updated ViewModel constructors to include a `controllerProvider` parameter.
- **Ban with Timeout:** Users can now be banned for specific durations (1 hour, 1 day, 1 week) or permanently. - **Ban Confirmation Modal:** A new modal dialog prompts for ban duration selection. - **Ban Expiration Display:** The member info sheet now displays the ban expiration time if applicable. - **UI Refinements:** - Removed `ChannelInfoMemberInfo.kt` and integrated its logic into `ChannelInfoMemberInfoModalSheet.kt` and `DirectChannelInfoScreen.kt`. - Improved layout and text display in `ChannelInfoMemberInfoModalSheet.kt`. - **Testing:** - Updated existing tests to reflect UI and logic changes. - Added new tests for the ban confirmation modal and different ban states. - Renamed `verifyMemberUnbanned` to `verifyMemberNotBanned` for clarity. - **String Resources:** Added new string resources for ban-related messages and options. - **Removed Message Member Option:** Temporarily removed the "Message Member" option from the member info sheet.
- Removed `MessageMember`, `BanMember`, `UnbanMember`, and `RemoveMember` from `ChannelInfoViewState.Content.Option`. - Renamed `ChannelInfoContentOption` to `ChannelInfoChannelOption`. - Updated `ChannelInfoViewController` to no longer handle member-specific actions like messaging, banning, unbanning, or removing members. These actions are now expected to be handled by `ChannelInfoMemberView`. - Removed corresponding tests for these actions from `ChannelInfoViewControllerTest`. - Updated `ChannelInfoViewEvent.MemberInfoModal` to remove the `options` parameter. - Removed `MemberMessageClick`, `BanMemberClick`, `UnbanMemberClick`, and `RemoveMemberClick` from `ChannelInfoViewAction`.
This commit refactors the handling of member action modals (ban, remove) by moving their logic from `ChannelInfoMemberInfoConfirmationModal` to `ChannelInfoScreenModal`. Key changes: - Deleted `ChannelInfoMemberInfoConfirmationModal.kt` and its associated tests. - Modified `ChannelInfoScreenModal` to handle ban and remove member modals, previously managed by the deleted component. This includes adding new preview functions and tests for these modals. - Updated `ChannelInfoViewController` to handle ban and remove member confirmation actions directly and to propagate member view events to channel info view events. - Updated `ChannelInfoMemberViewController` to emit events for member actions (ban, unban, remove) instead of handling them directly. - Renamed `ChannelInfoMemberViewAction.MemberMessageClick` to `MessageMemberClick`. - Updated `ChannelInfoViewModel` to include `onMemberViewEvent` for propagating member events. - Updated relevant screens and activities (`GroupChannelInfoScreen`, `DirectChannelInfoScreen`, `GroupChannelInfoActivity`, `ChatsActivity`) to reflect these changes. - Adjusted string resources and snapshot tests.
- Introduce more specific strings for Channel Info error messages. - Add `_modal_` infix for strings shown inside a modal. - Update samples and Composables to use the new string resources.
- Ensured the modal sheet in `ChannelInfoMemberInfoModalSheet` is dismissed correctly when `onDismiss` is invoked. - Removed unused commented-out code. - Added a TODO for the `MessageMember` action in `ChannelInfoMemberViewController`. - Improved the layout and clickability of the BanMemberModal in `ChannelInfoScreenModal`. - RadioButtons are now correctly part of the clickable row. - Updated snapshot tests for BanMemberModal.
The `LaunchedEffect` in `ChannelInfo` screens and the `ChannelInfoMemberInfoModalSheet` now use the `viewModel` as the key. This ensures that the effect is re-launched when the `viewModel` instance changes, which is important for collecting events correctly. Additionally, the `ChannelInfoMemberInfoModalSheet` now calls `onDismiss` after handling a member view event to ensure the modal is properly dismissed.
The `MessageListHeaderCenterContent` composable function in `ChatComponentFactory` has been deprecated. A new version is introduced that makes the `onClick` parameter optional. This change also updates the `MessageListHeader` and `DefaultMessageListHeaderCenterContent` composables to use the new version of `MessageListHeaderCenterContent`, allowing for a null `onHeaderTitleClick`. The click listener for the header title is now only applied if `onHeaderTitleClick` is not null.
… have distinct ViewModels.
b2cb345
to
c8d360f
Compare
…channel-info-screen
|
🎯 Goal
Introduce the member info modal bottom sheet with member information and available options:
🛠 Implementation details
Introduced the internal
ChannelInfoMemberViewController
and its dependents to manage the view state and events related to the channel member information.ChannelInfoViewController
is still responsible for performing channel operations, such as banning or removing a member.ChannelInfoMemberViewController
's events are propagated toChannelInfoMemberViewController
so it can perform the operation and emit events which can be consumed by the UI to handle navigation or error events.Introduce the internal UI component
ChannelInfoMemberInfoModalSheet
to render channel member information and its available options.Renamed string resources for better semantics.
🎨 UI Changes
Ban/unban a member from the group
ban_phone.webm
ban_tablet.webm
Remove a member from group
remove_phone.webm
remove_tablet.webm
🎉 GIF