From 0b635e7a45ef953f41530fc0dd648ea95c063dc8 Mon Sep 17 00:00:00 2001 From: Brandon-T Date: Mon, 25 Sep 2023 11:44:51 -0400 Subject: [PATCH] Fix brave/brave-ios#8146: Fixes Tab Selection and mode switching (brave/brave-ios#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 37b615ffd9d5..f81629351840 100644 --- a/Sources/Brave/Frontend/Browser/Tabs/TabTray/TabTrayController.swift +++ b/Sources/Brave/Frontend/Browser/Tabs/TabTray/TabTrayController.swift @@ -671,11 +671,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() @@ -691,8 +692,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()