-
Notifications
You must be signed in to change notification settings - Fork 295
Message members from the member bottom sheet of channel info screen #5797
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
base: develop
Are you sure you want to change the base?
Message members from the member bottom sheet of channel info screen #5797
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 messaging functionality from the member modal sheet on the channel info screen. Key changes include new tests for handling member message events (with and without distinct channels), updates to view events and controllers to support direct channel creation/navigation, and adjustments to UI layout in compose screens and sample activities to facilitate the new behavior.
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
stream-chat-android-ui-common/src/test/kotlin/io/getstream/chat/android/ui/common/feature/channel/info/ChannelInfoViewControllerTest.kt | Added tests to verify message member events, covering distinct and non-distinct channel scenarios. |
stream-chat-android-ui-common/src/test/kotlin/io/getstream/chat/android/ui/common/feature/channel/info/ChannelInfoMemberViewControllerTest.kt | Modified tests to check the updated MessageMember event with member and distinct channel properties. |
stream-chat-android-ui-common/src/main/res/values/strings.xml | Introduced a new error string for direct channel creation failures. |
stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/channel/info/ChannelInfoViewEvent.kt | Added NavigateToChannel event and a NewDirectChannelError to better indicate messaging navigation outcomes. |
stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/channel/info/ChannelInfoViewController.kt | Updated onMemberViewEvent to conditionally create a direct channel if no distinct channel is provided, ensuring proper message navigation. |
stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/channel/info/ChannelInfoMemberViewEvent.kt | Updated the MessageMember event to use memberId and distinctCid for clearer messaging intent. |
stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/channel/info/ChannelInfoMemberViewController.kt | Refactored state management to query for distinct channels and update options accordingly. |
stream-chat-android-compose/... | Adjusted mandatory UI modifiers and navigation parameters in compose screens and sample activities for improved layout and navigation handling. |
SDK Size Comparison 📏
|
ca9cbd2
to
df73b7c
Compare
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 introduces the functionality for messaging a member from the group channel info screen by adding a new event with member-specific parameters and by incorporating a draft channel flow when no direct channel exists. It also refactors the state management in the ChannelInfoMemberViewController and updates several Compose UI screens and navigation flows to support the draft channel funnel.
Reviewed Changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/channel/info/ChannelInfoMemberViewEvent.kt | Updated MessageMember event with new parameters (memberId and distinctCid) for improved navigation handling. |
stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/channel/info/ChannelInfoMemberViewController.kt | Refactored state flow by replacing an internal MutableStateFlow with a flow transformation that now includes querying for a distinct channel. |
stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/channel/draft/* | Introduced draft channel events, actions, and a dedicated view controller and view state to support the draft channel funnel when messaging a member. |
stream-chat-android-compose/* and sample modules | Updated UI components, navigation flows, and API interfaces to integrate the new messaging and draft channel functionality. |
stream-chat-android-compose-sample/src/main/AndroidManifest.xml | Registered the new DraftChannelActivity. |
}.map { (channelData, member, distinctChannel) -> | ||
this.member = member | ||
this.distinctCid = distinctChannel?.cid |
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.
Avoid performing side-effects (e.g. updating 'this.member' and 'this.distinctCid') inside flow transformation functions. Consider assigning these values to local variables and handling side-effects separately to improve clarity and avoid potential concurrency issues.
Copilot uses AI. Check for mistakes.
} | ||
|
||
runCatching { | ||
requireNotNull(chatClient.getCurrentUser()?.id) { "User not connected" } |
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.
Consider handling the case where currentUser might be null more gracefully so that the flow always emits a value (or error event) rather than relying solely on a requireNotNull check that may throw. This could help maintain a consistent flow state in scenarios where the user is disconnected.
Copilot uses AI. Check for mistakes.
92b9fdf
to
cfb57f5
Compare
b2cb345
to
c8d360f
Compare
cfb57f5
to
5275e91
Compare
…teIn` This commit refactors the `state` property in `ChannelInfoMemberViewController` to utilize the `stateIn` operator. This simplifies the state management by directly transforming the upstream flow into a `StateFlow`. The `onChannelInfoData` function is removed as its logic is now incorporated into the `map` operation within the `stateIn` flow.
The `channelId` parameter, representing only the ID part of a channel identifier, has been replaced with `cid` or `distinctCid`, which represent the full channel identifier (e.g., `messaging:channelId`). This change affects: - `ChannelInfoViewEvent.NavigateToChannel` - `ChannelInfoMemberViewEvent.MessageMember` - Related event handling in `ChannelInfoViewController` and `ChannelInfoMemberViewController` - Sample app usage in `ChatsActivity` and `GroupChannelInfoActivity` This ensures clarity and consistency when referring to channel identifiers.
The `queryChannels` call in the `ChannelInfoMemberViewControllerTest` has been updated to use a `QueryChannelsRequest` object instead of an `any()` matcher. This ensures that the test accurately reflects the actual call being made by the `ChannelInfoMemberViewController`.
…teIn` This commit refactors the `state` property in `ChannelInfoMemberViewController` to utilize the `stateIn` operator. This simplifies the state management by directly transforming the upstream flow into a `StateFlow`. The `onChannelInfoData` function is removed as its logic is now incorporated into the `map` operation within the `stateIn` flow.
…channel When messaging a member from the channel info screen, the app will now navigate to a draft channel instead of immediately creating a new direct channel. This allows the user to compose a message before the channel is actually created. This change also introduces the following new components: - `DraftChannelViewController`: Manages the state and events for the draft channel screen. - `DraftChannelViewState`: Represents the state of the draft channel screen. - `DraftChannelViewAction`: Represents user actions on the draft channel screen. - `DraftChannelViewEvent`: Represents side effects from the draft channel screen. - `DraftChannelScreen`: The composable UI for the draft channel. - `DraftChannelActivity`: The activity that hosts the draft channel screen.
5275e91
to
117de3f
Compare
|
🎯 Goal
Support messaging a member from the group channel info screen
🛠 Implementation details
Messaging a member from the group channel info screen can enter two possible funnels:
The draft view controller and its state, and events are part of the
ui-common
, so it can be reused by theui-components
SDK. The draft screens and view model are not.🎨 UI Changes
phone_new_message.webm
phone_more_messages.webm
🧪 Testing
Message
option in the member bottom sheet🎉 GIF