More fixes
This commit is contained in:
committed by
Benoit Marty
parent
bf1462f9b1
commit
97de57fd79
+4
-4
@@ -207,7 +207,7 @@ fun AdvancedSettingsView(
|
||||
if (state.liveLocationMinimumDistanceUpdate != null) {
|
||||
LiveLocationUpdatesSection(
|
||||
value = state.liveLocationMinimumDistanceUpdate,
|
||||
onValueSaved = { value ->
|
||||
onSaveValue = { value ->
|
||||
state.eventSink(AdvancedSettingsEvents.SetLiveLocationMinimumDistanceUpdate(value))
|
||||
},
|
||||
onOpenAppPermissionsClick = onOpenAppSettingsClick,
|
||||
@@ -340,11 +340,11 @@ private fun ModerationAndSafety(
|
||||
@Composable
|
||||
private fun LiveLocationUpdatesSection(
|
||||
value: Int,
|
||||
onValueSaved: (Int) -> Unit,
|
||||
onSaveValue: (Int) -> Unit,
|
||||
onOpenAppPermissionsClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val updatedOnValueSaved by rememberUpdatedState(onValueSaved)
|
||||
val updatedOnSaveValue by rememberUpdatedState(onSaveValue)
|
||||
PreferenceCategory(
|
||||
modifier = modifier,
|
||||
showTopDivider = true,
|
||||
@@ -384,7 +384,7 @@ private fun LiveLocationUpdatesSection(
|
||||
value = sliderValue.toFloat(),
|
||||
onValueChange = { sliderValue = it.roundToInt() },
|
||||
onValueChangeFinish = {
|
||||
updatedOnValueSaved(sliderValue)
|
||||
updatedOnSaveValue(sliderValue)
|
||||
},
|
||||
valueRange = valueRange,
|
||||
colors = SliderDefaults.colors(
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ class AddRoomToSpaceNode(
|
||||
AddRoomToSpaceView(
|
||||
state = state,
|
||||
onBackClick = callback::onFinish,
|
||||
onRoomsAdded = callback::onFinish,
|
||||
onAddRoom = callback::onFinish,
|
||||
modifier = modifier
|
||||
)
|
||||
}
|
||||
|
||||
+6
-3
@@ -23,6 +23,8 @@ import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.rememberUpdatedState
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
@@ -57,9 +59,10 @@ import kotlinx.collections.immutable.toImmutableList
|
||||
fun AddRoomToSpaceView(
|
||||
state: AddRoomToSpaceState,
|
||||
onBackClick: () -> Unit,
|
||||
onRoomsAdded: () -> Unit,
|
||||
onAddRoom: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val updatedOnAddRoom by rememberUpdatedState(onAddRoom)
|
||||
fun onRoomToggled(room: SelectRoomInfo) {
|
||||
state.eventSink(AddRoomToSpaceEvent.ToggleRoom(room))
|
||||
}
|
||||
@@ -78,7 +81,7 @@ fun AddRoomToSpaceView(
|
||||
// Navigate back on success
|
||||
LaunchedEffect(state.saveAction) {
|
||||
if (state.saveAction is AsyncAction.Success) {
|
||||
onRoomsAdded()
|
||||
updatedOnAddRoom()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,6 +250,6 @@ internal fun AddRoomToSpaceViewPreview(
|
||||
AddRoomToSpaceView(
|
||||
state = state,
|
||||
onBackClick = {},
|
||||
onRoomsAdded = {},
|
||||
onAddRoom = {},
|
||||
)
|
||||
}
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ private fun AndroidComposeUiTest<ComponentActivity>.setAddRoomToSpaceView(
|
||||
AddRoomToSpaceView(
|
||||
state = state,
|
||||
onBackClick = onBackClick,
|
||||
onRoomsAdded = onRoomsAdded,
|
||||
onAddRoom = onRoomsAdded,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user