package com.isidroid.utils

import android.app.Activity
import android.content.Context
import android.content.pm.PackageManager
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat

fun Context.hasPermission(perm: String) =
    ContextCompat.checkSelfPermission(this, perm) == PackageManager.PERMISSION_GRANTED

fun Context.shouldShowRequestPermissionRationale(perm: String) = (this as? Activity)?.let {
    ActivityCompat.shouldShowRequestPermissionRationale(this, perm)
} ?: false
