Skip to content

Commit

Permalink
feat: allow WebView inspection if diagnosticLog=true (#131)
Browse files Browse the repository at this point in the history
* feat: allow WebView inspection if diagnosticLog=true

* chore: upgrade Xcode to 14.2

* Revert "chore: upgrade Xcode to 14.2"

This reverts commit 700bd8b.

* feat: don't force users to update Xcode/SDK to set webview.nterceptable

* chore: update header in HCaptchaHtml

* fix: pod lint warnings
  • Loading branch information
CAMOBAP authored Feb 11, 2024
1 parent a62aa18 commit 331f595
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion HCaptcha/Classes/HCaptchaWebViewManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,22 @@ internal class HCaptchaWebViewManager: NSObject {

/// The webview that executes JS code
lazy var webView: WKWebView = {
let debug = Log.minLevel == .debug
let webview = WKWebView(
frame: CGRect(origin: CGPoint.zero, size: webViewInitSize),
configuration: self.buildConfiguration()
)
webview.accessibilityIdentifier = "webview"
webview.accessibilityTraits = UIAccessibilityTraits.link
webview.isHidden = true

if debug {
if #available(iOS 16.4, *) {
webview.perform(Selector(("setInspectable:")), with: true)
}
webview.evaluateJavaScript("navigator.userAgent") { (result, _) in
Log.debug("WebViewManager WKWebView UserAgent: \(result ?? "nil")")
}
}
Log.debug("WebViewManager WKWebView instance created")

return webview
Expand Down

0 comments on commit 331f595

Please sign in to comment.