This is an automated email from the ASF dual-hosted git repository.

niklasmerz pushed a commit to branch 6.2.x
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git


The following commit(s) were added to refs/heads/6.2.x by this push:
     new e6e4fa18 feat: set webView.inspectable to true for Debug builds on iOS 
>= 16.4 (#1300)
e6e4fa18 is described below

commit e6e4fa18c0296fc06f3b9933129f04d45f8a5436
Author: Bas Bosman <git...@nazgul.nu>
AuthorDate: Fri Apr 7 16:16:17 2023 +0200

    feat: set webView.inspectable to true for Debug builds on iOS >= 16.4 
(#1300)
---
 .../Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m    | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git 
a/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m 
b/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m
index a07bf290..d8c78d26 100644
--- a/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m
+++ b/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m
@@ -205,6 +205,20 @@
     WKWebView* wkWebView = [[WKWebView alloc] 
initWithFrame:self.engineWebView.frame configuration:configuration];
     wkWebView.UIDelegate = self.uiDelegate;
 
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 160400
+    // With the introduction of iOS 16.4 the webview is no longer inspectable 
by default.
+    // We'll honor that change for release builds, but will still allow 
inspection on debug builds by default.
+    // We also introduce an override option, so consumers can influence this 
decision in their own build.
+    if (@available(iOS 16.4, *)) {
+#ifdef DEBUG
+        BOOL allowWebviewInspectionDefault = YES;
+#else
+        BOOL allowWebviewInspectionDefault = NO;
+#endif
+        wkWebView.inspectable = [settings 
cordovaBoolSettingForKey:@"InspectableWebview" 
defaultValue:allowWebviewInspectionDefault];
+    }
+#endif
+
     /*
      * This is where the "OverrideUserAgent" is handled. This will replace the 
entire UserAgent
      * with the user defined custom UserAgent.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org
For additional commands, e-mail: commits-h...@cordova.apache.org

Reply via email to