Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Commit 22cddbc

Browse files
authoredApr 12, 2024
Open new browser window if no windows exist (#2610)
Task/Issue URL: https://app.asana.com/0/1203137811378537/1207061568595472/f Tech Design URL: CC: **Description**: Fixes an issue when "Open DDG" doesn't create a new window if none existing window is found. **Steps to test this PR**: 1. With at least one DDG opened and in the background, open status bar menu > Open DDG 2. Expect: DDG is brought to the foreground 3. Close all DDG windows 4. Open status bar menu > Open DDG 5. Expect: New DDG window is created <!-- Tagging instructions If this PR isn't ready to be merged for whatever reason it should be marked with the `DO NOT MERGE` label (particularly if it's a draft) If it's pending Product Review/PFR, please add the `Pending Product Review` label. If at any point it isn't actively being worked on/ready for review/otherwise moving forward (besides the above PR/PFR exception) strongly consider closing it (or not opening it in the first place). If you decide not to close it, make sure it's labelled to make it clear the PRs state and comment with more information. --> --- ###### Internal references: [Pull Request Review Checklist](https://app.asana.com/0/1202500774821704/1203764234894239/f) [Software Engineering Expectations](https://app.asana.com/0/59792373528535/199064865822552) [Technical Design Template](https://app.asana.com/0/59792373528535/184709971311943) [Pull Request Documentation](https://app.asana.com/0/1202500774821704/1204012835277482/f)
1 parent 13d488e commit 22cddbc

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed
 

‎DuckDuckGo/Application/URLEventHandler.swift

+2
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ final class URLEventHandler {
145145
WindowControllersManager.shared.showPreferencesTab(withSelectedPane: .vpn)
146146
case AppLaunchCommand.shareFeedback.launchURL:
147147
WindowControllersManager.shared.showShareFeedbackModal()
148+
case AppLaunchCommand.justOpen.launchURL:
149+
WindowControllersManager.shared.showNewWindow()
148150
case AppLaunchCommand.showVPNLocations.launchURL:
149151
WindowControllersManager.shared.showPreferencesTab(withSelectedPane: .vpn)
150152
WindowControllersManager.shared.showLocationPickerSheet()

‎DuckDuckGo/Windows/View/WindowControllersManager.swift

+7
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,13 @@ extension WindowControllersManager {
237237
}
238238
}
239239

240+
func showNewWindow() {
241+
guard WindowControllersManager.shared.lastKeyMainWindowController == nil else { return }
242+
let tabCollection = TabCollection(tabs: [])
243+
let tabCollectionViewModel = TabCollectionViewModel(tabCollection: tabCollection)
244+
_ = WindowsManager.openNewWindow(with: tabCollectionViewModel)
245+
}
246+
240247
func showLocationPickerSheet() {
241248
let locationsViewController = VPNLocationsHostingViewController()
242249
let locationsWindowController = locationsViewController.wrappedInWindowController()

0 commit comments

Comments
 (0)