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

Limiting permission requests using preferences #347

Closed
2 tasks
NXTAdmin opened this issue Mar 28, 2019 · 3 comments
Closed
2 tasks

Limiting permission requests using preferences #347

NXTAdmin opened this issue Mar 28, 2019 · 3 comments

Comments

@NXTAdmin
Copy link

I'm submitting a ... (check one with "x"):

  • [x ] bug report
  • feature request
  • documentation issue

Bug report

Current behavior:

I am trying to use the "Specify Modules" feature to limit the modules however it appears that the permission request texts are still added to the IOS plist.

My question is: can I specify modules using Phonegap Build?

snippet from my config.xml file:

<preference name="cordova.plugins.diagnostic.modules" value="LOCATION BLUETOOTH WIFI NOTIFICATIONS" /> 
<gap:plugin name="cordova.plugins.diagnostic"     source="npm" version="4.0.12" />

snippet from resulting plist showing camera which was not included:
NSCameraUsageDescription
This app requires camera access to function properly.

snippet from the Phonegap build log showing inclusion from npm:
Fetching plugin "cordova.plugins.diagnostic@4.0.12" via npm
Installing "cordova.plugins.diagnostic" at "4.0.12" for ios
5dca859ee01d3e97f4797c0ded29de2820a47670

Environment information
Using cloud based Phonegap Build

@dpa99c
Copy link
Owner

dpa99c commented Mar 30, 2019

This plugin uses a nodejs script executed via the npm-scripts postinstall hook to comment out modules not specified by the preference in config.xml, including iOS plist entries.

I have tried a test build on Phonegap Build and can confirm I'm able reproduce the same outcome: despite the preference in the config.xml specifying none but the default module, I still see the plist entries for all modules appear in the compiled IPA.

So my conclusion is that Phonegap Build doesn't support npm-scripts hooks and therefore the postinstall script on which this plugin relies to comment out unwanted modules is not being executed in the Phonegap Build environment.

Therefore without completely reworking the module selection functionality in this plugin, it will not be possible to support module selection in the Phonegap Build environment.
I will update the documentation to make this explicitly clear.

If you'd like to request that they add support for npm-scripts hooks, I would suggest opening a new issue against Phonegap Build.

Note that Phonegap Build also doesn't support Cordova hooks, so any plugins which rely on these will also not function correctly.

@dpa99c dpa99c closed this as completed in be2fcc1 Mar 30, 2019
@NXTAdmin
Copy link
Author

NXTAdmin commented Apr 1, 2019

Thanks for the quick response and thorough explanation.

@NXTAdmin
Copy link
Author

NXTAdmin commented Apr 1, 2019

A follow up question: I am using 2 features of this plugin:

  1. isLocationAvailable()
  2. isLocationEnabled()
    Can you recommend another plugin that supports these 2 features?
    Thanks

WGMB added a commit to WGMB/cordova-diagnostic-plugin that referenced this issue Sep 19, 2019
- Removed bluetooth module manually 
From docs: "IMPORTANT: Because Phonegap Build does not support npm-scripts hooks (see here for details) the module selection mechanism of this plugin will not work on Phonegap Build. I.e. all modules will be included in the build."

See: dpa99c#347
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants