use helper function to check sdk version

This commit is contained in:
Mysochenko Yuriy
2022-05-10 07:40:15 +03:00
parent 162dfd08ee
commit 3906af8878

View File

@@ -1,15 +1,15 @@
package com.simplemobiletools.dialer.extensions
import android.os.Build
import android.telecom.Call
import android.telecom.Call.STATE_CONNECTING
import android.telecom.Call.STATE_DIALING
import android.telecom.Call.STATE_SELECT_PHONE_ACCOUNT
import com.simplemobiletools.commons.helpers.isSPlus
private val OUTGOING_CALL_STATES = arrayOf(STATE_CONNECTING, STATE_DIALING, STATE_SELECT_PHONE_ACCOUNT)
fun Call.getStateCompat(): Int {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
return if (isSPlus()) {
details.state
} else {
@Suppress("DEPRECATION")