From 2a13d6cf8160e5cc6acd9e7c2b2c8dde8034bfc6 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Sun, 2 Apr 2023 15:46:41 -0500 Subject: [PATCH 1/2] Remove user agent from WKWebView --- Mac/MainWindow/Detail/DetailWebViewController.swift | 3 --- 1 file changed, 3 deletions(-) diff --git a/Mac/MainWindow/Detail/DetailWebViewController.swift b/Mac/MainWindow/Detail/DetailWebViewController.swift index b558b04dc..71cca81c8 100644 --- a/Mac/MainWindow/Detail/DetailWebViewController.swift +++ b/Mac/MainWindow/Detail/DetailWebViewController.swift @@ -105,9 +105,6 @@ final class DetailWebViewController: NSViewController { webView.navigationDelegate = self webView.keyboardDelegate = keyboardDelegate webView.translatesAutoresizingMaskIntoConstraints = false - if let userAgent = UserAgent.fromInfoPlist() { - webView.customUserAgent = userAgent - } view = webView From 366916571ef27be528baf8b33bd727f926266b18 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Tue, 4 Apr 2023 06:16:50 -0500 Subject: [PATCH 2/2] Don't use constraints since they interfere with the fullscreen transition --- iOS/Article/WebViewController.swift | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/iOS/Article/WebViewController.swift b/iOS/Article/WebViewController.swift index 8215abbc1..375a7d926 100644 --- a/iOS/Article/WebViewController.swift +++ b/iOS/Article/WebViewController.swift @@ -521,16 +521,11 @@ private extension WebViewController { webView.ready { - // Add the webview - webView.translatesAutoresizingMaskIntoConstraints = false + // Add the webview - using autolayout will cause fullscreen video to fail and lose the web view + webView.frame = self.view.bounds + webView.autoresizingMask = [.flexibleWidth, .flexibleHeight] self.view.insertSubview(webView, at: 0) - NSLayoutConstraint.activate([ - self.view.leadingAnchor.constraint(equalTo: webView.leadingAnchor), - self.view.trailingAnchor.constraint(equalTo: webView.trailingAnchor), - self.view.topAnchor.constraint(equalTo: webView.topAnchor), - self.view.bottomAnchor.constraint(equalTo: webView.bottomAnchor) - ]) - + // UISplitViewController reports the wrong size to WKWebView which can cause horizontal // rubberbanding on the iPad. This interferes with our UIPageViewController preventing // us from easily swiping between WKWebViews. This hack fixes that.