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

Enhancement/Suggestion: open app settings on iOS with config option #151

Open
bradmartin opened this issue Nov 26, 2018 · 5 comments
Open

Comments

@bradmartin
Copy link

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?

@tbozhikov
Copy link
Contributor

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.

@OPADA-Eng
Copy link

OPADA-Eng commented Sep 1, 2020

Any progress with this? @bradmartin

@bradmartin
Copy link
Author

:) @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.

@OPADA-Eng
Copy link

Thanks, @bradmartin for your reply,
Are you planning to do this in the near future?

@bradmartin
Copy link
Author

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.

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

No branches or pull requests

4 participants