Fixed handling of DTMF backspace character

This commit is contained in:
Juha Heinanen
2025-04-09 08:21:54 +03:00
parent 08adc5dc85
commit f514f19755

View File

@ -1424,16 +1424,16 @@ class MainActivity : ComponentActivity() {
val shouldRequestFocus by focusDtmf
TextField(
value = dtmfText.value,
onValueChange = { newText ->
if (newText.length > dtmfText.value.length) {
val char = newText.last()
Log.d(TAG, "Got DTMF digit '$char'")
onValueChange = {
if (it.length > dtmfText.value.length) {
val char = it.last()
if (char.isDigit() || char == '*' || char == '#') {
dtmfText.value = newText
Log.d(TAG, "Got DTMF digit '$char'")
ua = UserAgent.ofAor(viewModel.selectedAor.value)!!
ua.currentCall()!!.sendDigit(char)
}
}
dtmfText.value = it
},
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Phone),
modifier = Modifier