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

[Request] Ability to close the Dialog when permissions have been set from the Settings app #118

Closed KevinQuisquater closed 4 years ago

KevinQuisquater commented 5 years ago

Hi Ivan, and thanks a lot for your work.

I've noticed that if the user has to leave the app (go to Settings to allow a permission), when they come back, the UI of the dialog updates accordingly (awesome) but the alert does not hide automatically, even if all permissions have been set. The delegate methods also do not get called, and even if they did, there is no method to force the Dialog to hide (I think?).

I was wondering if it would be possible to implement one of these options:

  1. When the UI is updated when the user comes back from another app (Settings) and the app becomes active, also call the appropriate didAllow or didDeny delegate methods + provide a way to hide the dialog programmatically, for instance: SPPermission.Dialog.hide() OR
  2. When the UI is updated after the user comes back from another app (Settings), if all permissions have been allowed, close the Dialog and call didHide.

I suspect 2 is much more straightforward to implement, as it doesn't require to keep track of what permissions have changed.

Thanks a lot and no worries at all if it would be too time-consuming to implement, Kevin

KevinQuisquater commented 5 years ago

PS: if anyone needs a hack to temporarily do this, here's what I do:

You will need to edit the pod and make func hide(withDialog: Bool) { public in SPPermissionDialogController.

ivanvorobei commented 5 years ago

@KevinQuisquater, this is a temporary solution, it works. Thanks.

I will solve this problem soon

KevinQuisquater commented 5 years ago

Thanks a lot @ivanvorobei, not urgent at all because there is a workaround.

Thank you!

ivanvorobei commented 4 years ago

@KevinQuisquater I test you case now (wow, big delay, sorry), now if change any state permission app full reload. It not problem of SPPermissions, it in iOS. I think no need reload permissions now if reload app.

Also I am publish new version 5.0, you can try using it)

KevinQuisquater commented 4 years ago

Thanks Ivan, I am not working with that project anymore but appreciate you taking the time to reply and to ship a new version! Wish you the best