Support for Sydro find interaction
This commit is contained in:
@@ -99,10 +99,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
),
|
||||
|
||||
// Find on page
|
||||
(FindOnPageViewController.isEnabled() ?
|
||||
UIKeyCommand(
|
||||
modifiers: [.command], input: "F",
|
||||
title: "Find on Page",
|
||||
action: #selector(ShortcutResponder.findOnPage)
|
||||
)
|
||||
: UIKeyCommand()
|
||||
),
|
||||
|
||||
// Refresh
|
||||
|
||||
@@ -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)
|
||||
|
||||
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)
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -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]];
|
||||
|
||||
Reference in New Issue
Block a user