Hi All. I'm trying to use a high order function in...
# android
m
Hi All. I'm trying to use a high order function in order to check for permission in Android with this function:
Copy code
@ExperimentalContracts
inline fun runIfGranted(context: Context, permission: String, fn: () -> Unit) {
    contract { returns(true) implies WHAT'S HERE? }  
    if (ContextCompat.checkSelfPermission(
            context,
            permission
        ) == PackageManager.PERMISSION_GRANTED
    ) {
        fn()
    }
}
. In order to remove the IntelliJ warning, I could use the
@SuppressLint("MissingPermission")
but I think that a contract would be the right solution. In that case, what should I put in the comment in the previous code in place of the literal
true
?
r
@Massimo Carli hmm.. I am not sure why you put
true
there
m
@radityagumay I've updated the message. I'm asking what to put instead of the true.