Fixed display of Contacts setting Both value

This commit is contained in:
Juha Heinanen
2025-07-19 10:58:06 +03:00
parent 106dfedbd6
commit a60cfa3154

View File

@ -951,7 +951,11 @@ private fun Contacts(activity: Activity) {
val isDropDownExpanded = remember { val isDropDownExpanded = remember {
mutableStateOf(false) mutableStateOf(false)
} }
val contactNames = listOf("baresip", "Android", "Both") val contactNames = listOf(
"baresip",
"Android",
ctx.getString(R.string.both)
)
val contactValues = listOf("baresip", "android", "both") val contactValues = listOf("baresip", "android", "both")
oldContactsMode = Config.variable("contacts_mode").lowercase() oldContactsMode = Config.variable("contacts_mode").lowercase()
val itemPosition = remember { val itemPosition = remember {
@ -982,9 +986,8 @@ private fun Contacts(activity: Activity) {
isDropDownExpanded.value = false isDropDownExpanded.value = false
}) { }) {
contactNames.forEachIndexed { index, name -> contactNames.forEachIndexed { index, name ->
DropdownMenuItem(text = { DropdownMenuItem(
Text(text = name) text = { Text(text = name) },
},
onClick = { onClick = {
isDropDownExpanded.value = false isDropDownExpanded.value = false
val mode = contactValues[index] val mode = contactValues[index]
@ -1004,11 +1007,15 @@ private fun Contacts(activity: Activity) {
) == PackageManager.PERMISSION_GRANTED ) == PackageManager.PERMISSION_GRANTED
) { ) {
Log.d(TAG, "Contacts permissions already granted") Log.d(TAG, "Contacts permissions already granted")
} else { }
else {
if (shouldShowRequestPermissionRationale( if (shouldShowRequestPermissionRationale(
activity, Manifest.permission.READ_CONTACTS) || activity, Manifest.permission.READ_CONTACTS
) ||
shouldShowRequestPermissionRationale( shouldShowRequestPermissionRationale(
activity, Manifest.permission.WRITE_CONTACTS)) activity, Manifest.permission.WRITE_CONTACTS
)
)
showAlertDialog.value = true showAlertDialog.value = true
else else
requestPermissionsLauncher.launch( requestPermissionsLauncher.launch(