Skip to content

Commit

Permalink
feat: Deprecated onRequestPermissionResult in favour for onRequestPer…
Browse files Browse the repository at this point in the history
…missionsResult for consistency (#1047)
  • Loading branch information
breautek committed Apr 13, 2021
1 parent cab9840 commit 6b33772
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions framework/src/org/apache/cordova/CordovaPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,24 @@ public boolean hasPermisssion() {
* @param requestCode
* @param permissions
* @param grantResults
*
* @deprecated Use {@link #onRequestPermissionsResult} instead.
*/
@Deprecated
public void onRequestPermissionResult(int requestCode, String[] permissions,
int[] grantResults) throws JSONException {

}

/**
* Called by the system when the user grants permissions
*
* @param requestCode
* @param permissions
* @param grantResults
*/
public void onRequestPermissionsResult(int requestCode, String[] permissions,
int[] grantResults) throws JSONException {

}
}
2 changes: 2 additions & 0 deletions framework/src/org/apache/cordova/PermissionHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ private static void deliverPermissionResult(CordovaPlugin plugin, int requestCod
Arrays.fill(requestResults, PackageManager.PERMISSION_GRANTED);

try {
// This one is deprecated - see https://github.com/apache/cordova-android/issues/592
plugin.onRequestPermissionResult(requestCode, permissions, requestResults);
plugin.onRequestPermissionsResult(requestCode, permissions, requestResults);
} catch (JSONException e) {
LOG.e(LOG_TAG, "JSONException when delivering permissions results", e);
}
Expand Down

0 comments on commit 6b33772

Please sign in to comment.