forked from upstream-mirrors/quik
#1384 - Try to give option to add number to existing contact
This commit is contained in:
@@ -217,9 +217,15 @@ class Navigator @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun addContact(address: String) {
|
fun addContact(address: String) {
|
||||||
val intent = Intent(Intent.ACTION_INSERT)
|
val uri = Uri.parse("tel: $address")
|
||||||
.setType(ContactsContract.Contacts.CONTENT_TYPE)
|
var intent = Intent(ContactsContract.Intents.SHOW_OR_CREATE_CONTACT, uri)
|
||||||
.putExtra(ContactsContract.Intents.Insert.PHONE, address)
|
|
||||||
|
if (intent.resolveActivity(context.packageManager) == null) {
|
||||||
|
intent = Intent(Intent.ACTION_INSERT)
|
||||||
|
.setType(ContactsContract.Contacts.CONTENT_TYPE)
|
||||||
|
.putExtra(ContactsContract.Intents.Insert.PHONE, address)
|
||||||
|
}
|
||||||
|
|
||||||
startActivityExternal(intent)
|
startActivityExternal(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user