Skip to content

Commit 28f2c34

Browse files
committed
Merge branch 'feat/6964-persist-stats-time-range' into fix/7639-swipe-to-switch-time-range-tab
* feat/6964-persist-stats-time-range: (21 commits) Expand test group log when tests failed Removes Custom intent Manually handle provisioning profiles & Disables Bitcode Modified test. Navigate to hubmenu post-notification Set `skip_prechecks:true` in CI release builds Revert "Force a couple of test case failures" Bump version number Update metadata translations Update app translations – `Localizable.strings` Only link, not embed, WooFoundation and Experiments in widgets target Update Tracks from version `0.12.0-beta.2` to `0.12.0` stable Force a couple of test case failures Make sure test results are archived when test suites fail Rename unit test meaningfully after flag removal Delete unused NSLocalizedString Remove redundant return Remove hubMenu feature flag unit tests Typo: Fix failing Unit Tests Remove isHubMenuOn from MockFeatureFlagService init Remove hubMenu MockFeatureFlag. Check Unit Tests pass ...
2 parents ab578d0 + a3ae0f1 commit 28f2c34

File tree

51 files changed

+348
-698
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+348
-698
lines changed

.buildkite/commands/release-build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ bundle exec fastlane run configure_apply
2222
echo "--- :hammer_and_wrench: Building"
2323
bundle exec fastlane build_and_upload_itc \
2424
skip_confirm:true \
25+
skip_prechecks:true \
2526
create_release:true \
2627
beta_release:${1:-true} # use first call param, default to true for safety

.buildkite/commands/run-ui-tests.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,18 @@ install_cocoapods
3535
echo "--- 🧪 Testing"
3636
xcrun simctl list >> /dev/null
3737
rake mocks &
38+
set +e
3839
bundle exec fastlane test_without_building name:"$TEST_NAME" device:"$DEVICE" ios_version:"$IOS_VERSION"
40+
TESTS_EXIT_STATUS=$?
41+
set -e
42+
43+
if [[ "$TESTS_EXIT_STATUS" -ne 0 ]]; then
44+
# Keep the (otherwise collapsed) current "Testing" section open in Buildkite logs on error. See https://buildkite.com/docs/pipelines/managing-log-output#collapsing-output
45+
echo "^^^ +++"
46+
echo "UI Tests failed!"
47+
fi
3948

4049
echo "--- 📦 Zipping test results"
4150
cd fastlane/test_output/ && zip -rq WooCommerce.xcresult.zip WooCommerce.xcresult && cd -
51+
52+
exit $TESTS_EXIT_STATUS

.buildkite/commands/run-unit-tests.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,18 @@ echo "--- :rubygems: Setting up Gems"
1616
install_gems
1717

1818
echo "--- 🧪 Testing"
19+
set +e
1920
bundle exec fastlane test_without_building name:UnitTests
21+
TESTS_EXIT_STATUS=$?
22+
set -e
23+
24+
if [[ "$TESTS_EXIT_STATUS" -ne 0 ]]; then
25+
# Keep the (otherwise collapsed) current "Testing" section open in Buildkite logs on error. See https://buildkite.com/docs/pipelines/managing-log-output#collapsing-output
26+
echo "^^^ +++"
27+
echo "Unit Tests failed!"
28+
fi
2029

2130
echo "--- 📦 Zipping test results"
2231
cd fastlane/test_output/ && zip -rq WooCommerce.xcresult.zip WooCommerce.xcresult && cd -
32+
33+
exit $TESTS_EXIT_STATUS

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

Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def aztec
2727
end
2828

2929
def tracks
30-
pod 'Automattic-Tracks-iOS', '~> 0.12.0-beta.2'
30+
pod 'Automattic-Tracks-iOS', '~> 0.12.0'
3131
# pod 'Automattic-Tracks-iOS', :git => 'https://github.com/Automattic/Automattic-Tracks-iOS.git', :branch => ''
3232
# pod 'Automattic-Tracks-iOS', :git => 'https://github.com/Automattic/Automattic-Tracks-iOS.git', :commit => ''
3333
# pod 'Automattic-Tracks-iOS', :path => '../Automattic-Tracks-iOS'

Podfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ PODS:
66
- AppAuth/Core (1.5.0)
77
- AppAuth/ExternalUserAgent (1.5.0):
88
- AppAuth/Core
9-
- Automattic-Tracks-iOS (0.12.0-beta.2):
9+
- Automattic-Tracks-iOS (0.12.0):
1010
- Sentry (~> 6)
1111
- Sodium (>= 0.9.1)
1212
- UIDeviceIdentifier (~> 2.0)
@@ -83,7 +83,7 @@ PODS:
8383

8484
DEPENDENCIES:
8585
- Alamofire (~> 4.8)
86-
- Automattic-Tracks-iOS (~> 0.12.0-beta.2)
86+
- Automattic-Tracks-iOS (~> 0.12.0)
8787
- CocoaLumberjack (~> 3.7.4)
8888
- CocoaLumberjack/Swift (~> 3.7.4)
8989
- Gridicons (~> 1.2.0)
@@ -144,7 +144,7 @@ SPEC REPOS:
144144
SPEC CHECKSUMS:
145145
Alamofire: 3ec537f71edc9804815215393ae2b1a8ea33a844
146146
AppAuth: 80317d99ac7ff2801a2f18ff86b48cd315ed465d
147-
Automattic-Tracks-iOS: f31213fbf0391968ffcff75e8c1bdad398589261
147+
Automattic-Tracks-iOS: dae8787ffc2c74493a3a908abc48aed527686131
148148
CocoaLumberjack: 543c79c114dadc3b1aba95641d8738b06b05b646
149149
FormatterKit: 184db51bf120b633693a73624a4cede89ec51a41
150150
GoogleSignIn: fd381840dbe7c1137aa6dc30849a5c3e070c034a
@@ -179,6 +179,6 @@ SPEC CHECKSUMS:
179179
ZendeskSupportProvidersSDK: 2bdf8544f7cd0fd4c002546f5704b813845beb2a
180180
ZendeskSupportSDK: 3a8e508ab1d9dd22dc038df6c694466414e037ba
181181

182-
PODFILE CHECKSUM: 4bdf9f791fbedc1074a7e20f9ff254db1f59c7ba
182+
PODFILE CHECKSUM: 79417db449eae85f8a39f1707df162e137f11d43
183183

184184
COCOAPODS: 1.11.2

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

0 commit comments

Comments
 (0)