Merge pull request #6464 from kalix127/feat/reply-with-voice-message
Support replying to messages with voice recordings
This commit is contained in:
commit
269d367130
4 changed files with 68 additions and 3 deletions
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue