diff --git a/ios/brave-ios/App/iOS/Delegates/SceneDelegate.swift b/ios/brave-ios/App/iOS/Delegates/SceneDelegate.swift index 8ccbbbd8c234..a94eb95df823 100644 --- a/ios/brave-ios/App/iOS/Delegates/SceneDelegate.swift +++ b/ios/brave-ios/App/iOS/Delegates/SceneDelegate.swift @@ -385,7 +385,13 @@ extension SceneDelegate { let urlString = userInfo[CSSearchableItemActivityIdentifier] as? String, let url = URL(string: urlString) { - scene.browserViewController?.switchToTabForURLOrOpen(url, isPrivileged: false) + let isPrivateBrowsing = + scene.browserViewController?.privateBrowsingManager.isPrivateBrowsing == true + scene.browserViewController?.switchToTabForURLOrOpen( + url, + isPrivate: isPrivateBrowsing, + isPrivileged: false + ) return } case ActivityType.newTab.identifier: @@ -480,7 +486,13 @@ extension SceneDelegate { break } - scene.browserViewController?.switchToTabForURLOrOpen(url, isPrivileged: true) + let isPrivateBrowsing = + scene.browserViewController?.privateBrowsingManager.isPrivateBrowsing == true + scene.browserViewController?.switchToTabForURLOrOpen( + url, + isPrivate: isPrivateBrowsing, + isPrivileged: false + ) return } } @@ -665,7 +677,11 @@ extension SceneDelegate { if let urlToOpen = urlToOpen { DispatchQueue.main.async { browserViewController.loadViewIfNeeded() - browserViewController.switchToTabForURLOrOpen(urlToOpen, isPrivileged: false) + browserViewController.switchToTabForURLOrOpen( + urlToOpen, + isPrivate: isPrivate, + isPrivileged: false + ) } } diff --git a/ios/brave-ios/Sources/Brave/Frontend/Browser/BrowserViewController/BrowserViewController.swift b/ios/brave-ios/Sources/Brave/Frontend/Browser/BrowserViewController/BrowserViewController.swift index fc868b51af19..e053a94e282f 100644 --- a/ios/brave-ios/Sources/Brave/Frontend/Browser/BrowserViewController/BrowserViewController.swift +++ b/ios/brave-ios/Sources/Brave/Frontend/Browser/BrowserViewController/BrowserViewController.swift @@ -1905,7 +1905,7 @@ public class BrowserViewController: UIViewController { browser.tabManager.addTabsForURLs([url], zombie: false, isPrivate: isPrivate) } - public func switchToTabForURLOrOpen(_ url: URL, isPrivate: Bool = false, isPrivileged: Bool) { + public func switchToTabForURLOrOpen(_ url: URL, isPrivate: Bool, isPrivileged: Bool) { popToBVC(isAnimated: false) if let tab = tabManager.getTabForURL(url, isPrivate: isPrivate) {