From 6b03a959f2b6d92bae507aa0964b536fa17ae6ea Mon Sep 17 00:00:00 2001 From: Brandon-T Date: Mon, 25 Sep 2023 11:44:51 -0400 Subject: [PATCH] Fix #8146: Fixes Tab Selection and mode switching (#8147) --- .../Frontend/Browser/Tabs/TabTray/TabTrayController.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Sources/Brave/Frontend/Browser/Tabs/TabTray/TabTrayController.swift b/Sources/Brave/Frontend/Browser/Tabs/TabTray/TabTrayController.swift index 2fd5b819ba4..3a2dd2109c6 100644 --- a/Sources/Brave/Frontend/Browser/Tabs/TabTray/TabTrayController.swift +++ b/Sources/Brave/Frontend/Browser/Tabs/TabTray/TabTrayController.swift @@ -648,11 +648,12 @@ class TabTrayController: AuthenticationController { tabManager.addTabAndSelect(isPrivate: true) } - let privateModeTabSelected = tabManager.allTabs[safe: tabManager.privateTabSelectedIndex] + let privateModeTabSelected = tabManager.tabsForCurrentMode[safe: tabManager.privateTabSelectedIndex] ?? tabManager.tabsForCurrentMode.last if Preferences.Privacy.persistentPrivateBrowsing.value { tabManager.selectTab(privateModeTabSelected) } + tabTrayView.hidePrivateModeInfo() tabTrayView.collectionView.reloadData() @@ -668,8 +669,8 @@ class TabTrayController: AuthenticationController { // When you go back from private mode, a previous current tab is selected // Reloding the collection view in order to mark the selecte the tab - let normalModeTabSelected = tabManager.allTabs[safe: tabManager.normalTabSelectedIndex] - + let normalModeTabSelected = tabManager.tabsForCurrentMode[safe: tabManager.normalTabSelectedIndex] ?? tabManager.tabsForCurrentMode.last + tabManager.selectTab(normalModeTabSelected) tabTrayView.collectionView.reloadData()