KTX permission dispatcher does not support passing arguments to functions that require permissions.
For instance, we can do this with annotation-style:
@NeedsPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
fun downloadFile(fileParams: FileParams) {
...
}
but it's not possible with KTX-style, because requiresPermission is a pre-defined lambda that must be constructed on activity creation.
Expected
Would be nice to have the possibility to pass arguments to permission-requiring functions.
Overview
KTX permission dispatcher does not support passing arguments to functions that require permissions. For instance, we can do this with annotation-style:
but it's not possible with KTX-style, because
requiresPermission
is a pre-defined lambda that must be constructed on activity creation.Expected
Would be nice to have the possibility to pass arguments to permission-requiring functions.