Fixed disabling/enabling of call buttons
This commit is contained in:
@ -2031,7 +2031,6 @@ private fun callClick(ctx: Context, viewModel: ViewModel, dialerState: ViewModel
|
|||||||
if (dialerState != null) {
|
if (dialerState != null) {
|
||||||
val uriText = dialerState.callUri.value.trim()
|
val uriText = dialerState.callUri.value.trim()
|
||||||
if (uriText.isNotEmpty()) {
|
if (uriText.isNotEmpty()) {
|
||||||
dialerState.callButtonsEnabled.value = false
|
|
||||||
val uris = Contact.contactUris(uriText)
|
val uris = Contact.contactUris(uriText)
|
||||||
if (uris.isEmpty())
|
if (uris.isEmpty())
|
||||||
makeCall(ctx, viewModel, uriText, dialerState.showCallConferenceButton.value)
|
makeCall(ctx, viewModel, uriText, dialerState.showCallConferenceButton.value)
|
||||||
@ -2085,6 +2084,7 @@ private fun makeCall(ctx: Context, viewModel: ViewModel, uriText: String, confer
|
|||||||
!Call.calls().any { it.ua.account.aor == ua.account.aor })
|
!Call.calls().any { it.ua.account.aor == ua.account.aor })
|
||||||
Toast.makeText(ctx, R.string.call_already_active, Toast.LENGTH_SHORT).show()
|
Toast.makeText(ctx, R.string.call_already_active, Toast.LENGTH_SHORT).show()
|
||||||
else {
|
else {
|
||||||
|
viewModel.dialerState.callButtonsEnabled.value = false
|
||||||
if (BaresipService.telecom) {
|
if (BaresipService.telecom) {
|
||||||
val tm = ctx.getSystemService(Context.TELECOM_SERVICE) as android.telecom.TelecomManager
|
val tm = ctx.getSystemService(Context.TELECOM_SERVICE) as android.telecom.TelecomManager
|
||||||
val extras = android.os.Bundle()
|
val extras = android.os.Bundle()
|
||||||
@ -2101,6 +2101,7 @@ private fun makeCall(ctx: Context, viewModel: ViewModel, uriText: String, confer
|
|||||||
tm.placeCall(uri.toUri(), extras)
|
tm.placeCall(uri.toUri(), extras)
|
||||||
} catch (e: SecurityException) {
|
} catch (e: SecurityException) {
|
||||||
Log.e(TAG, "placeCall failed: ${e.message}")
|
Log.e(TAG, "placeCall failed: ${e.message}")
|
||||||
|
viewModel.dialerState.callButtonsEnabled.value = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user