Enhancement/Suggestion: open app settings on iOS with config option
Not an issue 😄 - I'll handle the PR work but wanted to check how the team thinks this should look/behave.
Currently if the permission to use camera is denied the requestPermissions method will reject. There are some cases where it would be useful to give the developer control over opening the app system settings.
The barcode scanner plugin takes this approach by providing a property of the options object to handle the flow.
I'd suggest the following be added to the current options for takePicture and wrapping inside an ios specific object so it's easily readable what this is for.
ios: {
// if true will attempt to open the system settings for the current application
openSettingsIfPermissionWasPreviouslyDenied: boolean;
// string for the confirmation dialog to open the system settings to enable permission
confirmOpeningSettingsMessage: string;
}
If the openSettingsIfPermissionWasPreviouslyDenied === true then
check confirmOpeningSettingsMessage for a value. If a value is provided show a confirmation dialog. If no string value for the confirmation, just open the settings.
Thoughts on suggestion or potential improvements?
Hi @bradmartin, this sounds like a good enhancement to me, so go for it! Indeed it would be convenient for users of the plugin to easily enable the app users to give permissions a bit easier if such have been previously denied.
Just to be consistent, maybe we should leave the default value to openSettingsIfPermissionWasPreviouslyDenied = false, so that the plugin behavior stays the same (not opening settings on initial denial). If devs want to enable it - set it to true.
Any progress with this? @bradmartin
:) @OPADA-Eng - long time ago, I thought I actually ended up making a PR for this, but it might have been on the location plugin to provide a similar option. It was fairly straight forward, just making sure the logic was sound was a bit of work to handle fallbacks.
This looks like what I recall working on https://github.com/NativeScript/nativescript-geolocation/blob/a8d9a1f0fe73def247796cf14cc5539ece7f5192/src/geolocation.ios.ts#L255 and I wanted to add similar to the camera plugin. Just never had time for it.
Thanks, @bradmartin for your reply, Are you planning to do this in the near future?
Currently it's not on my radar. I'm doing other updates to various plugins to support NS 7 that was just released. I'd like to put this on the list eventually tho :) but no time frame for now.