Skip to content

Commit ab35a7d

Browse files
committed
Only close the command picker if the selected command is available for the current message action.
1 parent 443efa9 commit ab35a7d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import io.getstream.chat.android.ui.common.helper.internal.AttachmentFilter
6565
import io.getstream.chat.android.ui.common.state.messages.MessageAction
6666
import io.getstream.chat.android.ui.common.state.messages.MessageMode
6767
import io.getstream.chat.android.ui.common.state.messages.composer.AttachmentMetaData
68+
import io.getstream.chat.android.ui.common.state.messages.composer.isAvailableFor
6869
import io.getstream.chat.android.ui.common.utils.isPermissionDeclared
6970

7071
@Suppress("LongMethod")
@@ -196,7 +197,9 @@ internal fun AttachmentSystemPicker(
196197
pickerMode = commandPickerMode,
197198
commands = commands,
198199
onCommandSelected = { command ->
199-
showCommandsPickerDialog = false
200+
if (command.isAvailableFor(messageAction)) {
201+
showCommandsPickerDialog = false
202+
}
200203
actions.onCommandSelected(command)
201204
},
202205
messageAction = messageAction,

0 commit comments

Comments
 (0)