@capacitor/android 9.0.0-nightly-20260211T152431.0 → 9.0.0-rc.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.
Files changed (30) hide show
  1. package/capacitor/build.gradle +10 -13
  2. package/capacitor/proguard-rules.pro +10 -10
  3. package/capacitor/src/main/assets/native-bridge.js +7 -20
  4. package/capacitor/src/main/java/com/getcapacitor/Bridge.java +143 -271
  5. package/capacitor/src/main/java/com/getcapacitor/BridgeActivity.java +10 -4
  6. package/capacitor/src/main/java/com/getcapacitor/BridgeWebChromeClient.java +3 -2
  7. package/capacitor/src/main/java/com/getcapacitor/CapConfig.java +0 -119
  8. package/capacitor/src/main/java/com/getcapacitor/CordovaBridgeConfig.java +6 -0
  9. package/capacitor/src/main/java/com/getcapacitor/FileUtils.java +1 -1
  10. package/capacitor/src/main/java/com/getcapacitor/MessageHandler.java +11 -46
  11. package/capacitor/src/main/java/com/getcapacitor/Plugin.java +63 -249
  12. package/capacitor/src/main/java/com/getcapacitor/PluginCall.java +0 -43
  13. package/capacitor/src/main/java/com/getcapacitor/PluginConfig.java +11 -0
  14. package/capacitor/src/main/java/com/getcapacitor/PluginHandle.java +7 -28
  15. package/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java +44 -16
  16. package/capacitor/src/main/java/com/getcapacitor/plugin/CapacitorCookieManager.java +3 -3
  17. package/capacitor/src/main/java/com/getcapacitor/plugin/SystemBars.java +154 -96
  18. package/capacitor/src/main/java/com/getcapacitor/plugin/util/CapacitorHttpUrlConnection.java +61 -16
  19. package/capacitor/src/main/java/com/getcapacitor/plugin/util/HttpRequestHandler.java +15 -3
  20. package/capacitor/src/main/java/com/getcapacitor/util/JSONUtils.java +20 -0
  21. package/capacitor-cordova/build.gradle +44 -0
  22. package/capacitor-cordova/proguard-rules.pro +4 -0
  23. package/capacitor-cordova/src/main/AndroidManifest.xml +3 -0
  24. package/capacitor-cordova/src/main/java/com/getcapacitor/cordova/CordovaPlugin.java +145 -0
  25. package/{capacitor → capacitor-cordova}/src/main/java/com/getcapacitor/cordova/MockCordovaInterfaceImpl.java +1 -1
  26. package/{capacitor → capacitor-cordova}/src/main/java/com/getcapacitor/cordova/MockCordovaWebViewImpl.java +16 -11
  27. package/capacitor-cordova/src/main/res/raw/capacitor_cordova_keep.xml +1 -0
  28. package/package.json +7 -4
  29. package/capacitor/src/main/java/com/getcapacitor/NativePlugin.java +0 -37
  30. /package/{capacitor → capacitor-cordova}/src/main/java/com/getcapacitor/cordova/CapacitorCordovaCookieManager.java +0 -0
@@ -1,14 +1,13 @@
1
1
  ext {
2
- androidxActivityVersion = project.hasProperty('androidxActivityVersion') ? rootProject.ext.androidxActivityVersion : '1.11.0'
3
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.1'
2
+ androidxActivityVersion = project.hasProperty('androidxActivityVersion') ? rootProject.ext.androidxActivityVersion : '1.13.0'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.8.0'
4
4
  androidxCoordinatorLayoutVersion = project.hasProperty('androidxCoordinatorLayoutVersion') ? rootProject.ext.androidxCoordinatorLayoutVersion : '1.3.0'
5
- androidxCoreVersion = project.hasProperty('androidxCoreVersion') ? rootProject.ext.androidxCoreVersion : '1.17.0'
6
- androidxFragmentVersion = project.hasProperty('androidxFragmentVersion') ? rootProject.ext.androidxFragmentVersion : '1.8.9'
7
- androidxWebkitVersion = project.hasProperty('androidxWebkitVersion') ? rootProject.ext.androidxWebkitVersion : '1.14.0'
5
+ androidxCoreVersion = project.hasProperty('androidxCoreVersion') ? rootProject.ext.androidxCoreVersion : '1.19.1'
6
+ androidxFragmentVersion = project.hasProperty('androidxFragmentVersion') ? rootProject.ext.androidxFragmentVersion : '1.9.1'
7
+ androidxWebkitVersion = project.hasProperty('androidxWebkitVersion') ? rootProject.ext.androidxWebkitVersion : '1.17.1'
8
8
  junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
9
9
  androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.3.0'
10
10
  androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.7.0'
11
- cordovaAndroidVersion = project.hasProperty('cordovaAndroidVersion') ? rootProject.ext.cordovaAndroidVersion : '14.0.1'
12
11
  }
13
12
 
14
13
 
@@ -21,10 +20,10 @@ buildscript {
21
20
  }
22
21
  }
23
22
  dependencies {
24
- classpath 'com.android.tools.build:gradle:8.13.0'
23
+ classpath 'com.android.tools.build:gradle:9.4.1'
25
24
 
26
25
  if (System.getenv("CAP_PUBLISH") == "true") {
27
- classpath 'io.github.gradle-nexus:publish-plugin:1.3.0'
26
+ classpath 'io.github.gradle-nexus:publish-plugin:2.0.0'
28
27
  }
29
28
  }
30
29
  }
@@ -41,10 +40,9 @@ if (System.getenv("CAP_PUBLISH") == "true") {
41
40
 
42
41
  android {
43
42
  namespace = "com.getcapacitor.android"
44
- compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
43
+ compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 37
45
44
  defaultConfig {
46
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
47
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
45
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 26
48
46
  versionCode 1
49
47
  versionName "1.0"
50
48
  consumerProguardFiles 'proguard-rules.pro'
@@ -87,8 +85,7 @@ dependencies {
87
85
  testImplementation "junit:junit:$junitVersion"
88
86
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
89
87
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
90
- implementation "org.apache.cordova:framework:$cordovaAndroidVersion"
91
- testImplementation 'org.json:json:20250517'
88
+ testImplementation 'org.json:json:20250517'
92
89
  testImplementation 'org.mockito:mockito-core:5.20.0'
93
90
  }
94
91
 
@@ -15,14 +15,14 @@
15
15
 
16
16
  -keep public class * extends com.getcapacitor.Plugin { *; }
17
17
 
18
- # Rules for Capacitor v2 plugins and annotations
19
- # These are deprecated but can still be used with Capacitor for now
20
- -keep @com.getcapacitor.NativePlugin public class * {
21
- @com.getcapacitor.PluginMethod public <methods>;
22
- }
18
+ # The annotation types are read at runtime via reflection. If they are not kept, R8 full mode
19
+ # treats them as never instantiated and optimizes the annotation cached in PluginHandle to null,
20
+ # even with -keepattributes *Annotation*.
21
+ -keep @interface com.getcapacitor.annotation.** { *; }
22
+ -keep @interface com.getcapacitor.PluginMethod { *; }
23
23
 
24
- # Rules for Cordova plugins
25
- -keep public class * extends org.apache.cordova.* {
26
- public <methods>;
27
- public <fields>;
28
- }
24
+ # Callback methods are found by reflection, including on non-public base classes.
25
+ -keepclassmembers class * extends com.getcapacitor.Plugin {
26
+ @com.getcapacitor.annotation.ActivityCallback <methods>;
27
+ @com.getcapacitor.annotation.PermissionCallback <methods>;
28
+ }
@@ -314,6 +314,7 @@ var nativeBridge = (function (exports) {
314
314
  win.Ionic.WebView = IonicWebView;
315
315
  };
316
316
  const initLogger = (win, cap) => {
317
+ var _a, _b;
317
318
  const BRIDGED_CONSOLE_METHODS = ['debug', 'error', 'info', 'log', 'trace', 'warn'];
318
319
  const createLogFromNative = (c) => (result) => {
319
320
  if (isFullConsole(c)) {
@@ -367,12 +368,6 @@ var nativeBridge = (function (exports) {
367
368
  }
368
369
  };
369
370
  const platform = getPlatformId(win);
370
- if (platform == 'android' && typeof win.CapacitorSystemBarsAndroidInterface !== 'undefined') {
371
- // add DOM ready listener for System Bars
372
- document.addEventListener('DOMContentLoaded', function () {
373
- win.CapacitorSystemBarsAndroidInterface.onDOMReady();
374
- });
375
- }
376
371
  if (platform == 'android' || platform == 'ios') {
377
372
  // patch document.cookie on Android/iOS
378
373
  win.CapacitorCookiesDescriptor =
@@ -381,13 +376,7 @@ var nativeBridge = (function (exports) {
381
376
  let doPatchCookies = false;
382
377
  // check if capacitor cookies is disabled before patching
383
378
  if (platform === 'ios') {
384
- // Use prompt to synchronously get capacitor cookies config.
385
- // https://stackoverflow.com/questions/29249132/wkwebview-complex-communication-between-javascript-native-code/49474323#49474323
386
- const payload = {
387
- type: 'CapacitorCookies.isEnabled',
388
- };
389
- const isCookiesEnabled = prompt(JSON.stringify(payload));
390
- if (isCookiesEnabled === 'true') {
379
+ if (((_a = win.CapacitorNativeConfig) === null || _a === void 0 ? void 0 : _a.cookiesEnabled) === true) {
391
380
  doPatchCookies = true;
392
381
  }
393
382
  }
@@ -454,13 +443,7 @@ var nativeBridge = (function (exports) {
454
443
  let doPatchHttp = false;
455
444
  // check if capacitor http is disabled before patching
456
445
  if (platform === 'ios') {
457
- // Use prompt to synchronously get capacitor http config.
458
- // https://stackoverflow.com/questions/29249132/wkwebview-complex-communication-between-javascript-native-code/49474323#49474323
459
- const payload = {
460
- type: 'CapacitorHttp',
461
- };
462
- const isHttpEnabled = prompt(JSON.stringify(payload));
463
- if (isHttpEnabled === 'true') {
446
+ if (((_b = win.CapacitorNativeConfig) === null || _b === void 0 ? void 0 : _b.httpEnabled) === true) {
464
447
  doPatchHttp = true;
465
448
  }
466
449
  }
@@ -505,6 +488,10 @@ var nativeBridge = (function (exports) {
505
488
  if (typeof resource === 'string') {
506
489
  return await win.CapacitorWebFetch(createProxyUrl(resource, win), options);
507
490
  }
491
+ else if (resource instanceof URL) {
492
+ const modifiedURL = new URL(createProxyUrl(resource.toString(), win));
493
+ return await win.CapacitorWebFetch(modifiedURL, options);
494
+ }
508
495
  else if (resource instanceof Request) {
509
496
  const modifiedRequest = new Request(createProxyUrl(resource.url, win), resource);
510
497
  return await win.CapacitorWebFetch(modifiedRequest, options);