sparrowcode / PermissionsKit

Universal API for request permission and get its statuses.
https://x.com/sparrowcode_ios
MIT License
5.64k stars 462 forks source link

Allow overriding HandleTap behaviour which hides the request by default #92

Closed dragosrobertn closed 5 years ago

dragosrobertn commented 5 years ago

Hi Ivan,

I have recently discovered your SPPermission Controller library and found it great to use. However I found that I actually wanted to customise the behaviour a bit and disable the close button and dragging as well as override the handleTap() function.

Currently, if the showCloseButton and the dragEnabled booleans are set to false, when the user taps the dialog (and they might tap inside or outside the dialog) it dismisses it by default. I want to use the dialog as a standalone interface in one of my apps and basically handle myself when it is ok for the dialog to disappear or be dismissed using the didAllow() or didDenied().

Would it be possible to expose the handleTap() action through the data source or another protocol and override it?

Thanks.

ivanvorobei commented 5 years ago

Please describe in more detail why you use the function ‘handleTap()’

dragosrobertn commented 5 years ago

Hi Ivan, I don't use it right now, but I would like to use it.

Right now I am showing the dialog as part of onboarding and I would like to keep showing it until at least 1 or more permissions have been granted. If showCloseButton and the dragEnabled are set to false, then it gets dismissed if the user taps by mistake anywhere, so I have to either show it again or handle it in a different way.

Particularly I don't mind that handleTap() it exists, but the default implementation dismisses the dialog.

By making it available to be overridden, it would make using the dialog and its default behaviour more flexible.

Hope this helps.

ivanvorobei commented 5 years ago

I’ll leave the request open for now, if someone else needs it, I’ll add this functionality.

dragosrobertn commented 5 years ago

Thank you Ivan.

Am I ok to fork this repository in the mean time and enable this functionality myself?

ivanvorobei commented 5 years ago

Of course