Skip to content

Commit

Permalink
Refactor FXIOS-9085 Remove legacy tab tray entry point and flag (#22781)
Browse files Browse the repository at this point in the history
Remove legacy tab tray entry point and flag
  • Loading branch information
OrlaM authored Oct 28, 2024
1 parent c898362 commit ef43a38
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 122 deletions.
4 changes: 0 additions & 4 deletions firefox-ios/Client.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@
21DB34342B20FE35008CCB8E /* LegacyRemoteTabsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21DB34332B20FE35008CCB8E /* LegacyRemoteTabsTableViewController.swift */; };
21E77E4E2AA8BA5200FABA10 /* TabTrayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21E77E4D2AA8BA5200FABA10 /* TabTrayViewController.swift */; };
21E77E502AA8BAEC00FABA10 /* TabTrayState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21E77E4F2AA8BAEC00FABA10 /* TabTrayState.swift */; };
21E77E522AA8BE5C00FABA10 /* TabTrayFlagManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21E77E512AA8BE5C00FABA10 /* TabTrayFlagManager.swift */; };
21E78A7028F9A8C500F8D687 /* MockUIDevice.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21E78A6F28F9A8C500F8D687 /* MockUIDevice.swift */; };
21E78A7228F9A93100F8D687 /* UIDeviceInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21E78A7128F9A93100F8D687 /* UIDeviceInterface.swift */; };
21EA466A2B04130500AAAB2D /* TabsPanelState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21EA46692B04130500AAAB2D /* TabsPanelState.swift */; };
Expand Down Expand Up @@ -2625,7 +2624,6 @@
21DD4778B3C11A24D552AB34 /* lo */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lo; path = lo.lproj/Localizable.strings; sourceTree = "<group>"; };
21E77E4D2AA8BA5200FABA10 /* TabTrayViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabTrayViewController.swift; sourceTree = "<group>"; };
21E77E4F2AA8BAEC00FABA10 /* TabTrayState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabTrayState.swift; sourceTree = "<group>"; };
21E77E512AA8BE5C00FABA10 /* TabTrayFlagManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabTrayFlagManager.swift; sourceTree = "<group>"; };
21E78A6F28F9A8C500F8D687 /* MockUIDevice.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockUIDevice.swift; sourceTree = "<group>"; };
21E78A7128F9A93100F8D687 /* UIDeviceInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIDeviceInterface.swift; sourceTree = "<group>"; };
21EA46692B04130500AAAB2D /* TabsPanelState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabsPanelState.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -9900,7 +9898,6 @@
21357F2B293FDB07004BF9FD /* RemoteTabs */,
21C5B3592AF2A73F0093F366 /* State */,
21C5B3582AF2A7130093F366 /* Views */,
21E77E512AA8BE5C00FABA10 /* TabTrayFlagManager.swift */,
21B548942B1E5F1400DC1DF8 /* InactiveTabsManager.swift */,
5AA1D8262BC09ECB00957516 /* TabTrayAnimationQueue.swift */,
);
Expand Down Expand Up @@ -15715,7 +15712,6 @@
8AB8573027D94CAD0075C173 /* HomepageViewModelProtocol.swift in Sources */,
5A9F83422B2B796800272819 /* TabPeekState.swift in Sources */,
E1877A832875DEDE00F5BDF2 /* SyncedTabCell.swift in Sources */,
21E77E522AA8BE5C00FABA10 /* TabTrayFlagManager.swift in Sources */,
CA8226F324C11DB7008A6F38 /* PasswordManagerTableViewCell.swift in Sources */,
8A0A1BA02B2200FD00E8706F /* PrivateHomepageViewController.swift in Sources */,
E4A960061ABB9C450069AD6F /* ReaderModeUtils.swift in Sources */,
Expand Down
2 changes: 0 additions & 2 deletions firefox-ios/Client/FeatureFlags/NimbusFlaggableFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ enum NimbusFeatureFlagID: String, CaseIterable {
case reportSiteIssue
case searchHighlights
case splashScreen
case tabTrayRefactor
case unifiedSearch
case toolbarRefactor
case toolbarOneTapNewTab
Expand Down Expand Up @@ -116,7 +115,6 @@ struct NimbusFlaggableFeature: HasNimbusSearchBar {
.feltPrivacyFeltDeletion,
.searchHighlights,
.splashScreen,
.tabTrayRefactor,
.unifiedSearch,
.toolbarRefactor,
.toolbarOneTapNewTab,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,68 +36,9 @@ extension BrowserViewController: URLBarDelegate {
focusedSegment: TabTrayPanelType? = nil) {
updateFindInPageVisibility(isVisible: false)

if isTabTrayRefactorEnabled {
let isPrivateTab = tabManager.selectedTab?.isPrivate ?? false
let selectedSegment: TabTrayPanelType = focusedSegment ?? (isPrivateTab ? .privateTabs : .tabs)
navigationHandler?.showTabTray(selectedPanel: selectedSegment)
} else {
willNavigateAway()
showLegacyTabTrayViewController(withFocusOnUnselectedTab: tabToFocus,
focusedSegment: focusedSegment)
}
}

private func showLegacyTabTrayViewController(withFocusOnUnselectedTab tabToFocus: Tab? = nil,
focusedSegment: TabTrayPanelType? = nil) {
tabTrayViewController = LegacyTabTrayViewController(
tabTrayDelegate: self,
profile: profile,
tabToFocus: tabToFocus,
tabManager: tabManager,
overlayManager: overlayManager,
focusedSegment: focusedSegment)
(tabTrayViewController as? LegacyTabTrayViewController)?.qrCodeNavigationHandler = navigationHandler
tabTrayViewController?.openInNewTab = { url, isPrivate in
let tab = self.tabManager.addTab(
URLRequest(url: url),
afterTab: self.tabManager.selectedTab,
isPrivate: isPrivate
)
// If we are showing toptabs a user can just use the top tab bar
// If in overlay mode switching doesnt correctly dismiss the homepanels
guard !self.topTabsVisible,
!self.isToolbarRefactorEnabled,
!self.urlBar.inOverlayMode else { return }
// We're not showing the top tabs; show a toast to quick switch to the fresh new tab.
let viewModel = ButtonToastViewModel(labelText: .ContextMenuButtonToastNewTabOpenedLabelText,
buttonText: .ContextMenuButtonToastNewTabOpenedButtonText)
let toast = ButtonToast(viewModel: viewModel,
theme: self.currentTheme(),
completion: { buttonPressed in
if buttonPressed {
self.tabManager.selectTab(tab)
}
})
self.show(toast: toast)
}

tabTrayViewController?.didSelectUrl = { url, visitType in
guard let tab = self.tabManager.selectedTab else { return }
self.finishEditingAndSubmit(url, visitType: visitType, forTab: tab)
}

guard self.tabTrayViewController != nil else { return }

let navigationController = ThemedDefaultNavigationController(rootViewController: tabTrayViewController!,
windowUUID: windowUUID)
navigationController.presentationController?.delegate = tabTrayViewController

self.present(navigationController, animated: true, completion: nil)

TelemetryWrapper.recordEvent(category: .action, method: .open, object: .tabTray)

// App store review in-app prompt
ratingPromptManager.showRatingPromptIfNeeded()
let isPrivateTab = tabManager.selectedTab?.isPrivate ?? false
let selectedSegment: TabTrayPanelType = focusedSegment ?? (isPrivateTab ? .privateTabs : .tabs)
navigationHandler?.showTabTray(selectedPanel: selectedSegment)
}

func urlBarDidPressReload(_ urlBar: URLBarView) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ class BrowserViewController: UIViewController,
let profile: Profile
let tabManager: TabManager
let ratingPromptManager: RatingPromptManager
lazy var isTabTrayRefactorEnabled: Bool = TabTrayFlagManager.isRefactorEnabled
var isToolbarRefactorEnabled: Bool {
return featureFlags.isFeatureEnabled(.toolbarRefactor, checking: .buildOnly)
}
Expand Down Expand Up @@ -2414,15 +2413,10 @@ class BrowserViewController: UIViewController,
else { return }

DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(500), execute: {
let urlRequest = URLRequest(url: url)
if TabTrayFlagManager.isRefactorEnabled {
let action = TabPanelViewAction(panelType: .tabs,
windowUUID: self.windowUUID,
actionType: TabPanelViewActionType.addNewTab)
store.dispatch(action)
} else {
self.tabManager.addTab(urlRequest)
}
let action = TabPanelViewAction(panelType: .tabs,
windowUUID: self.windowUUID,
actionType: TabPanelViewActionType.addNewTab)
store.dispatch(action)

self.debugOpen(numberOfNewTabs: numberOfNewTabs - 1, at: url)
})
Expand Down
13 changes: 0 additions & 13 deletions firefox-ios/Client/Frontend/Browser/Tabs/TabTrayFlagManager.swift

This file was deleted.

8 changes: 0 additions & 8 deletions firefox-ios/Client/Nimbus/NimbusFeatureFlagLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ final class NimbusFeatureFlagLayer {
case .splashScreen:
return checkSplashScreenFeature(for: featureID, from: nimbus)

case .tabTrayRefactor:
return checkTabTrayRefactorFeature(from: nimbus)

case .toolbarRefactor:
return checkToolbarRefactorFeature(from: nimbus)

Expand Down Expand Up @@ -185,11 +182,6 @@ final class NimbusFeatureFlagLayer {
return status
}

private func checkTabTrayRefactorFeature(from nimbus: FxNimbus) -> Bool {
let config = nimbus.features.tabTrayRefactorFeature.value()
return config.enabled
}

private func checkToolbarRefactorFeature(from nimbus: FxNimbus) -> Bool {
let config = nimbus.features.toolbarRefactorFeature.value()
return config.enabled
Expand Down
11 changes: 5 additions & 6 deletions firefox-ios/Client/TabManagement/Legacy/LegacyTabManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -582,12 +582,11 @@ class LegacyTabManager: NSObject, FeatureFlaggable, TabManager, TabEventHandler
guard let index = tabs.firstIndex(where: { $0.tabUUID == tabUUID }) else { return }

let tab = tabs[index]
if TabTrayFlagManager.isRefactorEnabled {
backupCloseTab = BackupCloseTab(
tab: tab,
restorePosition: index,
isSelected: selectedTab?.tabUUID == tab.tabUUID)
}
backupCloseTab = BackupCloseTab(
tab: tab,
restorePosition: index,
isSelected: selectedTab?.tabUUID == tab.tabUUID)

self.removeTab(tab, flushToDisk: true)
self.updateSelectedTabAfterRemovalOf(tab, deletedIndex: index)

Expand Down
2 changes: 1 addition & 1 deletion firefox-ios/Client/TabManagement/TabManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protocol TabManager: AnyObject {
/// - Returns: Return list of tabs considered inactive
func getInactiveTabs() -> [Tab]

/// Async Remove all inactive tabs, used when user closes all inactive tabs and TabTrayFlagManager is enabled
/// Async Remove all inactive tabs, used when user closes all inactive tabs
func removeAllInactiveTabs() async

/// Undo all inactive tabs closure. All inactive tabs are added back to the list of tabs
Expand Down
15 changes: 0 additions & 15 deletions firefox-ios/nimbus-features/tabTrayRefactorFeature.yaml

This file was deleted.

1 change: 0 additions & 1 deletion firefox-ios/nimbus.fml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ include:
- nimbus-features/splashScreenFeature.yaml
- nimbus-features/spotlightSearchFeature.yaml
- nimbus-features/tabTrayFeature.yaml
- nimbus-features/tabTrayRefactorFeature.yaml
- nimbus-features/toolbarRefactorFeature.yaml
- nimbus-features/trackingProtectionRefactor.yaml
- nimbus-features/zoomFeature.yaml

0 comments on commit ef43a38

Please sign in to comment.