mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
fix #185, prefer the contact Mobile phone number at sending batch SMS
This commit is contained in:
@ -105,10 +105,10 @@ fun BaseSimpleActivity.shareContacts(contacts: ArrayList<Contact>) {
|
|||||||
fun BaseSimpleActivity.sendSMSToContacts(contacts: ArrayList<Contact>) {
|
fun BaseSimpleActivity.sendSMSToContacts(contacts: ArrayList<Contact>) {
|
||||||
val numbers = StringBuilder()
|
val numbers = StringBuilder()
|
||||||
contacts.forEach {
|
contacts.forEach {
|
||||||
it.phoneNumbers.forEach {
|
val number = it.phoneNumbers.firstOrNull { it.type == ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE }
|
||||||
if (it.value.isNotEmpty()) {
|
?: it.phoneNumbers.firstOrNull()
|
||||||
numbers.append("${it.value};")
|
if (number != null) {
|
||||||
}
|
numbers.append("${number.value};")
|
||||||
}
|
}
|
||||||
|
|
||||||
val uriString = "smsto:${numbers.toString().trimEnd(';')}"
|
val uriString = "smsto:${numbers.toString().trimEnd(';')}"
|
||||||
|
Reference in New Issue
Block a user