Skip to content

Commit

Permalink
fix(android): revert cookie manager initialization to plugin load
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsChaceD authored Jun 29, 2023
1 parent 7906d36 commit 53a2d47
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,15 @@ public class CapacitorCookies extends Plugin {
@Override
public void load() {
this.bridge.getWebView().addJavascriptInterface(this, "CapacitorCookiesAndroidInterface");
this.cookieManager = new CapacitorCookieManager(null, java.net.CookiePolicy.ACCEPT_ALL, this.bridge);
CookieHandler.setDefault(this.cookieManager);
super.load();
}

@JavascriptInterface
public boolean isEnabled() {
PluginConfig pluginConfig = getBridge().getConfig().getPluginConfiguration("CapacitorCookies");
boolean isEnabled = pluginConfig.getBoolean("enabled", false);
if (isEnabled) {
this.cookieManager = new CapacitorCookieManager(null, java.net.CookiePolicy.ACCEPT_ALL, this.bridge);
CookieHandler.setDefault(cookieManager);
}
return isEnabled;
return pluginConfig.getBoolean("enabled", false);
}

/**
Expand Down

0 comments on commit 53a2d47

Please sign in to comment.