More fixes

This commit is contained in:
Jorge Martín
2026-05-15 15:04:08 +02:00
committed by Benoit Marty
parent bf1462f9b1
commit 97de57fd79
5 changed files with 17 additions and 12 deletions
@@ -32,6 +32,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.movableContentOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
@@ -419,7 +420,7 @@ fun TextComposer(
// Re-focus the text input when voice recording ends so the user can continue typing
var previousVoiceMessageState by remember { mutableStateOf(voiceMessageState) }
LaunchedEffect(voiceMessageState) {
LaunchedEffect(voiceMessageState, onRequestFocus) {
if (voiceMessageState is VoiceMessageState.Idle && previousVoiceMessageState !is VoiceMessageState.Idle) {
onRequestFocus()
}
@@ -522,6 +523,7 @@ private fun StandardLayout(
.padding(bottom = 8.dp, top = 8.dp)
.weight(1f)
) {
val movableVoiceRecording = remember { movableContentOf { voiceRecording() } }
if (voiceMessageState is VoiceMessageState.Idle) {
textInput()
} else if (composerMode is MessageComposerMode.Special) {
@@ -530,10 +532,10 @@ private fun StandardLayout(
onResetComposerMode = onResetComposerMode,
isTextEmpty = true,
) {
voiceRecording()
movableVoiceRecording()
}
} else {
voiceRecording()
movableVoiceRecording()
}
}
// To avoid loosing keyboard focus, the IconButton has to be defined here and has to be always enabled.