@capacitor/android 5.5.1 → 5.5.2-nightly-20231027T150432.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.
- package/capacitor/build.gradle +8 -8
- package/capacitor/src/main/assets/native-bridge.js +9 -69
- package/capacitor/src/main/java/com/getcapacitor/Bridge.java +3 -0
- package/capacitor/src/main/java/com/getcapacitor/CapConfig.java +17 -4
- package/capacitor/src/main/java/com/getcapacitor/plugin/CapacitorCookies.java +25 -40
- package/package.json +2 -2
package/capacitor/build.gradle
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
ext {
|
|
2
|
-
androidxActivityVersion = project.hasProperty('androidxActivityVersion') ? rootProject.ext.androidxActivityVersion : '1.
|
|
2
|
+
androidxActivityVersion = project.hasProperty('androidxActivityVersion') ? rootProject.ext.androidxActivityVersion : '1.8.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.
|
|
6
|
-
androidxFragmentVersion = project.hasProperty('androidxFragmentVersion') ? rootProject.ext.androidxFragmentVersion : '1.
|
|
7
|
-
androidxWebkitVersion = project.hasProperty('androidxWebkitVersion') ? rootProject.ext.androidxWebkitVersion : '1.
|
|
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'
|
|
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.
|
|
16
|
+
ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.9.10'
|
|
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.
|
|
25
|
+
classpath 'com.android.tools.build:gradle:8.1.1'
|
|
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 :
|
|
45
|
+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
|
|
46
46
|
defaultConfig {
|
|
47
47
|
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
|
|
48
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
48
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
|
|
49
49
|
versionCode 1
|
|
50
50
|
versionName "1.0"
|
|
51
51
|
consumerProguardFiles 'proguard-rules.pro'
|
|
@@ -64,52 +64,8 @@ var nativeBridge = (function (exports) {
|
|
|
64
64
|
}
|
|
65
65
|
return newFormData;
|
|
66
66
|
};
|
|
67
|
-
const convertBody = async (body
|
|
68
|
-
if (body instanceof
|
|
69
|
-
const reader = body.getReader();
|
|
70
|
-
const chunks = [];
|
|
71
|
-
while (true) {
|
|
72
|
-
const { done, value } = await reader.read();
|
|
73
|
-
if (done)
|
|
74
|
-
break;
|
|
75
|
-
chunks.push(value);
|
|
76
|
-
}
|
|
77
|
-
const concatenated = new Uint8Array(chunks.reduce((acc, chunk) => acc + chunk.length, 0));
|
|
78
|
-
let position = 0;
|
|
79
|
-
for (const chunk of chunks) {
|
|
80
|
-
concatenated.set(chunk, position);
|
|
81
|
-
position += chunk.length;
|
|
82
|
-
}
|
|
83
|
-
let data = new TextDecoder().decode(concatenated);
|
|
84
|
-
let type;
|
|
85
|
-
if (contentType === 'application/json') {
|
|
86
|
-
try {
|
|
87
|
-
data = JSON.parse(data);
|
|
88
|
-
}
|
|
89
|
-
catch (ignored) {
|
|
90
|
-
// ignore
|
|
91
|
-
}
|
|
92
|
-
type = 'json';
|
|
93
|
-
}
|
|
94
|
-
else if (contentType === 'multipart/form-data') {
|
|
95
|
-
type = 'formData';
|
|
96
|
-
}
|
|
97
|
-
else if (contentType === null || contentType === void 0 ? void 0 : contentType.startsWith('image')) {
|
|
98
|
-
type = 'image';
|
|
99
|
-
}
|
|
100
|
-
else if (contentType === 'application/octet-stream') {
|
|
101
|
-
type = 'binary';
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
type = 'text';
|
|
105
|
-
}
|
|
106
|
-
return {
|
|
107
|
-
data,
|
|
108
|
-
type,
|
|
109
|
-
headers: { 'Content-Type': contentType || 'application/octet-stream' },
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
else if (body instanceof FormData) {
|
|
67
|
+
const convertBody = async (body) => {
|
|
68
|
+
if (body instanceof FormData) {
|
|
113
69
|
const formData = await convertFormData(body);
|
|
114
70
|
const boundary = `${Date.now()}`;
|
|
115
71
|
return {
|
|
@@ -475,10 +431,9 @@ var nativeBridge = (function (exports) {
|
|
|
475
431
|
const tag = `CapacitorHttp fetch ${Date.now()} ${resource}`;
|
|
476
432
|
console.time(tag);
|
|
477
433
|
try {
|
|
478
|
-
// intercept request & pass to the bridge
|
|
479
434
|
const { body, method } = request;
|
|
435
|
+
const { data: requestData, type, headers, } = await convertBody(body || undefined);
|
|
480
436
|
const optionHeaders = Object.fromEntries(request.headers.entries());
|
|
481
|
-
const { data: requestData, type, headers, } = await convertBody((options === null || options === void 0 ? void 0 : options.body) || body || undefined, optionHeaders['Content-Type'] || optionHeaders['content-type']);
|
|
482
437
|
const nativeResponse = await cap.nativePromise('CapacitorHttp', 'request', {
|
|
483
438
|
url: request.url,
|
|
484
439
|
method: method,
|
|
@@ -629,22 +584,12 @@ var nativeBridge = (function (exports) {
|
|
|
629
584
|
}
|
|
630
585
|
this._headers = nativeResponse.headers;
|
|
631
586
|
this.status = nativeResponse.status;
|
|
632
|
-
const responseString = typeof nativeResponse.data !== 'string'
|
|
633
|
-
? JSON.stringify(nativeResponse.data)
|
|
634
|
-
: nativeResponse.data;
|
|
635
587
|
if (this.responseType === '' ||
|
|
636
588
|
this.responseType === 'text') {
|
|
637
|
-
this.response =
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
type: 'application/json',
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
else if (this.responseType === 'arraybuffer') {
|
|
645
|
-
const encoder = new TextEncoder();
|
|
646
|
-
const uint8Array = encoder.encode(responseString);
|
|
647
|
-
this.response = uint8Array.buffer;
|
|
589
|
+
this.response =
|
|
590
|
+
typeof nativeResponse.data !== 'string'
|
|
591
|
+
? JSON.stringify(nativeResponse.data)
|
|
592
|
+
: nativeResponse.data;
|
|
648
593
|
}
|
|
649
594
|
else {
|
|
650
595
|
this.response = nativeResponse.data;
|
|
@@ -711,7 +656,7 @@ var nativeBridge = (function (exports) {
|
|
|
711
656
|
}
|
|
712
657
|
let returnString = '';
|
|
713
658
|
for (const key in this._headers) {
|
|
714
|
-
if (key
|
|
659
|
+
if (key != 'Set-Cookie') {
|
|
715
660
|
returnString += key + ': ' + this._headers[key] + '\r\n';
|
|
716
661
|
}
|
|
717
662
|
}
|
|
@@ -722,12 +667,7 @@ var nativeBridge = (function (exports) {
|
|
|
722
667
|
if (isRelativeURL(this._url)) {
|
|
723
668
|
return win.CapacitorWebXMLHttpRequest.getResponseHeader.call(this, name);
|
|
724
669
|
}
|
|
725
|
-
|
|
726
|
-
if (key.toLowerCase() === name.toLowerCase()) {
|
|
727
|
-
return this._headers[key];
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
return null;
|
|
670
|
+
return this._headers[name];
|
|
731
671
|
};
|
|
732
672
|
Object.setPrototypeOf(xhr, prototype);
|
|
733
673
|
return xhr;
|
|
@@ -551,6 +551,9 @@ public class Bridge {
|
|
|
551
551
|
Logger.debug("WebView background color not applied");
|
|
552
552
|
}
|
|
553
553
|
|
|
554
|
+
settings.setDisplayZoomControls(false);
|
|
555
|
+
settings.setBuiltInZoomControls(this.config.isZoomableWebView());
|
|
556
|
+
|
|
554
557
|
if (config.isInitialFocus()) {
|
|
555
558
|
webView.requestFocusFromTouch();
|
|
556
559
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
package com.getcapacitor;
|
|
2
2
|
|
|
3
|
-
import static com.getcapacitor.Bridge.
|
|
3
|
+
import static com.getcapacitor.Bridge.CAPACITOR_HTTPS_SCHEME;
|
|
4
4
|
import static com.getcapacitor.Bridge.DEFAULT_ANDROID_WEBVIEW_VERSION;
|
|
5
5
|
import static com.getcapacitor.Bridge.DEFAULT_HUAWEI_WEBVIEW_VERSION;
|
|
6
6
|
import static com.getcapacitor.Bridge.MINIMUM_ANDROID_WEBVIEW_VERSION;
|
|
@@ -36,7 +36,7 @@ public class CapConfig {
|
|
|
36
36
|
private boolean html5mode = true;
|
|
37
37
|
private String serverUrl;
|
|
38
38
|
private String hostname = "localhost";
|
|
39
|
-
private String androidScheme =
|
|
39
|
+
private String androidScheme = CAPACITOR_HTTPS_SCHEME;
|
|
40
40
|
private String[] allowNavigation;
|
|
41
41
|
|
|
42
42
|
// Android Config
|
|
@@ -52,6 +52,7 @@ public class CapConfig {
|
|
|
52
52
|
private int minWebViewVersion = DEFAULT_ANDROID_WEBVIEW_VERSION;
|
|
53
53
|
private int minHuaweiWebViewVersion = DEFAULT_HUAWEI_WEBVIEW_VERSION;
|
|
54
54
|
private String errorPath;
|
|
55
|
+
private boolean zoomableWebView = false;
|
|
55
56
|
|
|
56
57
|
// Embedded
|
|
57
58
|
private String startPath;
|
|
@@ -177,6 +178,7 @@ public class CapConfig {
|
|
|
177
178
|
this.minWebViewVersion = builder.minWebViewVersion;
|
|
178
179
|
this.minHuaweiWebViewVersion = builder.minHuaweiWebViewVersion;
|
|
179
180
|
this.errorPath = builder.errorPath;
|
|
181
|
+
this.zoomableWebView = builder.zoomableWebView;
|
|
180
182
|
|
|
181
183
|
// Embedded
|
|
182
184
|
this.startPath = builder.startPath;
|
|
@@ -271,6 +273,7 @@ public class CapConfig {
|
|
|
271
273
|
captureInput = JSONUtils.getBoolean(configJSON, "android.captureInput", captureInput);
|
|
272
274
|
useLegacyBridge = JSONUtils.getBoolean(configJSON, "android.useLegacyBridge", useLegacyBridge);
|
|
273
275
|
webContentsDebuggingEnabled = JSONUtils.getBoolean(configJSON, "android.webContentsDebuggingEnabled", isDebug);
|
|
276
|
+
zoomableWebView = JSONUtils.getBoolean(configJSON, "android.zoomEnabled", JSONUtils.getBoolean(configJSON, "zoomEnabled", false));
|
|
274
277
|
|
|
275
278
|
String logBehavior = JSONUtils.getString(
|
|
276
279
|
configJSON,
|
|
@@ -297,7 +300,7 @@ public class CapConfig {
|
|
|
297
300
|
private boolean validateScheme(String scheme) {
|
|
298
301
|
List<String> invalidSchemes = Arrays.asList("file", "ftp", "ftps", "ws", "wss", "about", "blob", "data");
|
|
299
302
|
if (invalidSchemes.contains(scheme)) {
|
|
300
|
-
Logger.warn(scheme + " is not an allowed scheme. Defaulting to
|
|
303
|
+
Logger.warn(scheme + " is not an allowed scheme. Defaulting to https.");
|
|
301
304
|
return false;
|
|
302
305
|
}
|
|
303
306
|
|
|
@@ -356,6 +359,10 @@ public class CapConfig {
|
|
|
356
359
|
return webContentsDebuggingEnabled;
|
|
357
360
|
}
|
|
358
361
|
|
|
362
|
+
public boolean isZoomableWebView() {
|
|
363
|
+
return zoomableWebView;
|
|
364
|
+
}
|
|
365
|
+
|
|
359
366
|
public boolean isLoggingEnabled() {
|
|
360
367
|
return loggingEnabled;
|
|
361
368
|
}
|
|
@@ -531,7 +538,7 @@ public class CapConfig {
|
|
|
531
538
|
private String serverUrl;
|
|
532
539
|
private String errorPath;
|
|
533
540
|
private String hostname = "localhost";
|
|
534
|
-
private String androidScheme =
|
|
541
|
+
private String androidScheme = CAPACITOR_HTTPS_SCHEME;
|
|
535
542
|
private String[] allowNavigation;
|
|
536
543
|
|
|
537
544
|
// Android Config Values
|
|
@@ -546,6 +553,7 @@ public class CapConfig {
|
|
|
546
553
|
private boolean useLegacyBridge = false;
|
|
547
554
|
private int minWebViewVersion = DEFAULT_ANDROID_WEBVIEW_VERSION;
|
|
548
555
|
private int minHuaweiWebViewVersion = DEFAULT_HUAWEI_WEBVIEW_VERSION;
|
|
556
|
+
private boolean zoomableWebView = false;
|
|
549
557
|
|
|
550
558
|
// Embedded
|
|
551
559
|
private String startPath = null;
|
|
@@ -650,6 +658,11 @@ public class CapConfig {
|
|
|
650
658
|
return this;
|
|
651
659
|
}
|
|
652
660
|
|
|
661
|
+
public Builder setZoomableWebView(boolean zoomableWebView) {
|
|
662
|
+
this.zoomableWebView = zoomableWebView;
|
|
663
|
+
return this;
|
|
664
|
+
}
|
|
665
|
+
|
|
653
666
|
public Builder setLoggingEnabled(boolean enabled) {
|
|
654
667
|
this.loggingEnabled = enabled;
|
|
655
668
|
return this;
|
|
@@ -39,11 +39,6 @@ public class CapacitorCookies extends Plugin {
|
|
|
39
39
|
return pluginConfig.getBoolean("enabled", false);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
private boolean isAllowingInsecureCookies() {
|
|
43
|
-
PluginConfig pluginConfig = getBridge().getConfig().getPluginConfiguration("CapacitorCookies");
|
|
44
|
-
return pluginConfig.getBoolean("androidCustomSchemeAllowInsecureAccess", false);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
42
|
@JavascriptInterface
|
|
48
43
|
public void setCookie(String domain, String action) {
|
|
49
44
|
cookieManager.setCookie(domain, action);
|
|
@@ -51,44 +46,34 @@ public class CapacitorCookies extends Plugin {
|
|
|
51
46
|
|
|
52
47
|
@PluginMethod
|
|
53
48
|
public void getCookies(PluginCall call) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (keyValue.length == 2) {
|
|
76
|
-
String key = keyValue[0].trim();
|
|
77
|
-
String val = keyValue[1].trim();
|
|
78
|
-
try {
|
|
79
|
-
key = URLDecoder.decode(keyValue[0].trim(), StandardCharsets.UTF_8.name());
|
|
80
|
-
val = URLDecoder.decode(keyValue[1].trim(), StandardCharsets.UTF_8.name());
|
|
81
|
-
} catch (UnsupportedEncodingException ignored) {}
|
|
82
|
-
|
|
83
|
-
cookieMap.put(key, val);
|
|
84
|
-
}
|
|
49
|
+
this.bridge.eval(
|
|
50
|
+
"document.cookie",
|
|
51
|
+
value -> {
|
|
52
|
+
String cookies = value.substring(1, value.length() - 1);
|
|
53
|
+
String[] cookieArray = cookies.split(";");
|
|
54
|
+
|
|
55
|
+
JSObject cookieMap = new JSObject();
|
|
56
|
+
|
|
57
|
+
for (String cookie : cookieArray) {
|
|
58
|
+
if (cookie.length() > 0) {
|
|
59
|
+
String[] keyValue = cookie.split("=", 2);
|
|
60
|
+
|
|
61
|
+
if (keyValue.length == 2) {
|
|
62
|
+
String key = keyValue[0].trim();
|
|
63
|
+
String val = keyValue[1].trim();
|
|
64
|
+
try {
|
|
65
|
+
key = URLDecoder.decode(keyValue[0].trim(), StandardCharsets.UTF_8.name());
|
|
66
|
+
val = URLDecoder.decode(keyValue[1].trim(), StandardCharsets.UTF_8.name());
|
|
67
|
+
} catch (UnsupportedEncodingException ignored) {}
|
|
68
|
+
|
|
69
|
+
cookieMap.put(key, val);
|
|
85
70
|
}
|
|
86
71
|
}
|
|
87
|
-
|
|
88
|
-
call.resolve(cookieMap);
|
|
89
72
|
}
|
|
90
|
-
|
|
91
|
-
|
|
73
|
+
|
|
74
|
+
call.resolve(cookieMap);
|
|
75
|
+
}
|
|
76
|
+
);
|
|
92
77
|
}
|
|
93
78
|
|
|
94
79
|
@PluginMethod
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/android",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.2-nightly-20231027T150432.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.5.0"
|
|
26
|
+
"@capacitor/core": "^5.5.0-nightly-20231027T150432.0"
|
|
27
27
|
},
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|