-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(android): modified plugin annotation format for multi-permissions and empty (auto-grant) #3822
Conversation
android/capacitor/src/main/java/com/getcapacitor/annotation/Permission.java
Outdated
Show resolved
Hide resolved
perms[i] = annotation.permissions()[i].permission(); | ||
HashSet<String> permsSet = new HashSet<>(); | ||
for (Permission perm : annotation.permissions()) { | ||
// If a permission is defined with no permission constants, separate it for auto-granting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still confused as to why this part is necessary: (perm.permission().length == 1 && perm.permission()[0].isEmpty())
It is handling this case?
@Permission(permission = {""}, alias = ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes or this valid definition
@Permission(permission = "", alias = ...
which on the back end translates to an array containing one empty element
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's switch to Kotlin.
Allows for the following annotation formats for permissions:
Multiple permissions can be grouped within the same
@Permission
sub-annotation and alias.Permission element can be omitted to define a permission that should be auto-granted. Useful when another platform has the permission but Android does not.