mirror of
https://github.com/apache/cordova-android.git
synced 2026-05-30 00:00:04 +08:00
Call new method CordovaPlugin.onRequestPermissionsResult (#1855)
- Fixes https://github.com/apache/cordova-android/issues/1388 - `CordovaInterfaceImpl` called the deprecated method `CordovaPlugin.onRequestPermissionResult` but not the new one. Now the one will also be called. - Renamed `CordovaInterfaceImpl.onRequestPermissionResult` to `CordovaInterfaceImpl.onRequestPermissionsResult` to reflect the new method name
This commit is contained in:
@@ -577,7 +577,7 @@ public class CordovaActivity extends AppCompatActivity {
|
||||
|
||||
try
|
||||
{
|
||||
cordovaInterface.onRequestPermissionResult(requestCode, permissions, grantResults);
|
||||
cordovaInterface.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
catch (JSONException e)
|
||||
{
|
||||
|
||||
@@ -217,11 +217,15 @@ public class CordovaInterfaceImpl implements CordovaInterface {
|
||||
* @param permissions
|
||||
* @param grantResults
|
||||
*/
|
||||
public void onRequestPermissionResult(int requestCode, String[] permissions,
|
||||
public void onRequestPermissionsResult(int requestCode, String[] permissions,
|
||||
int[] grantResults) throws JSONException {
|
||||
Pair<CordovaPlugin, Integer> callback = permissionResultCallbacks.getAndRemoveCallback(requestCode);
|
||||
if(callback != null) {
|
||||
// This one is deprecated - see https://github.com/apache/cordova-android/issues/592
|
||||
// and should be removed in a future release
|
||||
callback.first.onRequestPermissionResult(callback.second, permissions, grantResults);
|
||||
// Call the new method
|
||||
callback.first.onRequestPermissionsResult(callback.second, permissions, grantResults);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user