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

Fix #8446: Use correct select method on BVC when opening URLs #8447

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Sources/Brave/Frontend/Browser/BrowserViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2979,6 +2979,15 @@ extension BrowserViewController: ToolbarUrlActionsDelegate {
self.tabManager.addTabsForURLs(urls, zombie: false, isPrivate: tabIsPrivate)
}

#if DEBUG
public override func select(_ sender: Any?) {
if sender is URL {
assertionFailure("Wrong method called, use `select(url:)` or `select(_:action:)`")
kylehickinson marked this conversation as resolved.
Show resolved Hide resolved
}
super.select(sender)
}
#endif

func select(url: URL) {
select(url, action: .openInCurrentTab)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extension BrowserViewController {
var components = URLComponents()
components.host = currentHost
components.scheme = url.scheme
self.select(components.url!)
self.select(url: components.url!)
}
}
)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Brave/Shortcuts/ActivityShortcutManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public class ActivityShortcutManager: NSObject {
} else {
let controller = NewsSettingsViewController(dataSource: bvc.feedDataSource, openURL: { url in
bvc.dismiss(animated: true)
bvc.select(url)
bvc.select(url: url)
})
controller.viewDidDisappear = {
if Preferences.Review.braveNewsCriteriaPassed.value {
Expand Down