properly handle opening private contacts in the debug version of Simple Contacts

This commit is contained in:
tibbi
2020-07-12 16:08:19 +02:00
parent cdd9efe4e9
commit dbd5f42b0b
2 changed files with 5 additions and 3 deletions

View File

@ -56,6 +56,6 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.29.16'
implementation 'com.simplemobiletools:commons:5.29.17'
implementation 'com.github.tibbi:IndicatorFastScroll:08f512858a'
}

View File

@ -109,12 +109,14 @@ class ContactsFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
// handle private contacts differently, only Simple Contacts Pro can open them
val simpleContacts = "com.simplemobiletools.contacts.pro"
if (lookupKey.isEmpty() && it.rawId > 1000000 && it.contactId > 1000000 && it.rawId == it.contactId && context.isPackageInstalled(simpleContacts)) {
val simpleContactsDebug = "com.simplemobiletools.contacts.pro.debug"
if (lookupKey.isEmpty() && it.rawId > 1000000 && it.contactId > 1000000 && it.rawId == it.contactId &&
(context.isPackageInstalled(simpleContacts) || context.isPackageInstalled(simpleContactsDebug))) {
Intent().apply {
action = Intent.ACTION_VIEW
putExtra(CONTACT_ID, it.rawId)
putExtra(IS_PRIVATE, true)
`package` = simpleContacts
`package` = if (context.isPackageInstalled(simpleContacts)) simpleContacts else simpleContactsDebug
setDataAndType(publicUri, "vnd.android.cursor.dir/person")
if (resolveActivity(context.packageManager) != null) {
activity?.startActivity(this)