moving the Launch ACTION_CALL intent handling in Commons

This commit is contained in:
tibbi 2020-05-08 22:34:42 +02:00
parent 3bebf4445e
commit cd8d73b8e4
2 changed files with 1 additions and 21 deletions

View File

@ -57,7 +57,7 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.27.17'
implementation 'com.simplemobiletools:commons:5.27.18'
implementation 'joda-time:joda-time:2.10.1'
implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5'
implementation 'com.github.tibbi:IndicatorFastScroll:08f512858a'

View File

@ -9,7 +9,6 @@ import android.telecom.TelecomManager
import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.PERMISSION_CALL_PHONE
import com.simplemobiletools.commons.helpers.PERMISSION_READ_PHONE_STATE
import com.simplemobiletools.commons.models.RadioItem
import com.simplemobiletools.contacts.pro.BuildConfig
@ -30,25 +29,6 @@ fun SimpleActivity.startCallIntent(recipient: String) {
}
}
fun SimpleActivity.launchCallIntent(recipient: String, handle: PhoneAccountHandle?) {
handlePermission(PERMISSION_CALL_PHONE) {
val action = if (it) Intent.ACTION_CALL else Intent.ACTION_DIAL
Intent(action).apply {
data = Uri.fromParts("tel", recipient, null)
if (handle != null) {
putExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, handle)
}
if (resolveActivity(packageManager) != null) {
startActivity(this)
} else {
toast(R.string.no_app_found)
}
}
}
}
fun SimpleActivity.tryStartCall(contact: Contact) {
if (config.showCallConfirmation) {
CallConfirmationDialog(this, contact.getNameToDisplay()) {