This is an automated email from the ASF dual-hosted git repository.
niklasmerz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git
The following commit(s) were added to refs/heads/master by this push:
new e1e21cfa feat: set webView.inspectable to true for Debug builds on iOS
>= 16.4 (#1300)
e1e21cfa is described below
commit e1e21cfafcfe7c0162b976627a8c1f1d2aad72e3
Author: Bas Bosman <[email protected]>
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 ae5b47a9..0aff998f 100644
--- a/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m
+++ b/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m
@@ -218,6 +218,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: [email protected]
For additional commands, e-mail: [email protected]