Skip to content
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

Ask For Permission attached to specific slide #1149

Open
1 of 2 tasks
newhinton opened this issue Oct 16, 2023 · 6 comments · May be fixed by #1150
Open
1 of 2 tasks

Ask For Permission attached to specific slide #1149

newhinton opened this issue Oct 16, 2023 · 6 comments · May be fixed by #1150

Comments

@newhinton
Copy link

⚠️ Is your feature request related to a problem? Please describe

When dealing with different API-Levels, it might not be nessessary to ask for specific permissions. In those cases, the slide numbers change for permissions on the next slide. This means the developer needs to keep track of the slide position himself.

💡 Describe the solution you'd like

I would like to see a method that lets the developer to attach a permission to a specifc slide via tags.

askForPermissionsOnSlide(arrayOf(Manifest.permission.CAMERA), TAG)
askForPermissionsAfterSlide(arrayOf(Manifest.permission.CAMERA), TAG)

If a slide is shown with TAG, then the permission can be requested either on or after the slide is shown.

🤚 Do you want to develop this feature yourself?

  • Yes
  • No
@newhinton newhinton linked a pull request Oct 16, 2023 that will close this issue
1 task
@cortinico
Copy link
Member

I would like to see a method that lets the developer to attach a permission to a specifc slide via tags.

Can you clarify what is a TAG in this context?

@cortinico
Copy link
Member

I got it from your PR, thanks for submitting it. I think this change is quite invasive and I'm unsure we want to offer it.

@newhinton
Copy link
Author

newhinton commented Oct 16, 2023

Invasive? Its a relatively small change, that doesnt even affect existing installations, what problems do you see for the future with this? Is there something i could improve?

@cortinico
Copy link
Member

You're basically introducing a new concept (the 'tag') for all the users, that is needed only for a specific feature. I'd rather find a different approach.

For example, something like this overload:

askForPermissions(Array<String>, Fragment, Boolean)

would work better imho

@newhinton
Copy link
Author

The tag itself is entirely optional, but i see the point that it might make the change bigger than it needs to be. Though implementing your Fragment argument might require a huge change to the code to fit it into the permissionMap without breaking the existing slideNumbers.

However, another addition to attaching permissions to a specific slide would be, that it makes recognizing a specific slide more easy.

As an eyample, to request storage permissions i have to write custom code and call that. To do so, i need to check on which slide i am, and on what slide i am supposed to make the request. I have to keep track of the slideNumbers again. With a tag, i can just check wether or not i am on my target slide.

On the other hand, i will have to check if it is possible to archieve the same with a reference to the fragment itself as you proposed.

@newhinton
Copy link
Author

@cortinico

I have updated the PR to accept a fragment:


        // Here we ask for camera permission on slide 2
        askForPermissions(arrayOf(Manifest.permission.CAMERA), 2)

        // Here we ask for Location permission on slide 4
        askForPermissions(arrayOf(Manifest.permission.ACCESS_FINE_LOCATION), "yourCoolId")

        // Here we ask for Calendar permission on slide 5
        askForPermissions(arrayOf(Manifest.permission.READ_CALENDAR), calendarPermissionFragment)

The tag is now an id, and a property of AppIntroFragment (AppIntroFragment.slideId)
I have still exposed the ability to expose the id to the user, because the logic i use is basically the same. If a fragment is passed to the askForPermission function, the slideId is used to identify the permission in the map. If it is specifically set by the dev, it is used as-is, but if none was set i generate a UUID on the fly so that the id is not a requirement anymore. Though i think it really could be useful to identify specific slides easily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants