kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
feat: trigger channel scan dialog when users paste a new valid URL
rodzic
a475280b86
commit
a19a28c4b3
|
@ -49,6 +49,7 @@ import androidx.compose.material.icons.twotone.Check
|
|||
import androidx.compose.material.icons.twotone.Close
|
||||
import androidx.compose.material.icons.twotone.ContentCopy
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateListOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
|
@ -321,6 +322,11 @@ fun ChannelScreen(
|
|||
channelSelections = channelSelections,
|
||||
onClick = { showChannelEditor = true }
|
||||
)
|
||||
EditChannelUrl(
|
||||
enabled = enabled,
|
||||
channelUrl = selectedChannelSet.getChannelUrl(),
|
||||
onConfirm = viewModel::requestChannelUrl
|
||||
)
|
||||
}
|
||||
} else {
|
||||
dragDropItemsIndexed(
|
||||
|
@ -354,14 +360,6 @@ fun ChannelScreen(
|
|||
}
|
||||
}
|
||||
|
||||
item {
|
||||
EditChannelUrl(
|
||||
enabled = enabled,
|
||||
channelUrl = selectedChannelSet.getChannelUrl(),
|
||||
onConfirm = viewModel::requestChannelUrl
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
DropDownPreference(title = stringResource(id = R.string.channel_options),
|
||||
enabled = enabled,
|
||||
|
@ -419,6 +417,13 @@ private fun EditChannelUrl(
|
|||
var valueState by remember(channelUrl) { mutableStateOf(channelUrl) }
|
||||
var isError by remember { mutableStateOf(false) }
|
||||
|
||||
// Trigger dialog automatically when users paste a new valid URL
|
||||
LaunchedEffect(valueState, isError) {
|
||||
if (!isError && valueState != channelUrl) {
|
||||
onConfirm(valueState)
|
||||
}
|
||||
}
|
||||
|
||||
OutlinedTextField(
|
||||
value = valueState.toString(),
|
||||
onValueChange = {
|
||||
|
|
Ładowanie…
Reference in New Issue