Skip to content

Commit 6f968cd

Browse files
authored
Merge pull request #7698 from woocommerce/issue/7605-remove-coupon-feature-flag
Remove coupons view/create/edit/delete feature flag references
2 parents 0ac2cee + 4acc030 commit 6f968cd

File tree

7 files changed

+17
-63
lines changed

7 files changed

+17
-63
lines changed

Experiments/Experiments/DefaultFeatureFlagService.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
77
switch featureFlag {
88
case .barcodeScanner:
99
return buildConfig == .localDeveloper || buildConfig == .alpha
10-
case .couponView:
11-
return true
1210
case .productSKUInputScanner:
1311
return true
1412
case .inbox:
@@ -17,12 +15,6 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
1715
return buildConfig == .localDeveloper || buildConfig == .alpha
1816
case .splitViewInOrdersTab:
1917
return buildConfig == .localDeveloper || buildConfig == .alpha
20-
case .couponDeletion:
21-
return true
22-
case .couponEditing:
23-
return true
24-
case .couponCreation:
25-
return true
2618
case .updateOrderOptimistically:
2719
return buildConfig == .localDeveloper || buildConfig == .alpha
2820
case .shippingLabelsOnboardingM1:

Experiments/Experiments/FeatureFlag.swift

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ public enum FeatureFlag: Int {
1414
///
1515
case reviews
1616

17-
/// Displays the option to view coupons
18-
///
19-
case couponView
20-
2117
/// Barcode scanner for product SKU input
2218
///
2319
case productSKUInputScanner
@@ -34,18 +30,6 @@ public enum FeatureFlag: Int {
3430
///
3531
case splitViewInOrdersTab
3632

37-
/// Displays the option to delete coupons
38-
///
39-
case couponDeletion
40-
41-
/// Displays the option to edit a coupon
42-
///
43-
case couponEditing
44-
45-
/// Displays the option to create a coupon
46-
///
47-
case couponCreation
48-
4933
/// Enable optimistic updates for orders
5034
///
5135
case updateOrderOptimistically

WooCommerce/Classes/ViewRelated/Coupons/CouponDetails/CouponDetails.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,11 @@ struct CouponDetails: View {
8686
])
8787
}
8888

89-
if viewModel.isDeletingEnabled {
90-
buttons.append(.destructive(Text(Localization.deleteCoupon), action: {
91-
ServiceLocator.analytics.track(.couponDetails, withProperties: ["action": "tapped_delete"])
92-
showingDeletionConfirmAlert = true
93-
}))
94-
}
89+
buttons.append(.destructive(Text(Localization.deleteCoupon), action: {
90+
ServiceLocator.analytics.track(.couponDetails, withProperties: ["action": "tapped_delete"])
91+
showingDeletionConfirmAlert = true
92+
}))
93+
9594

9695
buttons.append(.cancel())
9796

WooCommerce/Classes/ViewRelated/Coupons/CouponDetails/CouponDetailsViewModel.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ final class CouponDetailsViewModel: ObservableObject {
128128
private let currencySettings: CurrencySettings
129129

130130
let isEditingEnabled: Bool
131-
let isDeletingEnabled: Bool
132131

133132
// Closure to be triggered when the coupon is updated successfully
134133
let onUpdate: () -> Void
@@ -149,8 +148,7 @@ final class CouponDetailsViewModel: ObservableObject {
149148
self.onDeletion = onDeletion
150149
self.onUpdate = onUpdate
151150

152-
isEditingEnabled = featureFlags.isFeatureFlagEnabled(.couponEditing) && coupon.discountType != .other
153-
isDeletingEnabled = featureFlags.isFeatureFlagEnabled(.couponDeletion)
151+
isEditingEnabled = coupon.discountType != .other
154152
populateDetails()
155153
}
156154

WooCommerce/Classes/ViewRelated/Coupons/CouponListViewController.swift

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,9 @@ private extension CouponListViewController {
253253

254254
func configureNavigationBarItems(hasCoupons: Bool) {
255255
if hasCoupons {
256-
navigationItem.rightBarButtonItems = viewModel.isCreationEnabled
257-
? [createCouponButtonItem, searchBarButtonItem]
258-
: [searchBarButtonItem]
256+
navigationItem.rightBarButtonItems = [createCouponButtonItem, searchBarButtonItem]
259257
} else {
260-
navigationItem.rightBarButtonItems = viewModel.isCreationEnabled
261-
? [createCouponButtonItem]
262-
: []
258+
navigationItem.rightBarButtonItems = [createCouponButtonItem]
263259
}
264260
}
265261

@@ -382,21 +378,14 @@ private extension CouponListViewController {
382378
}
383379

384380
func buildNoResultConfig() -> EmptyStateViewController.Config {
385-
if viewModel.isCreationEnabled {
386-
return .withButton(
387-
message: .init(string: Localization.couponCreationSuggestionMessage),
388-
image: .emptyCouponsImage,
389-
details: Localization.emptyStateDetails,
390-
buttonTitle: Localization.createCouponAction
391-
) { [weak self] button in
392-
guard let self = self else { return }
393-
self.displayCouponTypeBottomSheet()
394-
}
395-
} else {
396-
return .simple(
397-
message: .init(string: Localization.emptyStateMessage),
398-
image: .emptyCouponsImage
399-
)
381+
return .withButton(
382+
message: .init(string: Localization.couponCreationSuggestionMessage),
383+
image: .emptyCouponsImage,
384+
details: Localization.emptyStateDetails,
385+
buttonTitle: Localization.createCouponAction
386+
) { [weak self] button in
387+
guard let self = self else { return }
388+
self.displayCouponTypeBottomSheet()
400389
}
401390
}
402391

WooCommerce/Classes/ViewRelated/Coupons/CouponListViewModel.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ final class CouponListViewModel {
6161
///
6262
private let storageManager: StorageManagerType
6363

64-
/// Marks if the Coupon Creation feature is enabled or not
65-
let isCreationEnabled: Bool
66-
6764
// MARK: - Initialization and setup
6865
//
6966
init(siteID: Int64,
@@ -78,7 +75,6 @@ final class CouponListViewModel {
7875
self.resultsController = Self.createResultsController(siteID: siteID,
7976
storageManager: storageManager)
8077

81-
isCreationEnabled = featureFlags.isFeatureFlagEnabled(.couponCreation)
8278
configureSyncingCoordinator()
8379
configureResultsController()
8480
configureFeedbackBannerVisibility()

WooCommerce/Classes/ViewRelated/Dashboard/Settings/Beta features/BetaFeaturesViewController.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,7 @@ private extension BetaFeaturesViewController {
9494
}
9595

9696
func couponManagementSection() -> Section? {
97-
guard ServiceLocator.featureFlagService.isFeatureFlagEnabled(.couponView) else {
98-
return nil
99-
}
100-
return Section(rows: [.couponManagement,
101-
.couponManagementDescription])
97+
Section(rows: [.couponManagement, .couponManagementDescription])
10298
}
10399

104100
/// Register table cells.

0 commit comments

Comments
 (0)