Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix #8190: Add in-page search to the debug histograms controller
Browse files Browse the repository at this point in the history
  • Loading branch information
kylehickinson committed Oct 5, 2023
1 parent e2e433e commit e850220
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Sources/Brave/Frontend/Settings/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,23 @@ class SettingsViewController: TableViewController {
let histogramsController = self.p3aUtilities.histogramsController().then {
$0.title = "Histograms (p3a)"
}
if #available(iOS 16.0, *) {
// TODO: Replace this with property access when exposed from brave-core side
let webView = histogramsController.value(forKey: "_webView") as! WKWebView // swiftlint:disable:this force_cast
webView.isFindInteractionEnabled = true
histogramsController.navigationItem.rightBarButtonItem = UIBarButtonItem(
systemItem: .search,
primaryAction: .init { [weak webView] _ in
guard let webView,
let findInteraction = webView.findInteraction,
!findInteraction.isFindNavigatorVisible else {
return
}
webView.findInteraction?.searchText = ""
webView.findInteraction?.presentFindNavigator(showingReplace: false)
}
)
}
self.navigationController?.pushViewController(histogramsController, animated: true)
}, accessory: .disclosureIndicator, cellClass: MultilineValue1Cell.self),
Row(
Expand Down

0 comments on commit e850220

Please sign in to comment.