@capgo/capacitor-patch 8.1.0 → 8.2.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 (34) hide show
  1. package/README.md +13 -6
  2. package/package.json +1 -1
  3. package/patches/catalog.json +657 -9
  4. package/patches/upstream-pr-6991-android-native-bridge.patch +15 -0
  5. package/patches/upstream-pr-6991-ios-native-bridge.patch +15 -0
  6. package/patches/upstream-pr-7301-core.patch +38 -0
  7. package/patches/upstream-pr-7419-ios.patch +13 -0
  8. package/patches/upstream-pr-7420-ios.patch +13 -0
  9. package/patches/upstream-pr-7446-android.patch +14 -0
  10. package/patches/upstream-pr-7490-android.patch +13 -0
  11. package/patches/upstream-pr-7490-ios.patch +13 -0
  12. package/patches/upstream-pr-7535-android.patch +13 -0
  13. package/patches/upstream-pr-7599-ios.patch +86 -0
  14. package/patches/upstream-pr-7732-android-native-bridge.patch +12 -0
  15. package/patches/upstream-pr-7732-ios-native-bridge.patch +12 -0
  16. package/patches/upstream-pr-7781-android.patch +24 -0
  17. package/patches/upstream-pr-7803-android.patch +13 -0
  18. package/patches/upstream-pr-7831-ios.patch +13 -0
  19. package/patches/upstream-pr-7987-android.patch +42 -0
  20. package/patches/upstream-pr-8087-android.patch +64 -0
  21. package/patches/upstream-pr-8188-cli.patch +18 -0
  22. package/patches/upstream-pr-8190-android.patch +13 -0
  23. package/patches/upstream-pr-8249-ios.patch +32 -0
  24. package/patches/upstream-pr-8252-cli.patch +31 -0
  25. package/patches/upstream-pr-8271-core.patch +30 -0
  26. package/patches/upstream-pr-8275-android.patch +158 -0
  27. package/patches/upstream-pr-8304-ios.patch +36 -0
  28. package/patches/upstream-pr-8418-android.patch +82 -0
  29. package/patches/upstream-pr-8424-android.patch +55 -0
  30. package/patches/upstream-pr-8429-android.patch +19 -0
  31. package/patches/upstream-pr-8454-android.patch +207 -0
  32. package/patches/upstream-pr-8458-cli.patch +14 -0
  33. package/scripts/capacitor-patch/runner.mjs +38 -4
  34. package/patches/capacitor-cli-spm-ios-minor-platform.patch +0 -40
@@ -0,0 +1,15 @@
1
+ diff --git a/capacitor/src/main/assets/native-bridge.js b/capacitor/src/main/assets/native-bridge.js
2
+ index f5e7cc4..1463c68 100644
3
+ --- a/capacitor/src/main/assets/native-bridge.js
4
+ +++ b/capacitor/src/main/assets/native-bridge.js
5
+ @@ -689,8 +689,8 @@ var nativeBridge = (function (exports) {
6
+ if (isProgressEventAvailable()) {
7
+ this.dispatchEvent(new ProgressEvent('progress', {
8
+ lengthComputable: true,
9
+ - loaded: nativeResponse.data.length,
10
+ - total: nativeResponse.data.length,
11
+ + loaded: nativeResponse.data == null ? 0 : nativeResponse.data.length,
12
+ + total: nativeResponse.data == null ? 0 : nativeResponse.data.length,
13
+ }));
14
+ }
15
+ this._headers = nativeResponse.headers;
@@ -0,0 +1,15 @@
1
+ diff --git a/Capacitor/Capacitor/assets/native-bridge.js b/Capacitor/Capacitor/assets/native-bridge.js
2
+ index f5e7cc4..1463c68 100644
3
+ --- a/Capacitor/Capacitor/assets/native-bridge.js
4
+ +++ b/Capacitor/Capacitor/assets/native-bridge.js
5
+ @@ -689,8 +689,8 @@ var nativeBridge = (function (exports) {
6
+ if (isProgressEventAvailable()) {
7
+ this.dispatchEvent(new ProgressEvent('progress', {
8
+ lengthComputable: true,
9
+ - loaded: nativeResponse.data.length,
10
+ - total: nativeResponse.data.length,
11
+ + loaded: nativeResponse.data == null ? 0 : nativeResponse.data.length,
12
+ + total: nativeResponse.data == null ? 0 : nativeResponse.data.length,
13
+ }));
14
+ }
15
+ this._headers = nativeResponse.headers;
@@ -0,0 +1,38 @@
1
+ diff --git a/dist/index.cjs.js b/dist/index.cjs.js
2
+ index e48348e..9c366ea 100644
3
+ --- a/dist/index.cjs.js
4
+ +++ b/dist/index.cjs.js
5
+ @@ -523,7 +523,13 @@ class CapacitorHttpPluginWeb extends WebPlugin {
6
+ data = await readBlobAsBase64(blob);
7
+ break;
8
+ case 'json':
9
+ - data = await response.json();
10
+ + responseText = await response.text();
11
+ + try {
12
+ + data = JSON.parse(responseText);
13
+ + }
14
+ + catch (e) {
15
+ + data = responseText;
16
+ + }
17
+ break;
18
+ case 'document':
19
+ case 'text':
20
+ diff --git a/dist/index.js b/dist/index.js
21
+ index 2509854..b10777f 100644
22
+ --- a/dist/index.js
23
+ +++ b/dist/index.js
24
+ @@ -519,7 +519,13 @@ class CapacitorHttpPluginWeb extends WebPlugin {
25
+ data = await readBlobAsBase64(blob);
26
+ break;
27
+ case 'json':
28
+ - data = await response.json();
29
+ + responseText = await response.text();
30
+ + try {
31
+ + data = JSON.parse(responseText);
32
+ + }
33
+ + catch (e) {
34
+ + data = responseText;
35
+ + }
36
+ break;
37
+ case 'document':
38
+ case 'text':
@@ -0,0 +1,13 @@
1
+ diff --git a/Capacitor/Capacitor/WebViewDelegationHandler.swift b/Capacitor/Capacitor/WebViewDelegationHandler.swift
2
+ index 2b4a256d..bbdf0db9 100644
3
+ --- a/Capacitor/Capacitor/WebViewDelegationHandler.swift
4
+ +++ b/Capacitor/Capacitor/WebViewDelegationHandler.swift
5
+ @@ -213,7 +213,7 @@ open class WebViewDelegationHandler: NSObject, WKNavigationDelegate, WKUIDelegat
6
+ let method = dict["action"] as? String ?? ""
7
+ let callbackId = dict["callbackId"] as? String ?? ""
8
+
9
+ - let args = dict["actionArgs"] as? Array ?? []
10
+ + let args = dict["actionArgs"] as? Array ?? [] as [String]
11
+ let options = ["options": args]
12
+
13
+ CAPLog.print("To Native Cordova -> ", pluginId, method, callbackId, options)
@@ -0,0 +1,13 @@
1
+ diff --git a/Capacitor/Capacitor/CAPApplicationDelegateProxy.swift b/Capacitor/Capacitor/CAPApplicationDelegateProxy.swift
2
+ index 7f510bc5..7fe2bae7 100644
3
+ --- a/Capacitor/Capacitor/CAPApplicationDelegateProxy.swift
4
+ +++ b/Capacitor/Capacitor/CAPApplicationDelegateProxy.swift
5
+ @@ -10,7 +10,7 @@ public class ApplicationDelegateProxy: NSObject, UIApplicationDelegate {
6
+ NotificationCenter.default.post(name: .capacitorOpenURL, object: [
7
+ "url": url,
8
+ "options": options
9
+ - ])
10
+ + ] as [String : Any])
11
+ NotificationCenter.default.post(name: NSNotification.Name.CDVPluginHandleOpenURL, object: url)
12
+ lastURL = url
13
+ return true
@@ -0,0 +1,14 @@
1
+ diff --git a/capacitor/src/main/java/com/getcapacitor/Bridge.java b/capacitor/src/main/java/com/getcapacitor/Bridge.java
2
+ index 2a72a430..5cde1e4b 100644
3
+ --- a/capacitor/src/main/java/com/getcapacitor/Bridge.java
4
+ +++ b/capacitor/src/main/java/com/getcapacitor/Bridge.java
5
+ @@ -279,6 +279,9 @@ public class Bridge {
6
+
7
+ webView.setWebChromeClient(new BridgeWebChromeClient(this));
8
+ webView.setWebViewClient(this.webViewClient);
9
+ + webView.getSettings().setBuiltInZoomControls(true);
10
+ + webView.setInitialScale(100);
11
+ + webView.setPadding(0, 0, 0, 0);
12
+
13
+ if (config.isResolveServiceWorkerRequests()) {
14
+ ServiceWorkerController swController = ServiceWorkerController.getInstance();
@@ -0,0 +1,13 @@
1
+ diff --git a/capacitor/src/main/java/com/getcapacitor/plugin/util/HttpRequestHandler.java b/capacitor/src/main/java/com/getcapacitor/plugin/util/HttpRequestHandler.java
2
+ index b47d57cf..d9f310f1 100644
3
+ --- a/capacitor/src/main/java/com/getcapacitor/plugin/util/HttpRequestHandler.java
4
+ +++ b/capacitor/src/main/java/com/getcapacitor/plugin/util/HttpRequestHandler.java
5
+ @@ -392,7 +392,7 @@ public class HttpRequestHandler {
6
+ Boolean disableRedirects = call.getBoolean("disableRedirects");
7
+ Boolean shouldEncode = call.getBoolean("shouldEncodeUrlParams", true);
8
+ ResponseType responseType = ResponseType.parse(call.getString("responseType"));
9
+ - String dataType = call.getString("dataType");
10
+ + String dataType = call.getString("dataType", "application/json");
11
+
12
+ String method = httpMethod != null ? httpMethod.toUpperCase(Locale.ROOT) : call.getString("method", "GET").toUpperCase(Locale.ROOT);
13
+
@@ -0,0 +1,13 @@
1
+ diff --git a/Capacitor/Capacitor/Plugins/HttpRequestHandler.swift b/Capacitor/Capacitor/Plugins/HttpRequestHandler.swift
2
+ index 651c1b76..44e74b96 100644
3
+ --- a/Capacitor/Capacitor/Plugins/HttpRequestHandler.swift
4
+ +++ b/Capacitor/Capacitor/Plugins/HttpRequestHandler.swift
5
+ @@ -157,7 +157,7 @@ open class HttpRequestHandler {
6
+ return output
7
+ }
8
+
9
+ - let contentType = (response.allHeaderFields["Content-Type"] as? String ?? "application/default").lowercased()
10
+ + let contentType = (response.allHeaderFields["Content-Type"] as? String ?? "application/json").lowercased()
11
+
12
+ if contentType.contains("application/json") || responseType == .json {
13
+ output["data"] = tryParseJson(data)
@@ -0,0 +1,13 @@
1
+ diff --git a/capacitor/src/main/java/com/getcapacitor/util/WebColor.java b/capacitor/src/main/java/com/getcapacitor/util/WebColor.java
2
+ index e055021e..fe62763c 100644
3
+ --- a/capacitor/src/main/java/com/getcapacitor/util/WebColor.java
4
+ +++ b/capacitor/src/main/java/com/getcapacitor/util/WebColor.java
5
+ @@ -11,7 +11,7 @@ public class WebColor {
6
+ */
7
+ public static int parseColor(String colorString) {
8
+ String formattedColor = colorString;
9
+ - if (colorString.charAt(0) != '#') {
10
+ + if (!colorString.isEmpty() && colorString.charAt(0) != '#') {
11
+ formattedColor = "#" + formattedColor;
12
+ }
13
+
@@ -0,0 +1,86 @@
1
+ diff --git a/Capacitor/Capacitor/CAPBridgeViewController.swift b/Capacitor/Capacitor/CAPBridgeViewController.swift
2
+ index a7285213..5f70bc68 100644
3
+ --- a/Capacitor/Capacitor/CAPBridgeViewController.swift
4
+ +++ b/Capacitor/Capacitor/CAPBridgeViewController.swift
5
+ @@ -301,6 +301,7 @@ extension CAPBridgeViewController {
6
+ aWebView.scrollView.bounces = false
7
+ aWebView.scrollView.contentInsetAdjustmentBehavior = configuration.contentInsetAdjustmentBehavior
8
+ aWebView.allowsLinkPreview = configuration.allowLinkPreviews
9
+ + aWebView.allowsBackForwardNavigationGestures = configuration.allowsBackForwardNavigationGestures
10
+ aWebView.scrollView.isScrollEnabled = configuration.scrollingEnabled
11
+ if let overrideUserAgent = configuration.overridenUserAgentString {
12
+ aWebView.customUserAgent = overrideUserAgent
13
+ diff --git a/Capacitor/Capacitor/CAPInstanceConfiguration.h b/Capacitor/Capacitor/CAPInstanceConfiguration.h
14
+ index 171dbb46..4177e542 100644
15
+ --- a/Capacitor/Capacitor/CAPInstanceConfiguration.h
16
+ +++ b/Capacitor/Capacitor/CAPInstanceConfiguration.h
17
+ @@ -19,6 +19,7 @@ NS_SWIFT_NAME(InstanceConfiguration)
18
+ @property (nonatomic, readonly) BOOL scrollingEnabled;
19
+ @property (nonatomic, readonly) BOOL zoomingEnabled;
20
+ @property (nonatomic, readonly) BOOL allowLinkPreviews;
21
+ +@property (nonatomic, readonly) BOOL allowsBackForwardNavigationGestures;
22
+ @property (nonatomic, readonly) BOOL handleApplicationNotifications;
23
+ @property (nonatomic, readonly) BOOL isWebDebuggable;
24
+ @property (nonatomic, readonly) BOOL hasInitialFocus;
25
+ diff --git a/Capacitor/Capacitor/CAPInstanceConfiguration.m b/Capacitor/Capacitor/CAPInstanceConfiguration.m
26
+ index d6b7785e..e22a89f4 100644
27
+ --- a/Capacitor/Capacitor/CAPInstanceConfiguration.m
28
+ +++ b/Capacitor/Capacitor/CAPInstanceConfiguration.m
29
+ @@ -31,6 +31,7 @@ - (instancetype)initWithDescriptor:(CAPInstanceDescriptor *)descriptor isDebug:(
30
+ _scrollingEnabled = descriptor.scrollingEnabled;
31
+ _zoomingEnabled = descriptor.zoomingEnabled;
32
+ _allowLinkPreviews = descriptor.allowLinkPreviews;
33
+ + _allowsBackForwardNavigationGestures = descriptor.allowsBackForwardNavigationGestures;
34
+ _handleApplicationNotifications = descriptor.handleApplicationNotifications;
35
+ _contentInsetAdjustmentBehavior = descriptor.contentInsetAdjustmentBehavior;
36
+ _appLocation = descriptor.appLocation;
37
+ @@ -70,6 +71,7 @@ - (instancetype)initWithConfiguration:(CAPInstanceConfiguration*)configuration a
38
+ _scrollingEnabled = configuration.scrollingEnabled;
39
+ _zoomingEnabled = configuration.zoomingEnabled;
40
+ _allowLinkPreviews = configuration.allowLinkPreviews;
41
+ + _allowsBackForwardNavigationGestures = configuration.allowsBackForwardNavigationGestures;
42
+ _handleApplicationNotifications = configuration.handleApplicationNotifications;
43
+ _isWebDebuggable = configuration.isWebDebuggable;
44
+ _hasInitialFocus = configuration.hasInitialFocus;
45
+ diff --git a/Capacitor/Capacitor/CAPInstanceDescriptor.h b/Capacitor/Capacitor/CAPInstanceDescriptor.h
46
+ index f477ef55..aa2b3c23 100644
47
+ --- a/Capacitor/Capacitor/CAPInstanceDescriptor.h
48
+ +++ b/Capacitor/Capacitor/CAPInstanceDescriptor.h
49
+ @@ -93,6 +93,11 @@ NS_SWIFT_NAME(InstanceDescriptor)
50
+ @discussion Set by @c ios.allowsLinkPreview in the configuration file. Corresponds to @c allowsLinkPreview on WKWebView.
51
+ */
52
+ @property (nonatomic, assign) BOOL allowLinkPreviews;
53
+ +/**
54
+ + @brief Whether or not the web view will allow gesture navigation .
55
+ + @discussion Set by @c ios.allowsBackForwardNavigationGestures in the configuration file. Corresponds to @c allowsBackForwardNavigationGestures on WKWebView.
56
+ + */
57
+ +@property (nonatomic, assign) BOOL allowsBackForwardNavigationGestures;
58
+ /**
59
+ @brief Whether or not the Capacitor runtime will set itself as the @c UNUserNotificationCenter delegate.
60
+ @discussion Defaults to @c true. Required to be @c true for notification plugins to work correctly. Set to @c false if your application will handle notifications independently.
61
+ diff --git a/Capacitor/Capacitor/CAPInstanceDescriptor.m b/Capacitor/Capacitor/CAPInstanceDescriptor.m
62
+ index 2d7a4fba..fe8f08c8 100644
63
+ --- a/Capacitor/Capacitor/CAPInstanceDescriptor.m
64
+ +++ b/Capacitor/Capacitor/CAPInstanceDescriptor.m
65
+ @@ -39,6 +39,7 @@ - (void)_setDefaultsWithAppLocation:(NSURL*)location {
66
+ _scrollingEnabled = YES;
67
+ _zoomingEnabled = NO;
68
+ _allowLinkPreviews = YES;
69
+ + _allowsBackForwardNavigationGestures = NO;
70
+ _handleApplicationNotifications = YES;
71
+ _isWebDebuggable = NO;
72
+ _hasInitialFocus = YES;
73
+ diff --git a/Capacitor/Capacitor/CAPInstanceDescriptor.swift b/Capacitor/Capacitor/CAPInstanceDescriptor.swift
74
+ index a7eff5f6..0958e3c2 100644
75
+ --- a/Capacitor/Capacitor/CAPInstanceDescriptor.swift
76
+ +++ b/Capacitor/Capacitor/CAPInstanceDescriptor.swift
77
+ @@ -111,6 +111,9 @@ internal extension InstanceDescriptor {
78
+ if let allowPreviews = config[keyPath: "ios.allowsLinkPreview"] as? Bool {
79
+ allowLinkPreviews = allowPreviews
80
+ }
81
+ + if let allowsNavigationGestures = config[keyPath: "ios.allowsBackForwardNavigationGestures"] as? Bool {
82
+ + allowsBackForwardNavigationGestures = allowsNavigationGestures
83
+ + }
84
+ if let scrollEnabled = config[keyPath: "ios.scrollEnabled"] as? Bool {
85
+ scrollingEnabled = scrollEnabled
86
+ }
@@ -0,0 +1,12 @@
1
+ diff --git a/capacitor/src/main/assets/native-bridge.js b/capacitor/src/main/assets/native-bridge.js
2
+ index f5e7cc4..2cc3db4 100644
3
+ --- a/capacitor/src/main/assets/native-bridge.js
4
+ +++ b/capacitor/src/main/assets/native-bridge.js
5
+ @@ -782,6 +782,7 @@ var nativeBridge = (function (exports) {
6
+ Object.setPrototypeOf(xhr, prototype);
7
+ return xhr;
8
+ };
9
+ + window.XMLHttpRequest.prototype = win.CapacitorWebXMLHttpRequest.prototype;
10
+ Object.assign(window.XMLHttpRequest, win.CapacitorWebXMLHttpRequest.fullObject);
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ diff --git a/Capacitor/Capacitor/assets/native-bridge.js b/Capacitor/Capacitor/assets/native-bridge.js
2
+ index f5e7cc4..2cc3db4 100644
3
+ --- a/Capacitor/Capacitor/assets/native-bridge.js
4
+ +++ b/Capacitor/Capacitor/assets/native-bridge.js
5
+ @@ -782,6 +782,7 @@ var nativeBridge = (function (exports) {
6
+ Object.setPrototypeOf(xhr, prototype);
7
+ return xhr;
8
+ };
9
+ + window.XMLHttpRequest.prototype = win.CapacitorWebXMLHttpRequest.prototype;
10
+ Object.assign(window.XMLHttpRequest, win.CapacitorWebXMLHttpRequest.fullObject);
11
+ }
12
+ }
@@ -0,0 +1,24 @@
1
+ diff --git a/capacitor/src/main/java/com/getcapacitor/Bridge.java b/capacitor/src/main/java/com/getcapacitor/Bridge.java
2
+ index dd623ae651..63c2741ca9 100644
3
+ --- a/capacitor/src/main/java/com/getcapacitor/Bridge.java
4
+ +++ b/capacitor/src/main/java/com/getcapacitor/Bridge.java
5
+ @@ -44,7 +44,6 @@ import java.net.SocketTimeoutException;
6
+ import java.net.URL;
7
+ import java.util.ArrayList;
8
+ import java.util.Arrays;
9
+ -import java.util.Collections;
10
+ import java.util.HashMap;
11
+ import java.util.HashSet;
12
+ import java.util.LinkedList;
13
+ @@ -264,9 +263,10 @@ public class Bridge {
14
+ // Start the local web server
15
+ JSInjector injector = getJSInjector();
16
+ if (WebViewFeature.isFeatureSupported(WebViewFeature.DOCUMENT_START_SCRIPT)) {
17
+ - String allowedOrigin = Uri.parse(appUrl).buildUpon().path(null).fragment(null).clearQuery().build().toString();
18
+ + Set<String> allowedOrigins = new HashSet<>(
19
+ + Arrays.asList(Uri.parse(appUrl).buildUpon().path(null).fragment(null).clearQuery().build().toString(), "https://localhost")
20
+ + );
21
+ try {
22
+ - WebViewCompat.addDocumentStartJavaScript(webView, injector.getScriptString(), Collections.singleton(allowedOrigin));
23
+ + WebViewCompat.addDocumentStartJavaScript(webView, injector.getScriptString(), allowedOrigins);
24
+ injector = null;
@@ -0,0 +1,13 @@
1
+ diff --git a/capacitor/src/main/java/com/getcapacitor/Bridge.java b/capacitor/src/main/java/com/getcapacitor/Bridge.java
2
+ index 2a72a430..12720652 100644
3
+ --- a/capacitor/src/main/java/com/getcapacitor/Bridge.java
4
+ +++ b/capacitor/src/main/java/com/getcapacitor/Bridge.java
5
+ @@ -434,7 +434,7 @@ public class Bridge {
6
+ PackageManager pm = getContext().getPackageManager();
7
+ PackageInfo pInfo = InternalUtils.getPackageInfo(pm, getContext().getPackageName());
8
+ versionCode = Integer.toString((int) PackageInfoCompat.getLongVersionCode(pInfo));
9
+ - versionName = pInfo.versionName;
10
+ + if (pInfo.versionName != null) versionName = pInfo.versionName;
11
+ } catch (Exception ex) {
12
+ Logger.error("Unable to get package info", ex);
13
+ }
@@ -0,0 +1,13 @@
1
+ diff --git a/Capacitor/Capacitor/Router.swift b/Capacitor/Capacitor/Router.swift
2
+ index 68328f8c..8d5b4372 100644
3
+ --- a/Capacitor/Capacitor/Router.swift
4
+ +++ b/Capacitor/Capacitor/Router.swift
5
+ @@ -17,7 +17,7 @@ public struct CapacitorRouter: Router {
6
+ public init() {}
7
+ public var basePath: String = ""
8
+ public func route(for path: String) -> String {
9
+ - let pathUrl = URL(fileURLWithPath: path)
10
+ + let pathUrl = URL(fileURLWithPath: basePath + path)
11
+
12
+ // If there's no path extension it also means the path is empty or a SPA route
13
+ if pathUrl.pathExtension.isEmpty {
@@ -0,0 +1,42 @@
1
+ diff --git a/capacitor/src/main/java/com/getcapacitor/BridgeWebViewClient.java b/capacitor/src/main/java/com/getcapacitor/BridgeWebViewClient.java
2
+ index c434247a27..24149aac1a 100644
3
+ --- a/capacitor/src/main/java/com/getcapacitor/BridgeWebViewClient.java
4
+ +++ b/capacitor/src/main/java/com/getcapacitor/BridgeWebViewClient.java
5
+ @@ -7,6 +7,7 @@ import android.webkit.WebResourceRequest;
6
+ import android.webkit.WebResourceResponse;
7
+ import android.webkit.WebView;
8
+ import android.webkit.WebViewClient;
9
+ +import android.widget.Toast;
10
+ import java.util.List;
11
+
12
+ public class BridgeWebViewClient extends WebViewClient {
13
+ @@ -91,16 +92,29 @@ public class BridgeWebViewClient extends WebViewClient {
14
+ @Override
15
+ public boolean onRenderProcessGone(WebView view, RenderProcessGoneDetail detail) {
16
+ super.onRenderProcessGone(view, detail);
17
+ +
18
+ boolean result = false;
19
+
20
+ List<WebViewListener> webViewListeners = bridge.getWebViewListeners();
21
+ if (webViewListeners != null) {
22
+ for (WebViewListener listener : bridge.getWebViewListeners()) {
23
+ result = listener.onRenderProcessGone(view, detail) || result;
24
+ }
25
+ }
26
+
27
+ + if (!result) {
28
+ + // If no one handled it, handle it ourselves!
29
+ +
30
+ + view.post(() -> {
31
+ + Toast.makeText(view.getContext(), "Reloading due to low memory issue", Toast.LENGTH_SHORT).show();
32
+ + });
33
+ +
34
+ + view.reload(); // Safely reload WebView
35
+ +
36
+ + return true;
37
+ + }
38
+ +
39
+ return result;
40
+ }
41
+
42
+ @Override
@@ -0,0 +1,64 @@
1
+ diff --git a/capacitor/src/main/java/com/getcapacitor/plugin/util/HttpRequestHandler.java b/capacitor/src/main/java/com/getcapacitor/plugin/util/HttpRequestHandler.java
2
+ index b47d57cf..46da6e1a 100644
3
+ --- a/capacitor/src/main/java/com/getcapacitor/plugin/util/HttpRequestHandler.java
4
+ +++ b/capacitor/src/main/java/com/getcapacitor/plugin/util/HttpRequestHandler.java
5
+ @@ -26,7 +26,7 @@ import java.util.Locale;
6
+ import java.util.Map;
7
+ import org.json.JSONArray;
8
+ import org.json.JSONException;
9
+ -import org.json.JSONObject;
10
+ +import org.json.JSONTokener;
11
+
12
+ public class HttpRequestHandler {
13
+
14
+ @@ -302,36 +302,25 @@ public class HttpRequestHandler {
15
+ /**
16
+ * Returns a JSObject or a JSArray based on a string-ified input
17
+ * @param input String-ified JSON that needs parsing
18
+ - * @return A JSObject or JSArray
19
+ - * @throws JSONException thrown if the JSON is malformed
20
+ + * @return A JSObject, JSArray or literal
21
+ */
22
+ - public static Object parseJSON(String input) throws JSONException {
23
+ - JSONObject json = new JSONObject();
24
+ + public static Object parseJSON(String input) {
25
+ try {
26
+ - if ("null".equals(input.trim())) {
27
+ - return JSONObject.NULL;
28
+ - } else if ("true".equals(input.trim())) {
29
+ - return true;
30
+ - } else if ("false".equals(input.trim())) {
31
+ - return false;
32
+ - } else if (input.trim().length() <= 0) {
33
+ - return "";
34
+ - } else if (input.trim().matches("^\".*\"$")) {
35
+ - // a string enclosed in " " is a json value, return the string without the quotes
36
+ - return input.trim().substring(1, input.trim().length() - 1);
37
+ - } else if (input.trim().matches("^-?\\d+$")) {
38
+ - return Integer.parseInt(input.trim());
39
+ - } else if (input.trim().matches("^-?\\d+(\\.\\d+)?$")) {
40
+ - return Double.parseDouble(input.trim());
41
+ - } else {
42
+ + // try to parse input as an object
43
+ + return new JSObject(input);
44
+ + } catch (JSONException e) {
45
+ + try {
46
+ + // fall through to try to parse it as an array
47
+ + return new JSArray(input);
48
+ + } catch (JSONException e2) {
49
+ try {
50
+ - return new JSObject(input);
51
+ - } catch (JSONException e) {
52
+ - return new JSArray(input);
53
+ + // the value is probably a literal, so we can try to have the JSONTokener parse it for us
54
+ + return new JSONTokener(input).nextValue();
55
+ + } catch (JSONException e3) {
56
+ + // if nothing could be parsed, return the input as is
57
+ + return input;
58
+ }
59
+ }
60
+ - } catch (JSONException e) {
61
+ - return input;
62
+ }
63
+ }
64
+
@@ -0,0 +1,18 @@
1
+ diff --git a/dist/ios/update.js b/dist/ios/update.js
2
+ index 54456cd..10fcbf1 100644
3
+ --- a/dist/ios/update.js
4
+ +++ b/dist/ios/update.js
5
+ @@ -272,7 +272,12 @@ async function updatePodfile(config, plugins, deployment) {
6
+ }
7
+ const isXcodebuildAvailable = await (0, subprocess_1.isInstalled)('xcodebuild');
8
+ if (isXcodebuildAvailable) {
9
+ - await (0, subprocess_1.runCommand)('xcodebuild', ['-project', (0, path_1.basename)(`${config.ios.nativeXcodeProjDirAbs}`), 'clean'], {
10
+ + await (0, subprocess_1.runCommand)('xcodebuild', [
11
+ + '-project',
12
+ + (0, path_1.basename)(`${config.ios.nativeXcodeProjDirAbs}`),
13
+ + ...(config.ios.scheme ? ['-scheme', config.ios.scheme] : []),
14
+ + 'clean',
15
+ + ], {
16
+ cwd: config.ios.nativeProjectDirAbs,
17
+ });
18
+ }
@@ -0,0 +1,13 @@
1
+ diff --git a/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java b/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java
2
+ index a044bfbe..b4aebfce 100755
3
+ --- a/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java
4
+ +++ b/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java
5
+ @@ -129,7 +129,7 @@ public class WebViewLocalServer {
6
+ }
7
+
8
+ public Map<String, String> getResponseHeaders() {
9
+ - return responseHeaders;
10
+ + return new HashMap<>(responseHeaders);
11
+ }
12
+ }
13
+
@@ -0,0 +1,32 @@
1
+ diff --git a/Capacitor/Capacitor/Plugins/CapacitorCookieManager.swift b/Capacitor/Capacitor/Plugins/CapacitorCookieManager.swift
2
+ index 782c245b..b5ab0cf6 100644
3
+ --- a/Capacitor/Capacitor/Plugins/CapacitorCookieManager.swift
4
+ +++ b/Capacitor/Capacitor/Plugins/CapacitorCookieManager.swift
5
+ @@ -46,14 +46,6 @@ public class CapacitorCookieManager {
6
+ return url
7
+ }
8
+
9
+ - public func encode(_ value: String) -> String {
10
+ - return value.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed)!
11
+ - }
12
+ -
13
+ - public func decode(_ value: String) -> String {
14
+ - return value.removingPercentEncoding!
15
+ - }
16
+ -
17
+ public func setCookie(_ domain: String, _ action: String) {
18
+ let url = getServerUrl(domain)!
19
+ let jar = HTTPCookieStorage.shared
20
+ diff --git a/Capacitor/Capacitor/Plugins/CapacitorCookies.swift b/Capacitor/Capacitor/Plugins/CapacitorCookies.swift
21
+ index 8d5efd3a..75ac0092 100644
22
+ --- a/Capacitor/Capacitor/Plugins/CapacitorCookies.swift
23
+ +++ b/Capacitor/Capacitor/Plugins/CapacitorCookies.swift
24
+ @@ -31,7 +31,7 @@ public class CAPCookiesPlugin: CAPPlugin, CAPBridgedPlugin {
25
+
26
+ let expires = call.getString("expires", "")
27
+ let path = call.getString("path", "")
28
+ - cookieManager!.setCookie(url, key, cookieManager!.encode(value), expires, path)
29
+ + cookieManager!.setCookie(url, key, value, expires, path)
30
+ call.resolve()
31
+ }
32
+
@@ -0,0 +1,31 @@
1
+ diff --git a/dist/ios/update.js b/dist/ios/update.js
2
+ index 54456cd..5fb1920 100644
3
+ --- a/dist/ios/update.js
4
+ +++ b/dist/ios/update.js
5
+ @@ -55,9 +55,9 @@ async function updatePluginFiles(config, plugins, deployment) {
6
+ (0, plugin_1.printPlugins)(incompatibleCordovaPlugins, platform, 'incompatible');
7
+ }
8
+ async function generateCordovaPackageFiles(cordovaPlugins, config) {
9
+ - cordovaPlugins.map((plugin) => {
10
+ - generateCordovaPackageFile(plugin, config);
11
+ - });
12
+ + await Promise.all(cordovaPlugins.map(async (plugin) => {
13
+ + await generateCordovaPackageFile(plugin, config);
14
+ + }));
15
+ }
16
+ async function generateCordovaPackageFile(p, config) {
17
+ var _a;
18
+ diff --git a/dist/tasks/update.js b/dist/tasks/update.js
19
+ index 3aeb45b..04f66b6 100644
20
+ --- a/dist/tasks/update.js
21
+ +++ b/dist/tasks/update.js
22
+ @@ -69,7 +69,8 @@ function updateChecks(config, platforms) {
23
+ const checks = [];
24
+ for (const platformName of platforms) {
25
+ if (platformName === config.ios.name) {
26
+ - checks.push(() => (0, common_2.checkBundler)(config) || (0, common_2.checkCocoaPods)(config));
27
+ + checks.push(() => (0, common_2.checkBundler)(config));
28
+ + checks.push(() => (0, common_2.checkCocoaPods)(config));
29
+ }
30
+ else if (platformName === config.android.name) {
31
+ continue;
@@ -0,0 +1,30 @@
1
+ diff --git a/dist/index.cjs.js b/dist/index.cjs.js
2
+ index e48348e..12237d0 100644
3
+ --- a/dist/index.cjs.js
4
+ +++ b/dist/index.cjs.js
5
+ @@ -288,7 +288,9 @@ class WebPlugin {
6
+ return;
7
+ }
8
+ const index = listeners.indexOf(listenerFunc);
9
+ - this.listeners[eventName].splice(index, 1);
10
+ + if (index !== -1) {
11
+ + this.listeners[eventName].splice(index, 1);
12
+ + }
13
+ // If there are no more listeners for this type of event,
14
+ // remove the window listener
15
+ if (!this.listeners[eventName].length) {
16
+ diff --git a/dist/index.js b/dist/index.js
17
+ index 2509854..d4532a5 100644
18
+ --- a/dist/index.js
19
+ +++ b/dist/index.js
20
+ @@ -284,7 +284,9 @@ class WebPlugin {
21
+ return;
22
+ }
23
+ const index = listeners.indexOf(listenerFunc);
24
+ - this.listeners[eventName].splice(index, 1);
25
+ + if (index !== -1) {
26
+ + this.listeners[eventName].splice(index, 1);
27
+ + }
28
+ // If there are no more listeners for this type of event,
29
+ // remove the window listener
30
+ if (!this.listeners[eventName].length) {