diff --git a/App/AppDelegate.swift b/App/AppDelegate.swift index 299ac42..4481fb9 100644 --- a/App/AppDelegate.swift +++ b/App/AppDelegate.swift @@ -99,10 +99,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ), // Find on page - UIKeyCommand( - modifiers: [.command], input: "F", - title: "Find on Page", - action: #selector(ShortcutResponder.findOnPage) + (FindOnPageViewController.isEnabled() ? + UIKeyCommand( + modifiers: [.command], input: "F", + title: "Find on Page", + action: #selector(ShortcutResponder.findOnPage) + ) + : UIKeyCommand() ), // Refresh diff --git a/App/Browser View/BrowserViewController.swift b/App/Browser View/BrowserViewController.swift index eb149d1..9545878 100644 --- a/App/Browser View/BrowserViewController.swift +++ b/App/Browser View/BrowserViewController.swift @@ -77,9 +77,17 @@ class BrowserViewController: UIViewController override func loadView() { browserView.toolbarView = toolbarController.toolbarView - browserView.findOnPageView = findOnPageController.findOnPageView browserView.tabBarView = tabBarViewController.tabBarView + if FindOnPageViewController.isEnabled() { + browserView.findOnPageView = findOnPageController.findOnPageView + + // Find on page dismiss + findOnPageController.findOnPageView.doneButton.addAction(UIAction(handler: { [unowned self] _ in + browserView.setFindOnPageVisible(false, animated: true) + }), for: .touchUpInside) + } + // Refresh button toolbarController.urlBar.refreshButton.addAction(UIAction(handler: { [unowned self] action in if self.webView.isLoading { @@ -220,7 +228,12 @@ class BrowserViewController: UIViewController // Find on page documentControls.findOnPageControlView.addAction(UIAction(handler: { [unowned self] _ in documentControls.dismiss(animated: true, completion: nil) - browserView.setFindOnPageVisible(true, animated: true) + + if FindOnPageViewController.isEnabled() { + browserView.setFindOnPageVisible(true, animated: true) + } else if #available(iOS 16.0, *) { + browserView.webView?._findInteraction.presentFindNavigatorShowingReplace(false) + } }), for: .touchUpInside) // Navigation controls @@ -294,11 +307,6 @@ class BrowserViewController: UIViewController present(documentControls, animated: true, completion: nil) }), for: .touchUpInside) - // Find on page dismiss - findOnPageController.findOnPageView.doneButton.addAction(UIAction(handler: { [unowned self] _ in - browserView.setFindOnPageVisible(false, animated: true) - }), for: .touchUpInside) - // Tab controller activeTabObservation = tabController.$activeTabIndex .receive(on: RunLoop.main) diff --git a/App/Find on Page/FindOnPageViewController.swift b/App/Find on Page/FindOnPageViewController.swift index f0b103e..51f5b2b 100644 --- a/App/Find on Page/FindOnPageViewController.swift +++ b/App/Find on Page/FindOnPageViewController.swift @@ -9,6 +9,14 @@ import UIKit class FindOnPageViewController: UIViewController, _WKFindDelegate { + static func isEnabled() -> Bool { + if #available(iOS 16.0, *) { + return false + } + + return true + } + let findOnPageView = FindOnPageView() weak var webView: WKWebView? { didSet { webView?._findDelegate = self } diff --git a/App/Web Process Bundle Bridge/SBRProcessBundleBridge.m b/App/Web Process Bundle Bridge/SBRProcessBundleBridge.m index da40fc1..96327ed 100644 --- a/App/Web Process Bundle Bridge/SBRProcessBundleBridge.m +++ b/App/Web Process Bundle Bridge/SBRProcessBundleBridge.m @@ -113,6 +113,7 @@ // Instantiate web view WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:webViewConfiguration]; + webView._findInteractionEnabled = YES; // Configure proxy interface (interface to remote web process) _webProcessProxy = [[webView _remoteObjectRegistry] remoteObjectProxyWithInterface:[self _webProcessProxyInterface]];