NativeScript/nativescript-camera

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

Ouverte

#151 ouverte le 26 nov. 2018

 (5 commentaires) (0 réaction) (0 personne assignée)TypeScript (46 forks)auto 404
featurehelp wanted

Métriques du dépôt

Stars
 (94 étoiles)
Métriques de merge PR
 (Métriques PR en attente)

Description

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?

Guide contributeur