From dbd5f42b0b4753b4b3621e338df59e45ca0dfe79 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 12 Jul 2020 16:08:19 +0200 Subject: [PATCH] properly handle opening private contacts in the debug version of Simple Contacts --- app/build.gradle | 2 +- .../simplemobiletools/dialer/fragments/ContactsFragment.kt | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index b0dc3380..509cc538 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' } diff --git a/app/src/main/kotlin/com/simplemobiletools/dialer/fragments/ContactsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/dialer/fragments/ContactsFragment.kt index 5a38f608..af678289 100644 --- a/app/src/main/kotlin/com/simplemobiletools/dialer/fragments/ContactsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/dialer/fragments/ContactsFragment.kt @@ -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)