From 855a60711bcf6cff3215a36fac7e5314a2c4d159 Mon Sep 17 00:00:00 2001 From: Carl Poole Date: Sat, 12 Dec 2020 18:13:32 -0600 Subject: [PATCH] fix(Android): Use plugin's getPermissionStates() to support overriding (#3939) --- android/capacitor/src/main/java/com/getcapacitor/Bridge.java | 2 +- android/capacitor/src/main/java/com/getcapacitor/Plugin.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/android/capacitor/src/main/java/com/getcapacitor/Bridge.java b/android/capacitor/src/main/java/com/getcapacitor/Bridge.java index f926386104..cd582024dd 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/Bridge.java +++ b/android/capacitor/src/main/java/com/getcapacitor/Bridge.java @@ -789,7 +789,7 @@ public void onRequestPermissionsResult(int requestCode, String[] permissions, in if (validatePermissions(plugin.getInstance(), savedPermissionCall, permissions, grantResults)) { // handle request permissions call if (savedPermissionCall.getMethodName().equals("requestPermissions")) { - savedPermissionCall.resolve(getPermissionStates(plugin.getInstance())); + savedPermissionCall.resolve(plugin.getInstance().getPermissionStates()); } else { // handle permission requests by other methods on the plugin plugin.getInstance().onRequestPermissionsResult(savedPermissionCall, requestCode, permissions, grantResults); diff --git a/android/capacitor/src/main/java/com/getcapacitor/Plugin.java b/android/capacitor/src/main/java/com/getcapacitor/Plugin.java index 899c3b60da..b569986626 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/Plugin.java +++ b/android/capacitor/src/main/java/com/getcapacitor/Plugin.java @@ -494,7 +494,7 @@ public void removeAllListeners(PluginCall call) { */ @PluginMethod public void checkPermissions(PluginCall pluginCall) { - JSObject permissionsResult = bridge.getPermissionStates(this); + JSObject permissionsResult = getPermissionStates(); if (permissionsResult.length() == 0) { // if no permissions are defined on the plugin, resolve undefined