Skip to content

Commit f8a7576

Browse files
authored
Merge pull request #7626 from woocommerce/issue/7605-remove-hubmenu-feature-flag
Remove `.hubMenu` feature flag references
2 parents 931adb4 + 8c782c9 commit f8a7576

File tree

9 files changed

+66
-198
lines changed

9 files changed

+66
-198
lines changed

Experiments/Experiments/DefaultFeatureFlagService.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
99
return buildConfig == .localDeveloper || buildConfig == .alpha
1010
case .jetpackConnectionPackageSupport:
1111
return true
12-
case .hubMenu:
13-
return true
1412
case .couponView:
1513
return true
1614
case .productSKUInputScanner:

Experiments/Experiments/FeatureFlag.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ public enum FeatureFlag: Int {
1818
///
1919
case jetpackConnectionPackageSupport
2020

21-
/// Display the new tab "Menu" in the tab bar.
22-
///
23-
case hubMenu
24-
2521
/// Displays the option to view coupons
2622
///
2723
case couponView

WooCommerce/Classes/ViewRelated/Dashboard/DashboardViewController.swift

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ private extension DashboardViewController {
148148
func configureNavigation() {
149149
configureTitle()
150150
configureHeaderStackView()
151-
configureNavigationItem()
152151
}
153152

154153
func configureTabBarItem() {
@@ -196,23 +195,6 @@ private extension DashboardViewController {
196195
contentBottomToContainerConstraint = contentView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor)
197196
}
198197

199-
private func configureNavigationItem() {
200-
if !ServiceLocator.featureFlagService.isFeatureFlagEnabled(.hubMenu) {
201-
let rightBarButton = UIBarButtonItem(image: .gearBarButtonItemImage,
202-
style: .plain,
203-
target: self,
204-
action: #selector(settingsTapped))
205-
rightBarButton.accessibilityLabel = NSLocalizedString("Settings", comment: "Accessibility label for the Settings button.")
206-
rightBarButton.accessibilityTraits = .button
207-
rightBarButton.accessibilityHint = NSLocalizedString(
208-
"Navigates to Settings.",
209-
comment: "VoiceOver accessibility hint, informing the user the button can be used to navigate to the Settings screen."
210-
)
211-
rightBarButton.accessibilityIdentifier = "dashboard-settings-button"
212-
navigationItem.setRightBarButton(rightBarButton, animated: false)
213-
}
214-
}
215-
216198
func configureDashboardUIContainer() {
217199
hiddenScrollView.configureForLargeTitleWorkaround()
218200
// Adds the "hidden" scroll view to the root of the UIViewController for large titles.

WooCommerce/Classes/ViewRelated/Dashboard/Settings/Settings/SettingsViewModel.swift

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -195,20 +195,6 @@ private extension SettingsViewModel {
195195
}
196196

197197
func configureSections() {
198-
// Selected Store
199-
let selectedStoreSection: Section? = {
200-
if featureFlagService.isFeatureFlagEnabled(.hubMenu) {
201-
return nil
202-
}
203-
else {
204-
let storeRows: [Row] = sites.count > 1 ?
205-
[.selectedStore, .switchStore] : [.selectedStore]
206-
return Section(title: Localization.selectedStoreTitle,
207-
rows: storeRows,
208-
footerHeight: UITableView.automaticDimension)
209-
}
210-
}()
211-
212198
// Plugins
213199
let pluginsSection: Section? = {
214200
// Show the plugins section only if the user has an `admin` role for the default store site.
@@ -301,7 +287,6 @@ private extension SettingsViewModel {
301287
footerHeight: CGFloat.leastNonzeroMagnitude)
302288

303289
sections = [
304-
selectedStoreSection,
305290
pluginsSection,
306291
storeSettingsSection,
307292
helpAndFeedbackSection,
@@ -371,12 +356,6 @@ private extension SettingsViewModel {
371356
//
372357
private extension SettingsViewModel {
373358
enum Localization {
374-
static let selectedStoreTitle = NSLocalizedString(
375-
"Selected Store",
376-
comment: "My Store > Settings > Selected Store information section. " +
377-
"This is the heading listed above the information row that displays the store website and their username."
378-
).uppercased()
379-
380359
static let pluginsTitle = NSLocalizedString(
381360
"Plugins",
382361
comment: "My Store > Settings > Plugins section title"

WooCommerce/Classes/ViewRelated/MainTabBarController.swift

Lines changed: 24 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -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

WooCommerce/Classes/ViewRelated/Reviews/ReviewsViewController.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,7 @@ private extension ReviewsViewController {
235235
}
236236

237237
func refreshTitle() {
238-
if ServiceLocator.featureFlagService.isFeatureFlagEnabled(.hubMenu) {
239-
title = Localization.title
240-
} else {
241-
navigationItem.title = Localization.title
242-
}
238+
title = Localization.title
243239
}
244240
}
245241

WooCommerce/WooCommerceTests/Mocks/MockFeatureFlagService.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import Experiments
33

44
struct MockFeatureFlagService: FeatureFlagService {
55
private let isJetpackConnectionPackageSupportOn: Bool
6-
private let isHubMenuOn: Bool
76
private let isInboxOn: Bool
87
private let isSplitViewInOrdersTabOn: Bool
98
private let isUpdateOrderOptimisticallyOn: Bool
@@ -13,7 +12,6 @@ struct MockFeatureFlagService: FeatureFlagService {
1312
private let isLoginPrologueOnboardingEnabled: Bool
1413

1514
init(isJetpackConnectionPackageSupportOn: Bool = false,
16-
isHubMenuOn: Bool = false,
1715
isInboxOn: Bool = false,
1816
isSplitViewInOrdersTabOn: Bool = false,
1917
isUpdateOrderOptimisticallyOn: Bool = false,
@@ -22,7 +20,6 @@ struct MockFeatureFlagService: FeatureFlagService {
2220
isBackgroundImageUploadEnabled: Bool = false,
2321
isLoginPrologueOnboardingEnabled: Bool = false) {
2422
self.isJetpackConnectionPackageSupportOn = isJetpackConnectionPackageSupportOn
25-
self.isHubMenuOn = isHubMenuOn
2623
self.isInboxOn = isInboxOn
2724
self.isSplitViewInOrdersTabOn = isSplitViewInOrdersTabOn
2825
self.isUpdateOrderOptimisticallyOn = isUpdateOrderOptimisticallyOn
@@ -36,8 +33,6 @@ struct MockFeatureFlagService: FeatureFlagService {
3633
switch featureFlag {
3734
case .jetpackConnectionPackageSupport:
3835
return isJetpackConnectionPackageSupportOn
39-
case .hubMenu:
40-
return isHubMenuOn
4136
case .inbox:
4237
return isInboxOn
4338
case .splitViewInOrdersTab:

0 commit comments

Comments
 (0)