Skip to content

Commit eb8d70c

Browse files
committed
Update documentation for command selection behavior in MessageComposer and related components
1 parent 1a5d0c0 commit eb8d70c

4 files changed

Lines changed: 17 additions & 4 deletions

File tree

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/AttachmentCommandPicker.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ internal fun AttachmentCommandPicker(
9191
}
9292
}
9393

94+
/**
95+
* Command grid row.
96+
*
97+
* @param enabled Controls the item's visual state only (dimmed when `false`). Taps still invoke
98+
* [onCommandSelected] regardless, so the caller can surface feedback for disabled commands.
99+
*/
94100
@Composable
95101
private fun CommandItem(
96102
command: Command,

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/composer/MessageComposer.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ import io.getstream.chat.android.ui.common.utils.MediaStringUtil
8989
* @param onLinkPreviewClick Handler when the user taps on a link preview.
9090
* @param onCancelLinkPreviewClick Handler when the user taps on the cancel link preview.
9191
* @param onUserSelected Handler when the user taps on a user suggestion item.
92-
* @param onCommandSelected Handler when the user taps on a command suggestion item.
92+
* @param onCommandSelected Handler for every tap on a command suggestion item, regardless of the
93+
* command's availability in the current composer action. The default dispatches available commands
94+
* to the [viewModel] and surfaces a Toast for unavailable ones; overriding replaces both branches,
95+
* so the override is responsible for filtering and any unavailability feedback.
9396
* @param onAlsoSendToChannelChange Handler when the "Also send to channel" checkbox is changed.
9497
* @param onActiveCommandDismiss Called when the user taps the dismiss button on the active command chip.
9598
* @param recordingActions The actions that can be performed on an audio recording.

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/composer/internal/suggestions/CommandSuggestionItem.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ import io.getstream.chat.android.compose.ui.util.extensions.internal.iconRes
4040
import io.getstream.chat.android.compose.ui.util.extensions.internal.isPolychromaticIcon
4141
import io.getstream.chat.android.models.Command
4242

43+
/**
44+
* Command suggestion row.
45+
*
46+
* @param enabled Controls the item's visual state only (dimmed when `false`). Taps still invoke
47+
* [onCommandSelected] regardless, so the caller can surface feedback for disabled commands.
48+
*/
4349
@Composable
4450
internal fun CommandSuggestionItem(
4551
command: Command,

stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/messages/composer/MessageComposerController.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -970,9 +970,7 @@ public class MessageComposerController(
970970
* overwrite an existing stash (in-command input is command-specific and not preserved across
971971
* command switches).
972972
*
973-
* No-op while the composer is in edit mode: the backend does not dispatch slash commands on
974-
* message edits, so the combination is disallowed client-side to avoid emitting literal
975-
* `/command` text as the edit payload.
973+
* No-op while the composer is in edit mode.
976974
*
977975
* @param command The command that was selected.
978976
*/

0 commit comments

Comments
 (0)