Merge pull request #6464 from kalix127/feat/reply-with-voice-message

Support replying to messages with voice recordings
This commit is contained in:
Benoit Marty 2026-04-17 14:49:04 +02:00 committed by GitHub
commit 269d367130
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 68 additions and 3 deletions

View file

@ -400,6 +400,7 @@ fun TextComposer(
onAddAttachment = onAddAttachment,
onDeleteVoiceMessage = onDeleteVoiceMessage,
onVoiceRecorderEvent = onVoiceRecorderEvent,
onResetComposerMode = onResetComposerMode,
)
}
@ -409,6 +410,15 @@ fun TextComposer(
SoftKeyboardEffect(showTextFormatting, onRequestFocus) { it }
// Re-focus the text input when voice recording ends so the user can continue typing
var previousVoiceMessageState by remember { mutableStateOf(voiceMessageState) }
LaunchedEffect(voiceMessageState) {
if (voiceMessageState is VoiceMessageState.Idle && previousVoiceMessageState !is VoiceMessageState.Idle) {
onRequestFocus()
}
previousVoiceMessageState = voiceMessageState
}
val latestOnReceiveSuggestion by rememberUpdatedState(onReceiveSuggestion)
if (state is TextEditorState.Rich) {
val menuAction = state.richTextEditorState.menuAction
@ -440,6 +450,7 @@ private fun StandardLayout(
onAddAttachment: () -> Unit,
onDeleteVoiceMessage: () -> Unit,
onVoiceRecorderEvent: (VoiceMessageRecorderEvent) -> Unit,
onResetComposerMode: () -> Unit,
modifier: Modifier = Modifier,
) {
Column(modifier = modifier) {
@ -506,6 +517,14 @@ private fun StandardLayout(
) {
if (voiceMessageState is VoiceMessageState.Idle) {
textInput()
} else if (composerMode is MessageComposerMode.Special) {
TextInputBox(
composerMode = composerMode,
onResetComposerMode = onResetComposerMode,
isTextEmpty = true,
) {
voiceRecording()
}
} else {
voiceRecording()
}