Skip to content

[iOS] - Fix Private Browsing Not working on Open Window (uplift to 1.78.x) #28723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 19, 2025
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
22 changes: 19 additions & 3 deletions ios/brave-ios/App/iOS/Delegates/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1893,7 +1893,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) {
Expand Down
Loading