Skip to content

Commit 2bf26fa

Browse files
committed
Remove variableProductsInPointOfSale flag and related code
1 parent 4fadf3f commit 2bf26fa

File tree

10 files changed

+23
-152
lines changed

10 files changed

+23
-152
lines changed

Experiments/Experiments/DefaultFeatureFlagService.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,6 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
9191
return true
9292
case .acceptCashForPointOfSale:
9393
return true
94-
case .variableProductsInPointOfSale:
95-
return true
9694
case .hideSitesInStorePicker:
9795
return true
9896
case .filterHistoryOnOrderAndProductLists:

Experiments/Experiments/FeatureFlag.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,6 @@ public enum FeatureFlag: Int {
197197
///
198198
case acceptCashForPointOfSale
199199

200-
/// Supports variable products in POS.
201-
///
202-
case variableProductsInPointOfSale
203-
204200
/// Supports hiding sites from the store picker
205201
///
206202
case hideSitesInStorePicker

WooCommerce/Classes/POS/Presentation/ItemListView.swift

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -236,20 +236,16 @@ private extension ItemListView {
236236
static let isSimpleProductsOnlyBannerDismissedKey = "isSimpleProductsOnlyBannerDismissed"
237237
}
238238

239-
var variableProductsEnabled: Bool {
240-
ServiceLocator.featureFlagService.isFeatureFlagEnabled(.variableProductsInPointOfSale)
241-
}
242-
243239
var headerBannerTitle: String {
244-
variableProductsEnabled ? Localization.headerBannerTitleSimpleAndVariable : Localization.headerBannerTitle
240+
Localization.headerBannerTitleSimpleAndVariable
245241
}
246242

247243
var headerBannerSubtitle: String {
248-
variableProductsEnabled ? Localization.headerBannerSubtitleSimpleAndVariable : Localization.headerBannerSubtitle
244+
Localization.headerBannerSubtitleSimpleAndVariable
249245
}
250246

251247
var headerBannerHint: String {
252-
variableProductsEnabled ? Localization.headerBannerHintSimpleAndVariable : Localization.headerBannerHint
248+
Localization.headerBannerHintSimpleAndVariable
253249
}
254250

255251
enum Localization {
@@ -259,24 +255,6 @@ private extension ItemListView {
259255
comment: "Title at the top of the Point of Sale product selector screen."
260256
)
261257

262-
static let headerBannerTitle = NSLocalizedString(
263-
"pos.itemlistview.headerBanner.title",
264-
value: "Showing simple products only",
265-
comment: "Title of the product selector header banner, which explains current POS limitations"
266-
)
267-
268-
static let headerBannerSubtitle = NSLocalizedString(
269-
"pos.itemlistview.headerBanner.subtitle",
270-
value: "Only simple physical products are available with POS right now.",
271-
comment: "Subtitle of the product selector header banner, which explains current POS limitations"
272-
)
273-
274-
static let headerBannerHint = NSLocalizedString(
275-
"pos.itemlistview.headerBanner.hint",
276-
value: "Other product types, such as variable and virtual, will become available in future updates.",
277-
comment: "Additional text within the product selector header banner, which explains current POS limitations"
278-
)
279-
280258
static let headerBannerTitleSimpleAndVariable = NSLocalizedString(
281259
"pos.itemlistview.headerBanner.title.simpleAndVariable",
282260
value: "Showing simple and variable products only",

WooCommerce/Classes/POS/Presentation/SimpleProductsOnlyInformation.swift

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ import SwiftUI
22

33
struct SimpleProductsOnlyInformation: View {
44
@Binding var isPresented: Bool
5-
private var variableProductsEnabled: Bool {
6-
ServiceLocator.featureFlagService.isFeatureFlagEnabled(.variableProductsInPointOfSale)
7-
}
85
let deepLinkNavigator: DeepLinkNavigator?
96

107
init(isPresented: Binding<Bool>,
@@ -57,15 +54,15 @@ struct SimpleProductsOnlyInformation: View {
5754
}
5855

5956
private var issueMessage: String {
60-
variableProductsEnabled ? Localization.variableAndSimpleProductsOnlyIssueMessage : Localization.simpleProductsOnlyIssueMessage
57+
Localization.variableAndSimpleProductsOnlyIssueMessage
6158
}
6259

6360
private var futureMessage: String {
64-
variableProductsEnabled ? Localization.variableAndSimpleProductsOnlyFutureMessage : Localization.simpleProductsOnlyFutureMessage
61+
Localization.variableAndSimpleProductsOnlyFutureMessage
6562
}
6663

6764
private var hintMessage: String {
68-
variableProductsEnabled ? Localization.variableAndSimpleProdustsOnlyHint : Localization.modalHint
65+
Localization.variableAndSimpleProdustsOnlyHint
6966
}
7067
}
7168

@@ -88,31 +85,17 @@ private extension SimpleProductsOnlyInformation {
8885
value: "Why can't I see my products?",
8986
comment: "Title of the simple products information modal in POS"
9087
)
91-
static let simpleProductsOnlyIssueMessage = NSLocalizedString(
92-
"pos.simpleProductsModal.message.issue",
93-
value: "Only simple physical products can be used with POS right now.",
94-
comment: "Message in the simple products information modal in POS"
95-
)
88+
9689
static let variableAndSimpleProductsOnlyIssueMessage = NSLocalizedString(
9790
"pos.simpleProductsModal.message.issue.variableAndSimple",
9891
value: "Only simple and variable non-downloadable products can be used with POS right now.",
9992
comment: "Message in the simple products information modal in POS when variable products are supported"
10093
)
101-
static let simpleProductsOnlyFutureMessage = NSLocalizedString(
102-
"pos.simpleProductsModal.message.future",
103-
value: "Other product types, such as variable and virtual, will be available in future updates.",
104-
comment: "Message in the simple products information modal in POS, explaining future plans"
105-
)
10694
static let variableAndSimpleProductsOnlyFutureMessage = NSLocalizedString(
10795
"pos.simpleProductsModal.message.future.variableAndSimple",
10896
value: "Other product types will be available in future updates.",
10997
comment: "Message in the simple products information modal in POS, explaining future plans when variable products are supported"
11098
)
111-
static let modalHint = NSLocalizedString(
112-
"pos.simpleProductsModal.hint",
113-
value: "To take payment for a non-simple product, exit POS and create a new order from the orders tab.",
114-
comment: "Hint in the simple products information modal in POS"
115-
)
11699
static let variableAndSimpleProdustsOnlyHint = NSLocalizedString(
117100
"pos.simpleProductsModal.hint.variableAndSimple",
118101
value: "To take payment for an unsupported product, exit POS and create a new order from the orders tab.",

WooCommerce/Classes/ViewRelated/Dashboard/Settings/POS/POSEligibilityChecker.swift

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ private extension POSEligibilityChecker {
6666
return
6767
}
6868

69-
let wcPluginMinimumVersion = wcPluginMinimumVersion
69+
let wcPluginMinimumVersion = Constants.wcPluginMinimumVersion
7070

7171
let action = SystemStatusAction.fetchSystemPlugin(siteID: siteID, systemPluginName: Constants.wcPluginName) { wcPlugin in
7272
guard let wcPlugin = wcPlugin, wcPlugin.active else {
@@ -119,19 +119,11 @@ private extension POSEligibilityChecker {
119119
return false
120120
}
121121
}
122-
123-
private var wcPluginMinimumVersion: String {
124-
guard featureFlagService.isFeatureFlagEnabled(.variableProductsInPointOfSale) else {
125-
return Constants.legacyWcPluginMinimumVersion
126-
}
127-
return Constants.wcPluginMinimumVersion
128-
}
129122
}
130123

131124
private extension POSEligibilityChecker {
132125
enum Constants {
133126
static let wcPluginName = "WooCommerce"
134127
static let wcPluginMinimumVersion = "9.6.0-beta"
135-
static let legacyWcPluginMinimumVersion = "6.6.0"
136128
}
137129
}

WooCommerce/Classes/ViewRelated/Hub Menu/HubMenuViewModel.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ final class HubMenuViewModel: ObservableObject {
9999

100100
return PointOfSaleItemService(siteID: siteID,
101101
currencySettings: currencySettings,
102-
credentials: credentials,
103-
isVariableProductsFeatureEnabled: featureFlagService.isFeatureFlagEnabled(.variableProductsInPointOfSale))
102+
credentials: credentials)
104103
}()
105104

106105
private(set) lazy var inboxViewModel = InboxViewModel(siteID: siteID)

WooCommerce/WooCommerceTests/Mocks/MockFeatureFlagService.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ final class MockFeatureFlagService: FeatureFlagService {
2424
var isProductGlobalUniqueIdentifierSupported: Bool
2525
var receiptsForPOS: Bool
2626
var hideSitesInStorePicker: Bool
27-
var isVariableProductsInPOSEnabled: Bool
2827

2928
init(isInboxOn: Bool = false,
3029
isShowInboxCTAEnabled: Bool = false,
@@ -47,8 +46,7 @@ final class MockFeatureFlagService: FeatureFlagService {
4746
favoriteProducts: Bool = false,
4847
isProductGlobalUniqueIdentifierSupported: Bool = false,
4948
receiptsForPOS: Bool = false,
50-
hideSitesInStorePicker: Bool = false,
51-
isVariableProductsInPOSEnabled: Bool = false) {
49+
hideSitesInStorePicker: Bool = false) {
5250
self.isInboxOn = isInboxOn
5351
self.isShowInboxCTAEnabled = isShowInboxCTAEnabled
5452
self.isUpdateOrderOptimisticallyOn = isUpdateOrderOptimisticallyOn
@@ -71,7 +69,6 @@ final class MockFeatureFlagService: FeatureFlagService {
7169
self.isProductGlobalUniqueIdentifierSupported = isProductGlobalUniqueIdentifierSupported
7270
self.receiptsForPOS = receiptsForPOS
7371
self.hideSitesInStorePicker = hideSitesInStorePicker
74-
self.isVariableProductsInPOSEnabled = isVariableProductsInPOSEnabled
7572
}
7673

7774
func isFeatureFlagEnabled(_ featureFlag: FeatureFlag) -> Bool {
@@ -120,8 +117,6 @@ final class MockFeatureFlagService: FeatureFlagService {
120117
return receiptsForPOS
121118
case .hideSitesInStorePicker:
122119
return hideSitesInStorePicker
123-
case .variableProductsInPointOfSale:
124-
return isVariableProductsInPOSEnabled
125120
default:
126121
return false
127122
}

WooCommerce/WooCommerceTests/ViewRelated/Settings/POS/POSEligibilityCheckerTests.swift

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ final class POSEligibilityCheckerTests: XCTestCase {
146146

147147
func test_is_eligible_when_WooCommerce_version_is_below_9_6_then_returns_false() throws {
148148
// Given
149-
let featureFlagService = MockFeatureFlagService(isPointOfSaleEnabled: true,
150-
isVariableProductsInPOSEnabled: true)
149+
let featureFlagService = MockFeatureFlagService(isPointOfSaleEnabled: true)
151150
setupCountry(country: .us)
152151

153152
// Unsupported WooCommerce version
@@ -167,8 +166,7 @@ final class POSEligibilityCheckerTests: XCTestCase {
167166

168167
func test_is_eligible_when_WooCommerce_version_is_at_least_9_6_then_returns_true() throws {
169168
// Given
170-
let featureFlagService = MockFeatureFlagService(isPointOfSaleEnabled: true,
171-
isVariableProductsInPOSEnabled: true)
169+
let featureFlagService = MockFeatureFlagService(isPointOfSaleEnabled: true)
172170
setupCountry(country: .us)
173171
accountWhitelistedInBackend(true)
174172

@@ -186,49 +184,6 @@ final class POSEligibilityCheckerTests: XCTestCase {
186184
// Then
187185
XCTAssertTrue(isEligible)
188186
}
189-
190-
func test_is_eligible_when_WooCommerce_version_is_below_6_6_and_variable_products_disabled_then_returns_false() throws {
191-
// Given
192-
let featureFlagService = MockFeatureFlagService(isPointOfSaleEnabled: true,
193-
isVariableProductsInPOSEnabled: false)
194-
setupCountry(country: .us)
195-
196-
// Unsupported WooCommerce version
197-
setupWooCommerceVersion("6.5.2")
198-
199-
// When
200-
let checker = POSEligibilityChecker(userInterfaceIdiom: .pad,
201-
siteSettings: siteSettings,
202-
currencySettings: Fixtures.usdCurrencySettings,
203-
stores: stores,
204-
featureFlagService: featureFlagService)
205-
checker.isEligible.assign(to: &$isEligible)
206-
207-
// Then
208-
XCTAssertFalse(isEligible)
209-
}
210-
211-
func test_is_eligible_when_WooCommerce_version_is_at_least_6_6_and_variable_products_disabled_then_returns_true() throws {
212-
// Given
213-
let featureFlagService = MockFeatureFlagService(isPointOfSaleEnabled: true,
214-
isVariableProductsInPOSEnabled: false)
215-
setupCountry(country: .us)
216-
accountWhitelistedInBackend(true)
217-
218-
// Supported WooCommerce version
219-
setupWooCommerceVersion("6.6.0")
220-
221-
// When
222-
let checker = POSEligibilityChecker(userInterfaceIdiom: .pad,
223-
siteSettings: siteSettings,
224-
currencySettings: Fixtures.usdCurrencySettings,
225-
stores: stores,
226-
featureFlagService: featureFlagService)
227-
checker.isEligible.assign(to: &$isEligible)
228-
229-
// Then
230-
XCTAssertTrue(isEligible)
231-
}
232187
}
233188

234189
private extension POSEligibilityCheckerTests {

Yosemite/Yosemite/PointOfSale/PointOfSaleItemService.swift

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,20 @@ public final class PointOfSaleItemService: PointOfSaleItemServiceProtocol {
2121
private let currencyFormatter: CurrencyFormatter
2222
private let productsRemote: ProductsRemote
2323
private let variationRemote: ProductVariationsRemoteProtocol
24-
private let isVariableProductsFeatureEnabled: Bool
2524

26-
public init(siteID: Int64, currencySettings: CurrencySettings, network: Network, isVariableProductsFeatureEnabled: Bool) {
25+
public init(siteID: Int64, currencySettings: CurrencySettings, network: Network) {
2726
self.siteID = siteID
2827
self.currencyFormatter = CurrencyFormatter(currencySettings: currencySettings)
2928
self.productsRemote = ProductsRemote(network: network)
3029
self.variationRemote = ProductVariationsRemote(network: network)
31-
self.isVariableProductsFeatureEnabled = isVariableProductsFeatureEnabled
3230
}
3331

3432
public convenience init(siteID: Int64,
3533
currencySettings: CurrencySettings,
36-
credentials: Credentials?,
37-
isVariableProductsFeatureEnabled: Bool) {
34+
credentials: Credentials?) {
3835
self.init(siteID: siteID,
3936
currencySettings: currencySettings,
40-
network: AlamofireNetwork(credentials: credentials),
41-
isVariableProductsFeatureEnabled: isVariableProductsFeatureEnabled)
37+
network: AlamofireNetwork(credentials: credentials))
4238
}
4339

4440
/// Provides a list of products for the Point of Sale, by fetching simple products from the remote, applying any eligibility criteria,
@@ -47,8 +43,7 @@ public final class PointOfSaleItemService: PointOfSaleItemServiceProtocol {
4743
/// - pageNumber: Number of the page that should be retrieved. If none given, defaults to 1
4844
///
4945
public func providePointOfSaleItems(pageNumber: Int = 1) async throws -> PagedItems<POSItem> {
50-
let productTypes: [ProductType] = isVariableProductsFeatureEnabled ?
51-
[.simple, .variable] : [.simple]
46+
let productTypes: [ProductType] = [.simple, .variable]
5247
do {
5348
let pagedProducts = try await productsRemote.loadProductsForPointOfSale(for: siteID, productTypes: productTypes, pageNumber: pageNumber)
5449
let products = pagedProducts.items

Yosemite/YosemiteTests/PointOfSale/PointOfSaleItemServiceTests.swift

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ final class PointOfSaleItemServiceTests: XCTestCase {
1515
currencySettings = CurrencySettings()
1616
itemProvider = PointOfSaleItemService(siteID: siteID,
1717
currencySettings: currencySettings,
18-
network: network,
19-
isVariableProductsFeatureEnabled: false)
18+
network: network)
2019
}
2120

2221
override func tearDown() {
@@ -110,26 +109,11 @@ final class PointOfSaleItemServiceTests: XCTestCase {
110109

111110
// MARK: - Query Parameters
112111

113-
func test_providePointOfSaleItems_sets_types_parameters_to_simple_only() async throws {
112+
func test_providePointOfSaleItems_sets_types_parameters_correctly() async throws {
114113
// Given
115114
let itemProvider = PointOfSaleItemService(siteID: siteID,
116115
currencySettings: currencySettings,
117-
network: network,
118-
isVariableProductsFeatureEnabled: false)
119-
120-
// When
121-
_ = try? await itemProvider.providePointOfSaleItems()
122-
123-
// Then
124-
XCTAssertEqual(network.queryParametersDictionary?["include_types"] as? String, "simple")
125-
}
126-
127-
func test_providePointOfSaleItems_sets_types_parameters_correctly_when_variable_products_feature_is_enabled() async throws {
128-
// Given
129-
let itemProvider = PointOfSaleItemService(siteID: siteID,
130-
currencySettings: currencySettings,
131-
network: network,
132-
isVariableProductsFeatureEnabled: true)
116+
network: network)
133117

134118
// When
135119
_ = try? await itemProvider.providePointOfSaleItems()
@@ -142,8 +126,7 @@ final class PointOfSaleItemServiceTests: XCTestCase {
142126
// Given
143127
let itemProvider = PointOfSaleItemService(siteID: siteID,
144128
currencySettings: currencySettings,
145-
network: network,
146-
isVariableProductsFeatureEnabled: true)
129+
network: network)
147130
let parentProductID: Int64 = 123
148131

149132
// When
@@ -185,8 +168,7 @@ final class PointOfSaleItemServiceTests: XCTestCase {
185168
// Given
186169
let itemProvider = PointOfSaleItemService(siteID: siteID,
187170
currencySettings: currencySettings,
188-
network: network,
189-
isVariableProductsFeatureEnabled: true)
171+
network: network)
190172
let parentProductID: Int64 = 123
191173

192174
// When
@@ -221,8 +203,7 @@ final class PointOfSaleItemServiceTests: XCTestCase {
221203
// Given
222204
let itemProvider = PointOfSaleItemService(siteID: siteID,
223205
currencySettings: currencySettings,
224-
network: network,
225-
isVariableProductsFeatureEnabled: true)
206+
network: network)
226207
let parentProductID: Int64 = 123
227208
let expectedError = PointOfSaleItemServiceError.requestFailed
228209

@@ -251,8 +232,7 @@ final class PointOfSaleItemServiceTests: XCTestCase {
251232
// Given
252233
let itemProvider = PointOfSaleItemService(siteID: siteID,
253234
currencySettings: currencySettings,
254-
network: network,
255-
isVariableProductsFeatureEnabled: true)
235+
network: network)
256236
let parentProductID: Int64 = 123
257237

258238
// When

0 commit comments

Comments
 (0)