Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 408eca5b authored by moezbhatti's avatar moezbhatti
Browse files

#1384 - Try to give option to add number to existing contact

parent 45b3e18c
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -217,9 +217,15 @@ class Navigator @Inject constructor(
    }

    fun addContact(address: String) {
        val intent = Intent(Intent.ACTION_INSERT)
        val uri = Uri.parse("tel: $address")
        var intent = Intent(ContactsContract.Intents.SHOW_OR_CREATE_CONTACT, uri)

        if (intent.resolveActivity(context.packageManager) == null) {
            intent = Intent(Intent.ACTION_INSERT)
                    .setType(ContactsContract.Contacts.CONTENT_TYPE)
                    .putExtra(ContactsContract.Intents.Insert.PHONE, address)
        }

        startActivityExternal(intent)
    }