fix: persist reply banner during voice recording and dismiss keyboard
This commit is contained in:
parent
2039ca9cca
commit
a6ce20662f
1 changed files with 19 additions and 0 deletions
|
|
@ -41,6 +41,7 @@ import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
|
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
|
||||||
import androidx.compose.ui.platform.LocalHapticFeedback
|
import androidx.compose.ui.platform.LocalHapticFeedback
|
||||||
|
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
||||||
import androidx.compose.ui.platform.LocalView
|
import androidx.compose.ui.platform.LocalView
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.semantics.clearAndSetSemantics
|
import androidx.compose.ui.semantics.clearAndSetSemantics
|
||||||
|
|
@ -400,6 +401,7 @@ fun TextComposer(
|
||||||
onAddAttachment = onAddAttachment,
|
onAddAttachment = onAddAttachment,
|
||||||
onDeleteVoiceMessage = onDeleteVoiceMessage,
|
onDeleteVoiceMessage = onDeleteVoiceMessage,
|
||||||
onVoiceRecorderEvent = onVoiceRecorderEvent,
|
onVoiceRecorderEvent = onVoiceRecorderEvent,
|
||||||
|
onResetComposerMode = onResetComposerMode,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -409,6 +411,14 @@ fun TextComposer(
|
||||||
|
|
||||||
SoftKeyboardEffect(showTextFormatting, onRequestFocus) { it }
|
SoftKeyboardEffect(showTextFormatting, onRequestFocus) { it }
|
||||||
|
|
||||||
|
// Dismiss keyboard when voice recording starts
|
||||||
|
val keyboardController = LocalSoftwareKeyboardController.current
|
||||||
|
LaunchedEffect(voiceMessageState) {
|
||||||
|
if (voiceMessageState !is VoiceMessageState.Idle) {
|
||||||
|
keyboardController?.hide()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val latestOnReceiveSuggestion by rememberUpdatedState(onReceiveSuggestion)
|
val latestOnReceiveSuggestion by rememberUpdatedState(onReceiveSuggestion)
|
||||||
if (state is TextEditorState.Rich) {
|
if (state is TextEditorState.Rich) {
|
||||||
val menuAction = state.richTextEditorState.menuAction
|
val menuAction = state.richTextEditorState.menuAction
|
||||||
|
|
@ -440,6 +450,7 @@ private fun StandardLayout(
|
||||||
onAddAttachment: () -> Unit,
|
onAddAttachment: () -> Unit,
|
||||||
onDeleteVoiceMessage: () -> Unit,
|
onDeleteVoiceMessage: () -> Unit,
|
||||||
onVoiceRecorderEvent: (VoiceMessageRecorderEvent) -> Unit,
|
onVoiceRecorderEvent: (VoiceMessageRecorderEvent) -> Unit,
|
||||||
|
onResetComposerMode: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Column(modifier = modifier) {
|
Column(modifier = modifier) {
|
||||||
|
|
@ -506,6 +517,14 @@ private fun StandardLayout(
|
||||||
) {
|
) {
|
||||||
if (voiceMessageState is VoiceMessageState.Idle) {
|
if (voiceMessageState is VoiceMessageState.Idle) {
|
||||||
textInput()
|
textInput()
|
||||||
|
} else if (composerMode is MessageComposerMode.Special) {
|
||||||
|
TextInputBox(
|
||||||
|
composerMode = composerMode,
|
||||||
|
onResetComposerMode = onResetComposerMode,
|
||||||
|
isTextEmpty = true,
|
||||||
|
) {
|
||||||
|
voiceRecording()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
voiceRecording()
|
voiceRecording()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue