From 84e653a238e586b594a221cc92c399511db7075a Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sun, 22 Nov 2026 20:31:38 -0800 Subject: [PATCH] Rename the Find in Article notification handler to handleFindInArticle. Disable Find menu items when no web view. --- Shared/Localizable.xcstrings | 14 -------------- iOS/Article/ArticleViewController.swift | 15 +++++++++++---- iOS/Article/WebViewController.swift | 2 +- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/Shared/Localizable.xcstrings b/Shared/Localizable.xcstrings index 9b71755af..f05fa3540 100644 --- a/Shared/Localizable.xcstrings +++ b/Shared/Localizable.xcstrings @@ -25,17 +25,6 @@ } } }, - "%d of %d" : { - "comment" : "Results selection and count", - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "new", - "value" : "%1$d of %2$d" - } - } - } - }, "%d unread" : { "comment" : "Unread" }, @@ -1032,9 +1021,6 @@ "No Errors Logged" : { "comment" : "Error log empty state" }, - "No results" : { - "comment" : "No results" - }, "None" : { "comment" : "None" }, diff --git a/iOS/Article/ArticleViewController.swift b/iOS/Article/ArticleViewController.swift index fd9fcc259..ae5cd9f2f 100644 --- a/iOS/Article/ArticleViewController.swift +++ b/iOS/Article/ArticleViewController.swift @@ -236,7 +236,7 @@ final class ArticleViewController: UIViewController { controller.hideBars() } - NotificationCenter.default.addObserver(self, selector: #selector(beginFind(_:)), name: .FindInArticle, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(handleFindInArticle(_:)), name: .FindInArticle, object: nil) updateUI() } @@ -464,12 +464,12 @@ public extension Notification.Name { extension ArticleViewController { - @objc func beginFind(_ _: Any? = nil) { - currentWebViewController?.findInteraction?.presentFindNavigator(showingReplace: false) + @objc func handleFindInArticle(_ notification: Notification) { + presentFindNavigator() } override func find(_ sender: Any?) { - beginFind() + presentFindNavigator() } override func findNext(_ sender: Any?) { @@ -490,6 +490,9 @@ extension ArticleViewController { if action == #selector(useSelectionForFind(_:)) { return currentWebViewController?.canUseSelectionForFind ?? false } + if action == #selector(find(_:)) || action == #selector(findNext(_:)) || action == #selector(findPrevious(_:)) { + return currentWebViewController?.findInteraction != nil + } return super.canPerformAction(action, withSender: sender) } } @@ -596,6 +599,10 @@ extension ArticleViewController: UIGestureRecognizerDelegate { private extension ArticleViewController { + func presentFindNavigator() { + currentWebViewController?.findInteraction?.presentFindNavigator(showingReplace: false) + } + func createWebViewController(_ article: Article?, updateView: Bool = true) -> WebViewController { let controller = WebViewController() controller.coordinator = coordinator diff --git a/iOS/Article/WebViewController.swift b/iOS/Article/WebViewController.swift index 9cf7d9667..f147548be 100644 --- a/iOS/Article/WebViewController.swift +++ b/iOS/Article/WebViewController.swift @@ -1032,7 +1032,7 @@ extension WebViewController: @preconcurrency SFSafariViewControllerDelegate { extension WebViewController { var findInteraction: UIFindInteraction? { - return webView?.findInteraction + webView?.findInteraction } /// Whether the article has selected text to search for.