@capacitor/android 7.6.9 → 7.6.10
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/src/main/java/com/getcapacitor/BridgeWebChromeClient.java +2 -2
- package/capacitor/src/main/java/com/getcapacitor/FileUtils.java +1 -1
- package/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java +6 -6
- package/capacitor/src/main/java/com/getcapacitor/plugin/CapacitorCookieManager.java +3 -3
- package/capacitor/src/main/java/com/getcapacitor/plugin/util/HttpRequestHandler.java +2 -2
- package/package.json +1 -1
|
@@ -282,7 +282,7 @@ public class BridgeWebChromeClient extends WebChromeClient {
|
|
|
282
282
|
boolean captureEnabled = fileChooserParams.isCaptureEnabled();
|
|
283
283
|
boolean capturePhoto = captureEnabled && acceptTypes.contains("image/*");
|
|
284
284
|
final boolean captureVideo = captureEnabled && acceptTypes.contains("video/*");
|
|
285
|
-
if (
|
|
285
|
+
if (capturePhoto || captureVideo) {
|
|
286
286
|
if (isMediaCaptureSupported()) {
|
|
287
287
|
showMediaCaptureOrFilePicker(filePathCallback, fileChooserParams, captureVideo);
|
|
288
288
|
} else {
|
|
@@ -455,7 +455,7 @@ public class BridgeWebChromeClient extends WebChromeClient {
|
|
|
455
455
|
public boolean isValidMsg(String msg) {
|
|
456
456
|
return !(
|
|
457
457
|
msg.contains("%cresult %c") ||
|
|
458
|
-
|
|
458
|
+
msg.contains("%cnative %c") ||
|
|
459
459
|
msg.equalsIgnoreCase("[object Object]") ||
|
|
460
460
|
msg.equalsIgnoreCase("console.groupEnd")
|
|
461
461
|
);
|
|
@@ -218,7 +218,7 @@ public class FileUtils {
|
|
|
218
218
|
Cursor cursor = context.getContentResolver().query(uri, null, null, null, null);
|
|
219
219
|
int nameIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
|
|
220
220
|
cursor.moveToFirst();
|
|
221
|
-
String name =
|
|
221
|
+
String name = cursor.getString(nameIndex);
|
|
222
222
|
String fileName = sanitizeFilename(name);
|
|
223
223
|
File file = new File(context.getFilesDir(), fileName);
|
|
224
224
|
try {
|
|
@@ -244,7 +244,7 @@ public class WebViewLocalServer {
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
private boolean isMainUrl(Uri loadingUrl) {
|
|
247
|
-
return
|
|
247
|
+
return bridge.getServerUrl() == null && loadingUrl.getHost().equalsIgnoreCase(bridge.getHost());
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
private boolean isAllowedUrl(Uri loadingUrl) {
|
|
@@ -748,31 +748,31 @@ public class WebViewLocalServer {
|
|
|
748
748
|
@Override
|
|
749
749
|
public int available() throws IOException {
|
|
750
750
|
InputStream is = getInputStream();
|
|
751
|
-
return
|
|
751
|
+
return is != null ? is.available() : -1;
|
|
752
752
|
}
|
|
753
753
|
|
|
754
754
|
@Override
|
|
755
755
|
public int read() throws IOException {
|
|
756
756
|
InputStream is = getInputStream();
|
|
757
|
-
return
|
|
757
|
+
return is != null ? is.read() : -1;
|
|
758
758
|
}
|
|
759
759
|
|
|
760
760
|
@Override
|
|
761
761
|
public int read(byte[] b) throws IOException {
|
|
762
762
|
InputStream is = getInputStream();
|
|
763
|
-
return
|
|
763
|
+
return is != null ? is.read(b) : -1;
|
|
764
764
|
}
|
|
765
765
|
|
|
766
766
|
@Override
|
|
767
767
|
public int read(byte[] b, int off, int len) throws IOException {
|
|
768
768
|
InputStream is = getInputStream();
|
|
769
|
-
return
|
|
769
|
+
return is != null ? is.read(b, off, len) : -1;
|
|
770
770
|
}
|
|
771
771
|
|
|
772
772
|
@Override
|
|
773
773
|
public long skip(long n) throws IOException {
|
|
774
774
|
InputStream is = getInputStream();
|
|
775
|
-
return
|
|
775
|
+
return is != null ? is.skip(n) : 0;
|
|
776
776
|
}
|
|
777
777
|
}
|
|
778
778
|
|
|
@@ -192,12 +192,12 @@ public class CapacitorCookieManager extends CookieManager {
|
|
|
192
192
|
@Override
|
|
193
193
|
public void put(URI uri, Map<String, List<String>> responseHeaders) {
|
|
194
194
|
// make sure our args are valid
|
|
195
|
-
if (
|
|
195
|
+
if (uri == null || responseHeaders == null) return;
|
|
196
196
|
|
|
197
197
|
// go over the headers
|
|
198
198
|
for (String headerKey : responseHeaders.keySet()) {
|
|
199
199
|
// ignore headers which aren't cookie related
|
|
200
|
-
if (
|
|
200
|
+
if (headerKey == null || !(headerKey.equalsIgnoreCase("Set-Cookie2") || headerKey.equalsIgnoreCase("Set-Cookie"))) continue;
|
|
201
201
|
|
|
202
202
|
// process each of the headers
|
|
203
203
|
for (String headerValue : Objects.requireNonNull(responseHeaders.get(headerKey))) {
|
|
@@ -215,7 +215,7 @@ public class CapacitorCookieManager extends CookieManager {
|
|
|
215
215
|
@Override
|
|
216
216
|
public Map<String, List<String>> get(URI uri, Map<String, List<String>> requestHeaders) {
|
|
217
217
|
// make sure our args are valid
|
|
218
|
-
if (
|
|
218
|
+
if (uri == null || requestHeaders == null) throw new IllegalArgumentException("Argument is null");
|
|
219
219
|
|
|
220
220
|
// save our url once
|
|
221
221
|
String url = uri.toString();
|
|
@@ -168,8 +168,8 @@ public class HttpRequestHandler {
|
|
|
168
168
|
"://" +
|
|
169
169
|
uri.getAuthority() +
|
|
170
170
|
uri.getPath() +
|
|
171
|
-
(
|
|
172
|
-
(
|
|
171
|
+
(!urlQuery.equals("") ? "?" + urlQuery : "") +
|
|
172
|
+
(uri.getFragment() != null ? uri.getFragment() : "");
|
|
173
173
|
this.url = new URL(unEncodedUrlString);
|
|
174
174
|
|
|
175
175
|
return this;
|
package/package.json
CHANGED