Skip to content

[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

Merged

Conversation

andremion
Copy link
Contributor

@andremion andremion commented May 21, 2025

🎯 Goal

Introduce the member info modal bottom sheet with member information and available options:

  • Ban/Unban
  • Remove from group

🛠 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 to ChannelInfoMemberViewController 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

Phone Tablet
ban_phone.webm
ban_tablet.webm

Remove a member from group

Phone Tablet
remove_phone.webm
remove_tablet.webm

🎉 GIF

gif

@andremion andremion added the compose Jetpack Compose label May 21, 2025
Copy link
Contributor

github-actions bot commented May 21, 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.39 MB 10.41 MB 0.02 MB 🟢
stream-chat-android-compose 12.46 MB 12.51 MB 0.04 MB 🟢

@andremion andremion changed the title [AND-556] Member info flow of the channel info screen [AND-556] Introduce the member info modal sheet of the channel info screen May 23, 2025
@andremion andremion requested a review from Copilot May 23, 2025 12:14
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 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)

@andremion andremion marked this pull request as ready for review May 23, 2025 12:35
@andremion andremion requested a review from a team as a code owner May 23, 2025 12:35
@andremion andremion force-pushed the AND-506-compose-channel-info branch 2 times, most recently from 426fe92 to 3f87ebf Compare May 26, 2025 12:51
@andremion andremion force-pushed the AND-556-compose-members-info-flow-of-the-channel-info-screen branch 3 times, most recently from 0cb07f9 to 24197bc Compare May 27, 2025 09:46
@andremion andremion force-pushed the AND-506-compose-channel-info branch from ee1a608 to d034181 Compare May 27, 2025 14:40
@andremion andremion force-pushed the AND-556-compose-members-info-flow-of-the-channel-info-screen branch 2 times, most recently from f0aa685 to b472933 Compare May 27, 2025 15:08
Base automatically changed from AND-506-compose-channel-info to develop May 28, 2025 07:52
@andremion andremion force-pushed the AND-556-compose-members-info-flow-of-the-channel-info-screen branch from b472933 to 30c14ed Compare May 28, 2025 08:13
andremion added 12 commits May 30, 2025 13:51
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.
andremion added 24 commits May 30, 2025 13:51
- **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.
@andremion andremion force-pushed the AND-556-compose-members-info-flow-of-the-channel-info-screen branch from b2cb345 to c8d360f Compare May 30, 2025 12:52
Copy link

sonarqubecloud bot commented Jun 4, 2025

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarQube Cloud

@andremion andremion merged commit 1b84c15 into develop Jun 4, 2025
12 of 13 checks passed
@andremion andremion deleted the AND-556-compose-members-info-flow-of-the-channel-info-screen branch June 4, 2025 09:34
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