Skip to content

Commit

Permalink
Uplift of #26621 (squashed) to beta
Browse files Browse the repository at this point in the history
  • Loading branch information
brave-builds committed Nov 19, 2024
1 parent 8e0c4f6 commit 60d23da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2171,7 +2171,12 @@ public class BrowserViewController: UIViewController {
let request: URLRequest?
if let url = url {
// If only empty tab present, the url will open in existing tab
if tabManager.isBrowserEmptyForCurrentMode {
// We also need to respect private browsing mode when opening URLs directly.
// If the only tab open is NTP, AND the private mode matches that of the tab request,
// only then we can open the tab directly.
if tabManager.isBrowserEmptyForCurrentMode
&& tabManager.privateBrowsingManager.isPrivateBrowsing == isPrivate
{
finishEditingAndSubmit(url)
return
}
Expand Down
7 changes: 3 additions & 4 deletions ios/brave-ios/Sources/Brave/Frontend/Browser/TabManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,9 @@ class TabManager: NSObject {
if previous === tab {
return
}
// Convert the global mode to private if opening private tab from normal tab/ history/bookmark.
if selectedTab?.isPrivate != true && tab?.isPrivate == true {
privateBrowsingManager.isPrivateBrowsing = true
}
// Convert the global mode to normal/private
privateBrowsingManager.isPrivateBrowsing = tab?.isPrivate == true

// Make sure to wipe the private tabs if the user has the pref turned on
if !TabType.of(tab).isPrivate
&& (Preferences.Privacy.privateBrowsingOnly.value
Expand Down

0 comments on commit 60d23da

Please sign in to comment.