diff --git a/Sources/Brave/Frontend/Browser/BrowserViewController.swift b/Sources/Brave/Frontend/Browser/BrowserViewController.swift index a95e16c980c..76200ad55ff 100644 --- a/Sources/Brave/Frontend/Browser/BrowserViewController.swift +++ b/Sources/Brave/Frontend/Browser/BrowserViewController.swift @@ -2542,6 +2542,10 @@ extension BrowserViewController: TabsBarViewControllerDelegate { break } } + + func tabsBarDidSelectAddNewWindow(_ isPrivate: Bool) { + self.openInNewWindow(url: nil, isPrivate: isPrivate) + } } extension BrowserViewController: TabDelegate { diff --git a/Sources/Brave/Frontend/Browser/Tabs/TabBar/TabsBarViewController.swift b/Sources/Brave/Frontend/Browser/Tabs/TabBar/TabsBarViewController.swift index 8eaa815557d..812085f04a6 100644 --- a/Sources/Brave/Frontend/Browser/Tabs/TabBar/TabsBarViewController.swift +++ b/Sources/Brave/Frontend/Browser/Tabs/TabBar/TabsBarViewController.swift @@ -14,7 +14,7 @@ protocol TabsBarViewControllerDelegate: AnyObject { func tabsBarDidLongPressAddTab(_ tabsBarController: TabsBarViewController, button: UIButton) func tabsBarDidSelectAddNewTab(_ isPrivate: Bool) func tabsBarDidChangeReaderModeVisibility(_ isHidden: Bool) - + func tabsBarDidSelectAddNewWindow(_ isPrivate: Bool) } class TabsBarViewController: UIViewController { @@ -123,6 +123,14 @@ class TabsBarViewController: UIViewController { }) newTabMenu.append(openNewTab) + + newTabMenu.append(UIAction(title: Strings.newWindowTitle, image: UIImage(braveSystemNamed: "leo.window"), handler: UIAction.deferredActionHandler { [unowned self] _ in + self.delegate?.tabsBarDidSelectAddNewWindow(false) + })) + + newTabMenu.append(UIAction(title: Strings.newPrivateWindowTitle, image: UIImage(braveSystemNamed: "leo.window.tab-private"), handler: UIAction.deferredActionHandler { [unowned self] _ in + self.delegate?.tabsBarDidSelectAddNewWindow(true) + })) plusButton.menu = UIMenu(title: "", identifier: nil, children: newTabMenu) privateModeCancellable = tabManager?.privateBrowsingManager diff --git a/Sources/BraveStrings/BraveStrings.swift b/Sources/BraveStrings/BraveStrings.swift index 34836c8b4b5..e8d3e0bcf5e 100644 --- a/Sources/BraveStrings/BraveStrings.swift +++ b/Sources/BraveStrings/BraveStrings.swift @@ -143,6 +143,8 @@ extension Strings { comment: "Error description when there is an error while navigating to Files App") public static let openInNewWindowTitle = NSLocalizedString("OpenInNewWindowTitle", tableName: "BraveShared", bundle: .module, value: "Open in New Window", comment: "Context menu item for opening a link in a new window") public static let openInNewPrivateWindowTitle = NSLocalizedString("OpenInNewPrivateWindowTitle", tableName: "BraveShared", bundle: .module, value: "Open in New Private Window", comment: "Context menu item for opening a link in a new private browsing window") + public static let newWindowTitle = NSLocalizedString("NewWindowTitle", tableName: "BraveShared", bundle: .module, value: "New Window", comment: "Context menu item for opening a new window") + public static let newPrivateWindowTitle = NSLocalizedString("NewPrivateWindowTitle", tableName: "BraveShared", bundle: .module, value: "New Private Window", comment: "Context menu item for opening a new private browsing window") } // MARK:- DefaultBrowserIntroCalloutViewController.swift