Disable call button after call has been made

This commit is contained in:
Juha Heinanen
2025-08-25 15:06:21 +03:00
parent c6bddf74b1
commit 28e49f7cc4
@@ -762,6 +762,7 @@ private val showCallTimer = mutableStateOf(false)
private var callDuration = 0 private var callDuration = 0
private val showSuggestions = mutableStateOf(false) private val showSuggestions = mutableStateOf(false)
private val showCallButton = mutableStateOf(true) private val showCallButton = mutableStateOf(true)
private val callButtonEnabled = mutableStateOf(true)
private val showCancelButton = mutableStateOf(false) private val showCancelButton = mutableStateOf(false)
private val showAnswerRejectButtons = mutableStateOf(false) private val showAnswerRejectButtons = mutableStateOf(false)
private val showHangupButton = mutableStateOf(false) private val showHangupButton = mutableStateOf(false)
@@ -1289,6 +1290,7 @@ private fun CallRow(ctx: Context, viewModel: ViewModel) {
showSuggestions.value = false showSuggestions.value = false
callClick(ctx, viewModel) callClick(ctx, viewModel)
}, },
enabled=callButtonEnabled.value
) { ) {
Icon( Icon(
imageVector = ImageVector.vectorResource(id = R.drawable.call), imageVector = ImageVector.vectorResource(id = R.drawable.call),
@@ -1792,6 +1794,7 @@ private fun callClick(ctx: Context, viewModel: ViewModel) {
return return
val uriText = callUri.value.trim() val uriText = callUri.value.trim()
if (uriText.isNotEmpty()) { if (uriText.isNotEmpty()) {
callButtonEnabled.value = false
val uris = Contact.contactUris(uriText) val uris = Contact.contactUris(uriText)
if (uris.isEmpty()) if (uris.isEmpty())
makeCall(ctx, viewModel, uriText) makeCall(ctx, viewModel, uriText)
@@ -1880,6 +1883,7 @@ private fun runCall(ctx: Context, viewModel: ViewModel, ua: UserAgent, uri: Stri
if (!call(ctx, viewModel, ua, uri)) { if (!call(ctx, viewModel, ua, uri)) {
BaresipService.abandonAudioFocus(ctx) BaresipService.abandonAudioFocus(ctx)
showCallButton.value = true showCallButton.value = true
callButtonEnabled.value = true
showCancelButton.value = false showCancelButton.value = false
} }
else { else {
@@ -2001,6 +2005,7 @@ private fun showCall(ctx: Context, viewModel: ViewModel, ua: UserAgent?, showCal
dtmfEnabled.value = false dtmfEnabled.value = false
focusDtmf.value = false focusDtmf.value = false
showCallButton.value = true showCallButton.value = true
callButtonEnabled.value = true
showCancelButton.value = false showCancelButton.value = false
showAnswerRejectButtons.value = false showAnswerRejectButtons.value = false
showOnHoldNotice.value = false showOnHoldNotice.value = false