NativeScript/nativescript-camera

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

开放

#151 创建于 2018年11月26日

 (5 条评论) (0 个反应) (0 位负责人)TypeScript (46 个派生)auto 404
featurehelp wanted

仓库指标

星标
 (94 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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?

贡献者指南