@capacitor/android 9.0.1-nightly-20261203T151028.0 → 9.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -93,7 +93,7 @@ var nativeBridge = (function (exports) {
93
93
  try {
94
94
  data = JSON.parse(data);
95
95
  }
96
- catch (ignored) {
96
+ catch (_a) {
97
97
  // ignore
98
98
  }
99
99
  type = 'json';
@@ -363,7 +363,7 @@ var nativeBridge = (function (exports) {
363
363
  }
364
364
  return String(msg);
365
365
  }
366
- catch (e) {
366
+ catch (_a) {
367
367
  return '';
368
368
  }
369
369
  };
@@ -442,16 +442,11 @@ var nativeBridge = (function (exports) {
442
442
  };
443
443
  let doPatchHttp = false;
444
444
  // check if capacitor http is disabled before patching
445
- if (platform === 'ios') {
446
- if (((_b = win.CapacitorNativeConfig) === null || _b === void 0 ? void 0 : _b.httpEnabled) === true) {
447
- doPatchHttp = true;
448
- }
445
+ if (((_b = win.CapacitorNativeConfig) === null || _b === void 0 ? void 0 : _b.httpEnabled) != null) {
446
+ doPatchHttp = win.CapacitorNativeConfig.httpEnabled === true;
449
447
  }
450
- else if (typeof win.CapacitorHttpAndroidInterface !== 'undefined') {
451
- const isHttpEnabled = win.CapacitorHttpAndroidInterface.isEnabled();
452
- if (isHttpEnabled === true) {
453
- doPatchHttp = true;
454
- }
448
+ else if (platform === 'android' && typeof win.CapacitorHttpAndroidInterface !== 'undefined') {
449
+ doPatchHttp = win.CapacitorHttpAndroidInterface.isEnabled() === true;
455
450
  }
456
451
  if (doPatchHttp) {
457
452
  // fetch patch
@@ -1006,7 +1001,6 @@ var nativeBridge = (function (exports) {
1006
1001
  });
1007
1002
  });
1008
1003
  };
1009
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1010
1004
  cap.withPlugin = (_pluginId, _fn) => dummy;
1011
1005
  cap.Exception = CapacitorException;
1012
1006
  initEvents(win, cap);
@@ -947,7 +947,9 @@ public class Bridge {
947
947
  */
948
948
  private JSInjector getJSInjector() {
949
949
  try {
950
- String globalJS = JSExport.getGlobalJS(context, config.isLoggingEnabled(), isDevMode());
950
+ boolean cookiesEnabled = config.getPluginConfiguration("CapacitorCookies").isPatchEnabled();
951
+ boolean httpEnabled = config.getPluginConfiguration("CapacitorHttp").isPatchEnabled();
952
+ String globalJS = JSExport.getGlobalJS(context, config.isLoggingEnabled(), isDevMode(), cookiesEnabled, httpEnabled);
951
953
  String bridgeJS = JSExport.getBridgeJS(context);
952
954
  String pluginJS = JSExport.getPluginJS(plugins.values());
953
955
  String cordovaJS = JSExport.getCordovaJS(context);
@@ -21,6 +21,17 @@ public class JSExport {
21
21
  return "window.Capacitor = { DEBUG: " + isDebug + ", isLoggingEnabled: " + loggingEnabled + ", Plugins: {} };";
22
22
  }
23
23
 
24
+ static String getGlobalJS(Context context, boolean loggingEnabled, boolean isDebug, boolean cookiesEnabled, boolean httpEnabled) {
25
+ return (
26
+ getGlobalJS(context, loggingEnabled, isDebug) +
27
+ " window.CapacitorNativeConfig = { cookiesEnabled: " +
28
+ cookiesEnabled +
29
+ ", httpEnabled: " +
30
+ httpEnabled +
31
+ " };"
32
+ );
33
+ }
34
+
24
35
  public static String getMiscFileJS(ArrayList<String> paths, Context context) {
25
36
  List<String> lines = new ArrayList<>();
26
37
 
@@ -54,6 +54,11 @@ public class PluginConfig {
54
54
  return JSONUtils.getBoolean(config, configKey, defaultValue);
55
55
  }
56
56
 
57
+ // `disabled` wins over `enabled`: a disabled plugin is not registered.
58
+ boolean isPatchEnabled() {
59
+ return getBoolean("enabled", false) && !getBoolean("disabled", false);
60
+ }
61
+
57
62
  /**
58
63
  * Get an integer value for a plugin in the Capacitor config.
59
64
  *
@@ -180,8 +180,7 @@ public class WebViewLocalServer {
180
180
 
181
181
  if (null != loadingUrl.getPath() && loadingUrl.getPath().startsWith(Bridge.CAPACITOR_HTTP_INTERCEPTOR_START)) {
182
182
  PluginConfig httpConfig = bridge.getConfig().getPluginConfiguration("CapacitorHttp");
183
- boolean httpEnabled = httpConfig.getBoolean("enabled", false) && !httpConfig.getBoolean("disabled", false);
184
- if (!httpEnabled) {
183
+ if (!httpConfig.isPatchEnabled()) {
185
184
  return null;
186
185
  }
187
186
  Logger.debug("Handling CapacitorHttp request: " + loadingUrl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/android",
3
- "version": "9.0.1-nightly-20261203T151028.0",
3
+ "version": "9.1.0",
4
4
  "description": "Capacitor: Cross-platform apps with JavaScript and the web",
5
5
  "homepage": "https://capacitorjs.com",
6
6
  "author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
@@ -26,7 +26,7 @@
26
26
  "verify": "./gradlew :capacitor-android:clean :capacitor-android:lint :capacitor-android:build :capacitor-android:test"
27
27
  },
28
28
  "peerDependencies": {
29
- "@capacitor/core": "^9.0.0-nightly-20261203T151028.0"
29
+ "@capacitor/core": "^9.1.0"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"