Added Call/Dial option to contacts screen menu
This commit is contained in:
@@ -3156,6 +3156,7 @@ class BaresipService: Service() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var contactsMode by mutableStateOf("baresip")
|
var contactsMode by mutableStateOf("baresip")
|
||||||
|
var contactAction by mutableStateOf("call")
|
||||||
var addressFamily = ""
|
var addressFamily = ""
|
||||||
var dnsServers = listOf<InetAddress>()
|
var dnsServers = listOf<InetAddress>()
|
||||||
|
|
||||||
|
|||||||
@@ -172,6 +172,13 @@ object Config {
|
|||||||
config = "${config}contacts_mode $contactsMode\n"
|
config = "${config}contacts_mode $contactsMode\n"
|
||||||
BaresipService.contactsMode = contactsMode
|
BaresipService.contactsMode = contactsMode
|
||||||
|
|
||||||
|
val contactAction = previousVariable("contact_action")
|
||||||
|
config = if (contactAction != "")
|
||||||
|
"${config}contact_action $contactAction\n"
|
||||||
|
else
|
||||||
|
"${config}contact_action call\n"
|
||||||
|
BaresipService.contactAction = if (contactAction != "") contactAction else "call"
|
||||||
|
|
||||||
config = "${config}snd_path ${BaresipService.filesPath}/recordings\n"
|
config = "${config}snd_path ${BaresipService.filesPath}/recordings\n"
|
||||||
|
|
||||||
val callVolume = previousVariable("call_volume")
|
val callVolume = previousVariable("call_volume")
|
||||||
|
|||||||
@@ -740,7 +740,7 @@ private fun UrisSection(
|
|||||||
val intent = Intent(ctx, MainActivity::class.java)
|
val intent = Intent(ctx, MainActivity::class.java)
|
||||||
intent.putExtra("uap", ua.uap)
|
intent.putExtra("uap", ua.uap)
|
||||||
intent.putExtra("peer", uri)
|
intent.putExtra("peer", uri)
|
||||||
handleIntent(ctx, viewModel, intent, "call")
|
handleIntent(ctx, viewModel, intent, BaresipService.contactAction)
|
||||||
navController.navigate("main") {
|
navController.navigate("main") {
|
||||||
popUpTo("main") { inclusive = false }
|
popUpTo("main") { inclusive = false }
|
||||||
launchSingleTop = true
|
launchSingleTop = true
|
||||||
|
|||||||
@@ -292,6 +292,13 @@ private fun ContactsScreen(navController: NavController) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val call = stringResource(R.string.call)
|
||||||
|
val dial = stringResource(R.string.dial)
|
||||||
|
|
||||||
|
val contactActionName = remember(BaresipService.contactAction) {
|
||||||
|
listOf(if (BaresipService.contactAction == "call") call else dial)
|
||||||
|
}
|
||||||
|
|
||||||
val contactNames = remember(BaresipService.contactsMode) {
|
val contactNames = remember(BaresipService.contactsMode) {
|
||||||
val names = mutableListOf("baresip", "Android", both)
|
val names = mutableListOf("baresip", "Android", both)
|
||||||
val values = listOf("baresip", "android", "both")
|
val values = listOf("baresip", "android", "both")
|
||||||
@@ -413,9 +420,16 @@ private fun ContactsScreen(navController: NavController) {
|
|||||||
CustomElements.DropdownMenu(
|
CustomElements.DropdownMenu(
|
||||||
expanded = expanded,
|
expanded = expanded,
|
||||||
onDismissRequest = { expanded = false },
|
onDismissRequest = { expanded = false },
|
||||||
items = contactNames + import + export + delete,
|
items = contactNames + contactActionName + import + export + delete,
|
||||||
onItemClick = { name ->
|
onItemClick = { name ->
|
||||||
expanded = false
|
expanded = false
|
||||||
|
if (name == call || name == dial) {
|
||||||
|
val newAction = if (BaresipService.contactAction == "call") "dial" else "call"
|
||||||
|
BaresipService.contactAction = newAction
|
||||||
|
Config.replaceVariable("contact_action", newAction)
|
||||||
|
Config.save()
|
||||||
|
return@DropdownMenu
|
||||||
|
}
|
||||||
if (name == import) {
|
if (name == import) {
|
||||||
vcfImportLauncher.launch(arrayOf("text/vcard", "text/x-vcard"))
|
vcfImportLauncher.launch(arrayOf("text/vcard", "text/x-vcard"))
|
||||||
return@DropdownMenu
|
return@DropdownMenu
|
||||||
|
|||||||
@@ -295,6 +295,7 @@
|
|||||||
<!-- Calls Activity -->
|
<!-- Calls Activity -->
|
||||||
<string name="call_history">Puheluhistoria</string>
|
<string name="call_history">Puheluhistoria</string>
|
||||||
<string name="call">Soita</string>
|
<string name="call">Soita</string>
|
||||||
|
<string name="dial">Näytä</string>
|
||||||
<string name="calls_calls">puhelut</string>
|
<string name="calls_calls">puhelut</string>
|
||||||
<string name="calls_call">puhelun</string>
|
<string name="calls_call">puhelun</string>
|
||||||
<string name="direction">Suunta</string>
|
<string name="direction">Suunta</string>
|
||||||
|
|||||||
@@ -291,6 +291,7 @@
|
|||||||
<string name="call_history">Call History</string>
|
<string name="call_history">Call History</string>
|
||||||
<string name="call_details">Call Details</string>
|
<string name="call_details">Call Details</string>
|
||||||
<string name="call">Call</string>
|
<string name="call">Call</string>
|
||||||
|
<string name="dial">Dial</string>
|
||||||
<string name="calls_calls">calls</string>
|
<string name="calls_calls">calls</string>
|
||||||
<string name="calls_call">call</string>
|
<string name="calls_call">call</string>
|
||||||
<string name="peer">Peer</string>
|
<string name="peer">Peer</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user