Massimo Carli
11/22/2018, 11:36 AM@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
?radityagumay
11/23/2018, 12:11 AMtrue
thereMassimo Carli
11/24/2018, 1:47 AM