-
Notifications
You must be signed in to change notification settings - Fork 302
Ensure MessageComposer
respects the send-
capabilities
#5973
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?
Ensure MessageComposer
respects the send-
capabilities
#5973
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 PR centralizes capability checks for the Message Composer and ensures correct handling of send-message vs send-reply based on context (channel vs thread), while tightening audio recording availability to actual send permissions.
- Introduces public canSendMessage and canUploadFile helpers and replaces scattered checks with these centralized functions.
- Ensures audio recording controls are hidden when the user cannot send (message or reply).
- Updates guides and UI components to use the new helpers.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
stream-chat-android-ui-guides/.../MessagesActivity.kt | Replaces direct capability checks with canSendMessage/canUploadFile helpers in the sample activity. |
stream-chat-android-ui-components/.../DefaultMessageComposerTrailingContent.kt | Switches to helpers and simplifies trailing content logic; removes unused utility method. |
stream-chat-android-ui-components/.../DefaultMessageComposerLeadingContent.kt | Uses capability helpers to gate leading content behavior. |
stream-chat-android-ui-components/.../DefaultMessageComposerCenterContent.kt | Uses canSendMessage to toggle input enabled state. |
stream-chat-android-ui-common/.../MessageComposerCapabilitiesTest.kt | Adds parameterized tests for canSendMessage and canUploadFile. |
stream-chat-android-ui-common/.../MessageComposerCapabilities.kt | Adds public helpers canSendMessage and canUploadFile with documentation. |
stream-chat-android-ui-common/api/...ui-common.api | Updates public API surface to include new helper functions. |
stream-chat-android-docs/.../AddingCustomAttachments.kt | Updates Kotlin docs to use new capability helpers. |
stream-chat-android-docs/.../AddingCustomAttachments.java | Updates Java docs to use new capability helpers via static import. |
stream-chat-android-compose/.../MessageComposer.kt | Adopts helpers; updates trailing and label behavior; records require send capability. |
stream-chat-android-compose/.../MessageInput.kt | Uses canSendMessage helper for enabling input. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
...pose/src/main/java/io/getstream/chat/android/compose/ui/messages/composer/MessageComposer.kt
Show resolved
Hide resolved
...pose/src/main/java/io/getstream/chat/android/compose/ui/messages/composer/MessageComposer.kt
Show resolved
Hide resolved
|
🎯 Goal
Currently the message composer only considered the
send-message
capability, ignoring thesend-reply
one. With this PR, we ensure the proper capability is checked, depending on whether the composer is used in a channel or in a thread.Docs PR: https://github.com/GetStream/docs-content/pull/686
🛠 Implementation details
send-message
capability when in channelrend-reply
capability when in threadMessageComposerCapabilities
, which expose thecanSendMessage
andcanUploadFile
. Note: They are exposed as public, because I think they would be useful to provide to integrators developing custom composers.🎨 UI Changes
send-message-reply-before.mp4
send-message-reply-after.mp4
send-message-before.mp4
send-message-after.mp4
send-reply-before.mp4
send-reply-after.mp4
none-before.mp4
none-after.mp4
🧪 Testing
send-message
, disable theCreateMessage
permission on dashboardCreateMessage
andCreateReply
permissions on dashboardsend-reply
, disableThreads & Replies
on dashboard