Support for Sydro find interaction
This commit is contained in:
@@ -99,10 +99,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||||||
),
|
),
|
||||||
|
|
||||||
// Find on page
|
// Find on page
|
||||||
UIKeyCommand(
|
(FindOnPageViewController.isEnabled() ?
|
||||||
modifiers: [.command], input: "F",
|
UIKeyCommand(
|
||||||
title: "Find on Page",
|
modifiers: [.command], input: "F",
|
||||||
action: #selector(ShortcutResponder.findOnPage)
|
title: "Find on Page",
|
||||||
|
action: #selector(ShortcutResponder.findOnPage)
|
||||||
|
)
|
||||||
|
: UIKeyCommand()
|
||||||
),
|
),
|
||||||
|
|
||||||
// Refresh
|
// Refresh
|
||||||
|
|||||||
@@ -77,9 +77,17 @@ class BrowserViewController: UIViewController
|
|||||||
|
|
||||||
override func loadView() {
|
override func loadView() {
|
||||||
browserView.toolbarView = toolbarController.toolbarView
|
browserView.toolbarView = toolbarController.toolbarView
|
||||||
browserView.findOnPageView = findOnPageController.findOnPageView
|
|
||||||
browserView.tabBarView = tabBarViewController.tabBarView
|
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
|
// Refresh button
|
||||||
toolbarController.urlBar.refreshButton.addAction(UIAction(handler: { [unowned self] action in
|
toolbarController.urlBar.refreshButton.addAction(UIAction(handler: { [unowned self] action in
|
||||||
if self.webView.isLoading {
|
if self.webView.isLoading {
|
||||||
@@ -220,7 +228,12 @@ class BrowserViewController: UIViewController
|
|||||||
// Find on page
|
// Find on page
|
||||||
documentControls.findOnPageControlView.addAction(UIAction(handler: { [unowned self] _ in
|
documentControls.findOnPageControlView.addAction(UIAction(handler: { [unowned self] _ in
|
||||||
documentControls.dismiss(animated: true, completion: nil)
|
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)
|
}), for: .touchUpInside)
|
||||||
|
|
||||||
// Navigation controls
|
// Navigation controls
|
||||||
@@ -294,11 +307,6 @@ class BrowserViewController: UIViewController
|
|||||||
present(documentControls, animated: true, completion: nil)
|
present(documentControls, animated: true, completion: nil)
|
||||||
}), for: .touchUpInside)
|
}), for: .touchUpInside)
|
||||||
|
|
||||||
// Find on page dismiss
|
|
||||||
findOnPageController.findOnPageView.doneButton.addAction(UIAction(handler: { [unowned self] _ in
|
|
||||||
browserView.setFindOnPageVisible(false, animated: true)
|
|
||||||
}), for: .touchUpInside)
|
|
||||||
|
|
||||||
// Tab controller
|
// Tab controller
|
||||||
activeTabObservation = tabController.$activeTabIndex
|
activeTabObservation = tabController.$activeTabIndex
|
||||||
.receive(on: RunLoop.main)
|
.receive(on: RunLoop.main)
|
||||||
|
|||||||
@@ -9,6 +9,14 @@ import UIKit
|
|||||||
|
|
||||||
class FindOnPageViewController: UIViewController, _WKFindDelegate
|
class FindOnPageViewController: UIViewController, _WKFindDelegate
|
||||||
{
|
{
|
||||||
|
static func isEnabled() -> Bool {
|
||||||
|
if #available(iOS 16.0, *) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
let findOnPageView = FindOnPageView()
|
let findOnPageView = FindOnPageView()
|
||||||
weak var webView: WKWebView? {
|
weak var webView: WKWebView? {
|
||||||
didSet { webView?._findDelegate = self }
|
didSet { webView?._findDelegate = self }
|
||||||
|
|||||||
@@ -113,6 +113,7 @@
|
|||||||
|
|
||||||
// Instantiate web view
|
// Instantiate web view
|
||||||
WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:webViewConfiguration];
|
WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:webViewConfiguration];
|
||||||
|
webView._findInteractionEnabled = YES;
|
||||||
|
|
||||||
// Configure proxy interface (interface to remote web process)
|
// Configure proxy interface (interface to remote web process)
|
||||||
_webProcessProxy = [[webView _remoteObjectRegistry] remoteObjectProxyWithInterface:[self _webProcessProxyInterface]];
|
_webProcessProxy = [[webView _remoteObjectRegistry] remoteObjectProxyWithInterface:[self _webProcessProxyInterface]];
|
||||||
|
|||||||
Reference in New Issue
Block a user