Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): Release the call after reject/resolve #4318

Merged
merged 2 commits into from
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ public void sendResponseMessage(PluginCall call, PluginResult successResult, Plu
} catch (Exception ex) {
Logger.error("sendResponseMessage: error: " + ex);
}
if (!call.isKeptAlive()) {
call.release(bridge);
}
}

private void callPluginMethod(String callbackId, String pluginId, String methodName, JSObject methodData) {
Expand Down
9 changes: 0 additions & 9 deletions android/capacitor/src/main/java/com/getcapacitor/Plugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@ private void triggerPermissionCallback(Method method, Map<String, Boolean> permi

// validate permissions and invoke the permission result callback
if (bridge.validatePermissions(this, savedCall, permissionResultMap)) {
if (!savedCall.isKeptAlive()) {
savedCall.release(bridge);
}

try {
method.setAccessible(true);
method.invoke(this, savedCall);
Expand All @@ -158,11 +154,6 @@ private void triggerActivityCallback(Method method, ActivityResult result) {
if (savedCall == null) {
savedCall = bridge.getPluginCallForLastActivity();
}

if (!savedCall.isKeptAlive()) {
savedCall.release(bridge);
}

// invoke the activity result callback
try {
method.setAccessible(true);
Expand Down