@capacitor/android 5.3.1-nightly-20230913T150501.0 → 5.4.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.
@@ -1,10 +1,10 @@
1
1
  ext {
2
- androidxActivityVersion = project.hasProperty('androidxActivityVersion') ? rootProject.ext.androidxActivityVersion : '1.7.2'
2
+ androidxActivityVersion = project.hasProperty('androidxActivityVersion') ? rootProject.ext.androidxActivityVersion : '1.7.0'
3
3
  androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
4
4
  androidxCoordinatorLayoutVersion = project.hasProperty('androidxCoordinatorLayoutVersion') ? rootProject.ext.androidxCoordinatorLayoutVersion : '1.2.0'
5
- androidxCoreVersion = project.hasProperty('androidxCoreVersion') ? rootProject.ext.androidxCoreVersion : '1.10.1'
6
- androidxFragmentVersion = project.hasProperty('androidxFragmentVersion') ? rootProject.ext.androidxFragmentVersion : '1.6.1'
7
- androidxWebkitVersion = project.hasProperty('androidxWebkitVersion') ? rootProject.ext.androidxWebkitVersion : '1.7.0'
5
+ androidxCoreVersion = project.hasProperty('androidxCoreVersion') ? rootProject.ext.androidxCoreVersion : '1.10.0'
6
+ androidxFragmentVersion = project.hasProperty('androidxFragmentVersion') ? rootProject.ext.androidxFragmentVersion : '1.5.6'
7
+ androidxWebkitVersion = project.hasProperty('androidxWebkitVersion') ? rootProject.ext.androidxWebkitVersion : '1.6.1'
8
8
  junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
9
9
  androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
10
10
  androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
@@ -13,7 +13,7 @@ ext {
13
13
 
14
14
 
15
15
  buildscript {
16
- ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.9.10'
16
+ ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.8.20'
17
17
  repositories {
18
18
  google()
19
19
  mavenCentral()
@@ -22,7 +22,7 @@ buildscript {
22
22
  }
23
23
  }
24
24
  dependencies {
25
- classpath 'com.android.tools.build:gradle:8.1.1'
25
+ classpath 'com.android.tools.build:gradle:8.0.0'
26
26
 
27
27
  if (System.getenv("CAP_PUBLISH") == "true") {
28
28
  classpath 'io.github.gradle-nexus:publish-plugin:1.3.0'
@@ -42,10 +42,10 @@ if (System.getenv("CAP_PUBLISH") == "true") {
42
42
 
43
43
  android {
44
44
  namespace "com.getcapacitor.android"
45
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
45
+ compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
46
46
  defaultConfig {
47
47
  minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
48
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
48
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
49
49
  versionCode 1
50
50
  versionName "1.0"
51
51
  consumerProguardFiles 'proguard-rules.pro'
@@ -394,6 +394,7 @@ var nativeBridge = (function (exports) {
394
394
  win.CapacitorWebXMLHttpRequest = {
395
395
  abort: window.XMLHttpRequest.prototype.abort,
396
396
  constructor: window.XMLHttpRequest.prototype.constructor,
397
+ fullObject: window.XMLHttpRequest,
397
398
  getAllResponseHeaders: window.XMLHttpRequest.prototype.getAllResponseHeaders,
398
399
  getResponseHeader: window.XMLHttpRequest.prototype.getResponseHeader,
399
400
  open: window.XMLHttpRequest.prototype.open,
@@ -423,22 +424,21 @@ var nativeBridge = (function (exports) {
423
424
  if (doPatchHttp) {
424
425
  // fetch patch
425
426
  window.fetch = async (resource, options) => {
426
- if (!(resource.toString().startsWith('http:') ||
427
- resource.toString().startsWith('https:'))) {
427
+ const request = new Request(resource, options);
428
+ if (!(request.url.startsWith('http:') ||
429
+ request.url.startsWith('https:'))) {
428
430
  return win.CapacitorWebFetch(resource, options);
429
431
  }
430
432
  const tag = `CapacitorHttp fetch ${Date.now()} ${resource}`;
431
433
  console.time(tag);
432
434
  try {
433
435
  // intercept request & pass to the bridge
434
- const { data: requestData, type, headers, } = await convertBody((options === null || options === void 0 ? void 0 : options.body) || undefined);
435
- let optionHeaders = options === null || options === void 0 ? void 0 : options.headers;
436
- if ((options === null || options === void 0 ? void 0 : options.headers) instanceof Headers) {
437
- optionHeaders = Object.fromEntries(options.headers.entries());
438
- }
436
+ const { body, method } = request;
437
+ const { data: requestData, type, headers, } = await convertBody(body || undefined);
438
+ const optionHeaders = Object.fromEntries(request.headers.entries());
439
439
  const nativeResponse = await cap.nativePromise('CapacitorHttp', 'request', {
440
- url: resource,
441
- method: (options === null || options === void 0 ? void 0 : options.method) ? options.method : undefined,
440
+ url: request.url,
441
+ method: method,
442
442
  data: requestData,
443
443
  dataType: type,
444
444
  headers: Object.assign(Object.assign({}, headers), optionHeaders),
@@ -586,12 +586,22 @@ var nativeBridge = (function (exports) {
586
586
  }
587
587
  this._headers = nativeResponse.headers;
588
588
  this.status = nativeResponse.status;
589
+ const responseString = typeof nativeResponse.data !== 'string'
590
+ ? JSON.stringify(nativeResponse.data)
591
+ : nativeResponse.data;
589
592
  if (this.responseType === '' ||
590
593
  this.responseType === 'text') {
591
- this.response =
592
- typeof nativeResponse.data !== 'string'
593
- ? JSON.stringify(nativeResponse.data)
594
- : nativeResponse.data;
594
+ this.response = responseString;
595
+ }
596
+ else if (this.responseType === 'blob') {
597
+ this.response = new Blob([responseString], {
598
+ type: "application/json",
599
+ });
600
+ }
601
+ else if (this.responseType === 'arraybuffer') {
602
+ const encoder = new TextEncoder();
603
+ const uint8Array = encoder.encode(responseString);
604
+ this.response = uint8Array.buffer;
595
605
  }
596
606
  else {
597
607
  this.response = nativeResponse.data;
@@ -674,6 +684,7 @@ var nativeBridge = (function (exports) {
674
684
  Object.setPrototypeOf(xhr, prototype);
675
685
  return xhr;
676
686
  };
687
+ Object.assign(window.XMLHttpRequest, win.CapacitorWebXMLHttpRequest.fullObject);
677
688
  }
678
689
  }
679
690
  // patch window.console on iOS and store original console fns
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/android",
3
- "version": "5.3.1-nightly-20230913T150501.0",
3
+ "version": "5.4.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)",
@@ -23,7 +23,7 @@
23
23
  "verify": "./gradlew clean lint build test -b capacitor/build.gradle"
24
24
  },
25
25
  "peerDependencies": {
26
- "@capacitor/core": "^5.3.0-nightly-20230913T150501.0"
26
+ "@capacitor/core": "^5.4.0"
27
27
  },
28
28
  "publishConfig": {
29
29
  "access": "public"