question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CordovaPlugin.hasPermisssion method name typo

See original GitHub issue

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
brodybitscommented, Nov 29, 2018

From a quick code search I find the misspelled hasPermisssion method is called in only one piece of code, in the following function: https://github.com/apache/cordova-android/blob/8a4ae311ce165e31f0511ae43274aa52d3773fd2/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java#L170-L180

I think this would only be an issue for any plugins with feature name=“Geolocation”, and not many plugins other than cordova-plugin-geolocation would use this feature name.

I think of the following quick solution:

  • we introduce the correct method name (“hasPermission”) in CordovaPlugin.java
  • CordovaPlugin.java tries both “hasPermission” and misspelled hasPermisssion
  • Update cordova-plugin-geolocation to override the new method, in a major version increase, with dependency on new cordova-android engine version
  • Mark the incorrect hasPermisssion method as deprecated, for complete removal at some point in the future (with plenty of warning of course)

Ideas for refinement:

  • new callback method should be void onGeolocationPermissions or onGeolocationPermissionsShowPrompt hook function, which the plugin would override to call its own requestPermissions function if necessary
  • make it possible for multiple plugins to override the new callback, and Cordova would query all plugins, like it does on onPause, onReceivedHttpAuthRequest, etc.
0reactions
shadercommented, Nov 29, 2018

How hard would it be to make it so that older plugins can be built against a specific version of the plugin API? That would help, even if whoever is using the plugins has to explicitly configure it (since obviously the plugin itself will not).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deprecate old plugin target-dir structure support #580 - GitHub
I already warned cordova-plugin-purchase in j3k0/cordova-plugin-purchase#766, we should probably ... hasPermisssion method name typo #593.
Read more >
Issues with android permissions in Cordova - Stack Overflow
On Android >=6.0, Android app should request permission runtime. So in Cordova, you can use the permission plugin like following
Read more >
sc-cordova-plugin-email-composer - npm
Provides access to the standard interface that manages the editing and sending an email message . Latest version: 1.0.0, last published: 5 ...
Read more >
cordova-plugin-health/Lobby - Gitter
Sorry I made a typo above, the config xml should be. <plugin name="cordova-plugin-health" source="npm" spec="2.0.0" >. <preference name="AndroidXEnabled" ...
Read more >
cordova-plugin-email-composer | Yarn - Package Manager
document.addEventListener('deviceready', function () { // cordova.plugins.email is now available }, false);.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found