File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed
kotlin/com/simplemobiletools/contacts/pro/extensions Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 99 <uses-permission android : name =" android.permission.WRITE_CONTACTS" />
1010 <uses-permission android : name =" android.permission.GET_ACCOUNTS" />
1111 <uses-permission android : name =" android.permission.READ_SYNC_SETTINGS" />
12+ <uses-permission android : name =" android.permission.CALL_PHONE" />
1213
1314 <uses-permission
1415 android : name =" android.permission.WRITE_EXTERNAL_STORAGE"
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import android.net.Uri
55import com.simplemobiletools.commons.activities.BaseSimpleActivity
66import com.simplemobiletools.commons.dialogs.RadioGroupDialog
77import com.simplemobiletools.commons.extensions.*
8+ import com.simplemobiletools.commons.helpers.PERMISSION_CALL_PHONE
89import com.simplemobiletools.commons.models.RadioItem
910import com.simplemobiletools.contacts.pro.BuildConfig
1011import com.simplemobiletools.contacts.pro.R
@@ -14,14 +15,16 @@ import com.simplemobiletools.contacts.pro.helpers.*
1415import com.simplemobiletools.contacts.pro.models.Contact
1516
1617fun SimpleActivity.startCallIntent (recipient : String ) {
17- val action = Intent .ACTION_CALL
18- Intent (action).apply {
19- data = Uri .fromParts(" tel" , recipient, null )
18+ handlePermission(PERMISSION_CALL_PHONE ) {
19+ val action = if (it) Intent .ACTION_CALL else Intent .ACTION_DIAL
20+ Intent (action).apply {
21+ data = Uri .fromParts(" tel" , recipient, null )
2022
21- if (resolveActivity(packageManager) != null ) {
22- startActivity(this )
23- } else {
24- toast(R .string.no_app_found)
23+ if (resolveActivity(packageManager) != null ) {
24+ startActivity(this )
25+ } else {
26+ toast(R .string.no_app_found)
27+ }
2528 }
2629 }
2730}
You can’t perform that action at this time.
0 commit comments