permissions-dispatcher / PermissionsDispatcher

A declarative API to handle Android runtime permissions.
https://github.com/permissions-dispatcher/PermissionsDispatcher
Apache License 2.0
11.21k stars 1.44k forks source link

KTX permission dispatcher does not support arguments #702

Open alaershov opened 3 years ago

alaershov commented 3 years ago

Overview

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.

hotchemi commented 3 years ago

thx, that'd be cool to have it👍