@@ -35,14 +35,14 @@ extension WooTab {
3535 ///
3636 /// - Parameters:
3737 /// - visibleIndex: the index of visible tabs on the tab bar
38- init ( visibleIndex: Int , isHubMenuFeatureFlagOn : Bool ) {
39- let tabs = WooTab . visibleTabs ( isHubMenuFeatureFlagOn )
38+ init ( visibleIndex: Int ) {
39+ let tabs = WooTab . visibleTabs ( )
4040 self = tabs [ visibleIndex]
4141 }
4242
4343 /// Returns the visible tab index.
44- func visibleIndex( _ isHubMenuFeatureFlagOn : Bool ) -> Int {
45- let tabs = WooTab . visibleTabs ( isHubMenuFeatureFlagOn )
44+ func visibleIndex( ) -> Int {
45+ let tabs = WooTab . visibleTabs ( )
4646 guard let tabIndex = tabs. firstIndex ( where: { $0 == self } ) else {
4747 assertionFailure ( " Trying to get the visible tab index for tab \( self ) while the visible tabs are: \( tabs) " )
4848 return 0
@@ -51,17 +51,8 @@ extension WooTab {
5151 }
5252
5353 // Note: currently only the Dashboard tab (My Store) view controller is set up in Main.storyboard.
54- private static func visibleTabs( _ isHubMenuFeatureFlagOn: Bool ) -> [ WooTab ] {
55- var tabs : [ WooTab ] = [ . myStore, . orders, . products]
56-
57- if isHubMenuFeatureFlagOn {
58- tabs. append ( . hubMenu)
59- }
60- else {
61- tabs. append ( . reviews)
62- }
63-
64- return tabs
54+ private static func visibleTabs( ) -> [ WooTab ] {
55+ [ . myStore, . orders, . products, . hubMenu]
6556 }
6657}
6758
@@ -114,8 +105,6 @@ final class MainTabBarController: UITabBarController {
114105
115106 private var productImageUploadErrorsSubscription : AnyCancellable ?
116107
117- private lazy var isHubMenuFeatureFlagOn = featureFlagService. isFeatureFlagEnabled ( . hubMenu)
118-
119108 private lazy var isOrdersSplitViewFeatureFlagOn = featureFlagService. isFeatureFlagEnabled ( . splitViewInOrdersTab)
120109
121110 init ? ( coder: NSCoder ,
@@ -174,11 +163,11 @@ final class MainTabBarController: UITabBarController {
174163 }
175164
176165 override func tabBar( _ tabBar: UITabBar , didSelect item: UITabBarItem ) {
177- let currentlySelectedTab = WooTab ( visibleIndex: selectedIndex, isHubMenuFeatureFlagOn : isHubMenuFeatureFlagOn )
166+ let currentlySelectedTab = WooTab ( visibleIndex: selectedIndex)
178167 guard let userSelectedIndex = tabBar. items? . firstIndex ( of: item) else {
179168 return
180169 }
181- let userSelectedTab = WooTab ( visibleIndex: userSelectedIndex, isHubMenuFeatureFlagOn : isHubMenuFeatureFlagOn )
170+ let userSelectedTab = WooTab ( visibleIndex: userSelectedIndex)
182171
183172 // Did we reselect the already-selected tab?
184173 if currentlySelectedTab == userSelectedTab {
@@ -197,7 +186,7 @@ final class MainTabBarController: UITabBarController {
197186 if let presentedController = Self . childViewController ( ) ? . presentedViewController {
198187 presentedController. dismiss ( animated: true )
199188 }
200- selectedIndex = tab. visibleIndex ( isHubMenuFeatureFlagOn )
189+ selectedIndex = tab. visibleIndex ( )
201190 if let navController = selectedViewController as? UINavigationController {
202191 navController. popToRootViewController ( animated: animated) {
203192 completion ? ( )
@@ -439,22 +428,17 @@ private extension MainTabBarController {
439428 viewControllers = {
440429 var controllers = [ UIViewController] ( )
441430
442- let dashboardTabIndex = WooTab . myStore. visibleIndex ( isHubMenuFeatureFlagOn )
431+ let dashboardTabIndex = WooTab . myStore. visibleIndex ( )
443432 controllers. insert ( dashboardNavigationController, at: dashboardTabIndex)
444433
445- let ordersTabIndex = WooTab . orders. visibleIndex ( isHubMenuFeatureFlagOn )
434+ let ordersTabIndex = WooTab . orders. visibleIndex ( )
446435 controllers. insert ( ordersNavigationController, at: ordersTabIndex)
447436
448- let productsTabIndex = WooTab . products. visibleIndex ( isHubMenuFeatureFlagOn )
437+ let productsTabIndex = WooTab . products. visibleIndex ( )
449438 controllers. insert ( productsNavigationController, at: productsTabIndex)
450439
451- if isHubMenuFeatureFlagOn {
452- let hubMenuTabIndex = WooTab . hubMenu. visibleIndex ( isHubMenuFeatureFlagOn)
453- controllers. insert ( hubMenuNavigationController, at: hubMenuTabIndex)
454- } else {
455- let reviewsTabIndex = WooTab . reviews. visibleIndex ( isHubMenuFeatureFlagOn)
456- controllers. insert ( reviewsNavigationController, at: reviewsTabIndex)
457- }
440+ let hubMenuTabIndex = WooTab . hubMenu. visibleIndex ( )
441+ controllers. insert ( hubMenuNavigationController, at: hubMenuTabIndex)
458442
459443 return controllers
460444 } ( )
@@ -487,26 +471,16 @@ private extension MainTabBarController {
487471 let productsViewController = createProductsViewController ( siteID: siteID)
488472 productsNavigationController. viewControllers = [ productsViewController]
489473
490- // Configure hub menu tab coordinator or reviews tab coordinator once per logged in session potentially with multiple sites.
491- if isHubMenuFeatureFlagOn {
492- if hubMenuTabCoordinator == nil {
493- let hubTabCoordinator = createHubMenuTabCoordinator ( )
494- self . hubMenuTabCoordinator = hubTabCoordinator
495- hubTabCoordinator. start ( )
496- }
497- hubMenuTabCoordinator? . activate ( siteID: siteID)
498- }
499- else {
500- if reviewsTabCoordinator == nil {
501- let reviewsTabCoordinator = createReviewsTabCoordinator ( )
502- self . reviewsTabCoordinator = reviewsTabCoordinator
503- reviewsTabCoordinator. start ( )
504- }
505- reviewsTabCoordinator? . activate ( siteID: siteID)
474+ // Configure hub menu tab coordinator once per logged in session potentially with multiple sites.
475+ if hubMenuTabCoordinator == nil {
476+ let hubTabCoordinator = createHubMenuTabCoordinator ( )
477+ self . hubMenuTabCoordinator = hubTabCoordinator
478+ hubTabCoordinator. start ( )
506479 }
480+ hubMenuTabCoordinator? . activate ( siteID: siteID)
507481
508482 // Set dashboard to be the default tab.
509- selectedIndex = WooTab . myStore. visibleIndex ( isHubMenuFeatureFlagOn )
483+ selectedIndex = WooTab . myStore. visibleIndex ( )
510484 }
511485
512486 func createDashboardViewController( siteID: Int64 ) -> UIViewController {
@@ -561,8 +535,8 @@ private extension MainTabBarController {
561535 }
562536
563537 func updateMenuTabBadge( with action: NotificationBadgeActionType ) {
564- let tab = self . isHubMenuFeatureFlagOn ? WooTab . hubMenu : WooTab . reviews
565- let tabIndex = tab. visibleIndex ( self . isHubMenuFeatureFlagOn )
538+ let tab = WooTab . hubMenu
539+ let tabIndex = tab. visibleIndex ( )
566540 let input = NotificationsBadgeInput ( action: action, tab: tab, tabBar: self . tabBar, tabIndex: tabIndex)
567541
568542 self . notificationsBadge. updateBadge ( with: input)
@@ -579,7 +553,7 @@ private extension MainTabBarController {
579553 }
580554
581555 let tab = WooTab . orders
582- let tabIndex = tab. visibleIndex ( self . isHubMenuFeatureFlagOn )
556+ let tabIndex = tab. visibleIndex ( )
583557
584558 guard let orderTab: UITabBarItem = self . tabBar. items ? [ tabIndex] else {
585559 return
0 commit comments