Skip to content

chore: cleanup PermissionHelper#1925

Open
GitToTheHub wants to merge 2 commits into
masterfrom
pr-cleanup-PermissionHelper
Open

chore: cleanup PermissionHelper#1925
GitToTheHub wants to merge 2 commits into
masterfrom
pr-cleanup-PermissionHelper

Conversation

@GitToTheHub
Copy link
Copy Markdown
Contributor

@GitToTheHub GitToTheHub commented May 15, 2026

Platforms affected

  • Android

Motivation and Context

  • AndroidStudio complained about methods not found linked in JavaDoc for the class CordovaInterface: requestPermission(), requestPermissions() and hasPermission(). The parameter types were missing and were added.
  • Removing unused imports
  • Added missing @Deprecated Java annotations

Description

Testing

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

- AndroidStudio complained about methods not found linked in JavaDoc for the class CordovaInterface: requestPermission(), requestPermissions() and hasPermission(). The parameter types were missing and were added.
- Removing unused imports
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.43%. Comparing base (2450217) to head (fc9f8a2).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1925   +/-   ##
=======================================
  Coverage   61.43%   61.43%           
=======================================
  Files          24       24           
  Lines        4922     4922           
=======================================
  Hits         3024     3024           
  Misses       1898     1898           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@erisu
Copy link
Copy Markdown
Member

erisu commented May 15, 2026

I'm not sure whether this class should be deprecated and would like to hear others' opinions.

GitHub search isn't always thorough, but it appears that 846 files are importing this class. Also, I believe the 846 files include forked repos, but there are some unique plugin repositories in the list.

https://github.com/search?q=import+org.apache.cordova.PermissionHelper&type=code

Deprecation would only warn, not break builds, but I'm concerned about how many of these plugins are unmaintained and whether removing the class entirely in the future could cause issues.

@GitToTheHub
Copy link
Copy Markdown
Contributor Author

I looked through the search results and cordova-plugin-camera is one of the first search results which uses the PermissionHelper. The next one is cordova-plugin-audioinput which is actively maintained. The fix would be straightforward. The plugin calls instead of PermissionHelper.hasPermission just cordova.hasPermission. The same for PermissionHelper.requestPermission it would call cordova.requestPermission and for PermissionHelper.requestPermissions it would call cordova.requestPermissions. The right way would be to call the methods directly on CordovaInterface of the CordovaPlugin instead calling PermissionHelper which forwards the calls to it. How would you do the transitioning? Would it be the right approach to leave everything like it is, though it is not necessary? The minimum would be to inform plugin authors to change the way of calling it. A deprecation notice would be a first good way.

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

Successfully merging this pull request may close these issues.

3 participants