diff --git a/iOS/Article/ArticleViewController.swift b/iOS/Article/ArticleViewController.swift index 31f132ea3..a198a6c45 100644 --- a/iOS/Article/ArticleViewController.swift +++ b/iOS/Article/ArticleViewController.swift @@ -202,12 +202,7 @@ class ArticleViewController: UIViewController { } @objc func contentSizeCategoryDidChange(_ note: Notification) { - coordinator.webViewProvider.flushQueue() - coordinator.webViewProvider.replenishQueueIfNeeded() - if let controller = currentWebViewController { - controller.fullReload() - self.pageViewController.setViewControllers([controller], direction: .forward, animated: false, completion: nil) - } + resetWebViewController() } @objc func willEnterForeground(_ note: Notification) { @@ -215,6 +210,7 @@ class ArticleViewController: UIViewController { if AppDefaults.articleFullscreenEnabled { currentWebViewController?.hideBars() } + resetWebViewController() } // MARK: Actions @@ -274,10 +270,6 @@ class ArticleViewController: UIViewController { currentWebViewController?.scrollPageDown() } - func fullReload() { - currentWebViewController?.fullReload() - } - func stopArticleExtractorIfProcessing() { currentWebViewController?.stopArticleExtractorIfProcessing() } @@ -366,4 +358,13 @@ private extension ArticleViewController { return controller } + func resetWebViewController() { + coordinator.webViewProvider.flushQueue() + coordinator.webViewProvider.replenishQueueIfNeeded() + if let controller = currentWebViewController { + controller.fullReload() + self.pageViewController.setViewControllers([controller], direction: .forward, animated: false, completion: nil) + } + } + } diff --git a/iOS/Article/WebViewController.swift b/iOS/Article/WebViewController.swift index 2aba0acb7..db2563cd3 100644 --- a/iOS/Article/WebViewController.swift +++ b/iOS/Article/WebViewController.swift @@ -149,7 +149,8 @@ class WebViewController: UIViewController { } func fullReload() { - self.loadWebView() + view.subviews.first?.removeFromSuperview() + loadWebView() } func showBars() { @@ -289,10 +290,10 @@ extension WebViewController: UIContextMenuInteractionDelegate { // MARK: WKNavigationDelegate extension WebViewController: WKNavigationDelegate { + func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { if navigationAction.navigationType == .linkActivated { - guard let url = navigationAction.request.url else { decisionHandler(.allow) return @@ -314,13 +315,13 @@ extension WebViewController: WKNavigationDelegate { } else { decisionHandler(.allow) } - } else { - decisionHandler(.allow) - } - + } + + func webViewWebContentProcessDidTerminate(_ webView: WKWebView) { + fullReload() } } diff --git a/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift b/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift index d06a33399..3fcf7506f 100644 --- a/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift +++ b/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift @@ -73,16 +73,13 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView { private let unreadCountView = MasterFeedUnreadCountView(frame: CGRect.zero) - @available(iOS 13.4, *) - private(set) lazy var disclosurePointerInteraction = UIPointerInteraction() - private lazy var disclosureButton: UIButton = { let button = NonIntrinsicButton() button.tintColor = UIColor.tertiaryLabel button.setImage(AppAssets.disclosureImage, for: .normal) button.contentMode = .center if #available(iOS 13.4, *) { - button.addInteraction(disclosurePointerInteraction) + button.addInteraction(UIPointerInteraction()) } button.addTarget(self, action: #selector(toggleDisclosure), for: .touchUpInside) return button diff --git a/iOS/Resources/main_ios.js b/iOS/Resources/main_ios.js index 4104749cf..98a4f4290 100644 --- a/iOS/Resources/main_ios.js +++ b/iOS/Resources/main_ios.js @@ -41,7 +41,7 @@ class ImageViewer { pixelRatio--; } while (pixelRatio > 0 && canvas.width * canvas.height > 16777216) canvas.getContext("2d").drawImage(this.img, 0, 0, canvas.width, canvas.height); - + const rect = this.img.getBoundingClientRect(); const message = { x: rect.x, diff --git a/xcconfig/common/NetNewsWire_ios_target_common.xcconfig b/xcconfig/common/NetNewsWire_ios_target_common.xcconfig index 2b155ae2f..e34f4fec5 100644 --- a/xcconfig/common/NetNewsWire_ios_target_common.xcconfig +++ b/xcconfig/common/NetNewsWire_ios_target_common.xcconfig @@ -1,7 +1,7 @@ // High Level Settings common to both the iOS application and any extensions we bundle with it MARKETING_VERSION = 5.0.1 -CURRENT_PROJECT_VERSION = 43 +CURRENT_PROJECT_VERSION = 44 ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon