Skip to content

Commit c144a6b

Browse files
committed
Remove unnecessary iOS 17 checks now that the app is iOS 17+ and unused POSIneligibleReason cases.
1 parent d876003 commit c144a6b

File tree

9 files changed

+6
-63
lines changed

9 files changed

+6
-63
lines changed

WooCommerce/Classes/POS/Analytics/WooAnalyticsEvent+PointOfSaleIneligibleUI.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ private extension POSIneligibleReason {
2626
return "feature_switch_disabled"
2727
case .wooCommercePluginNotFound:
2828
return "unknown_wc_plugin"
29-
case .unsupportedIOSVersion:
30-
return "ios_version"
31-
case .unsupportedInCIABSites:
32-
return "feature_unsupported_in_ciab"
3329
case .siteSettingsNotAvailable,
3430
.selfDeallocated:
3531
return "other"

WooCommerce/Classes/POS/Models/POSIneligibleReason.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@ import enum WooFoundation.CurrencyCode
44

55
/// Represents the reasons why a site may be ineligible for POS.
66
enum POSIneligibleReason: Equatable {
7-
case unsupportedIOSVersion
87
case unsupportedWooCommerceVersion(minimumVersion: String)
98
case siteSettingsNotAvailable
109
case wooCommercePluginNotFound
1110
case featureSwitchDisabled
1211
case unsupportedCurrency(countryCode: CountryCode, supportedCurrencies: [CurrencyCode])
1312
case selfDeallocated
14-
case unsupportedInCIABSites
1513
}
1614

1715
/// Represents the eligibility state for POS.

WooCommerce/Classes/POS/TabBar/POSIneligibleView.swift

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,6 @@ struct POSIneligibleView: View {
112112

113113
private var suggestionText: String {
114114
switch reason {
115-
case .unsupportedIOSVersion:
116-
return NSLocalizedString("pos.ineligible.suggestion.unsupportedIOSVersion.1",
117-
value: "The POS system requires iOS 17 or later. Please update your device to iOS 17+ to use this feature.",
118-
comment: "Suggestion for unsupported iOS version: update iOS")
119115
case let .unsupportedWooCommerceVersion(minimumVersion):
120116
let format = NSLocalizedString("pos.ineligible.suggestion.unsupportedWooCommerceVersion",
121117
value: "Your WooCommerce version is not supported. " +
@@ -155,12 +151,6 @@ struct POSIneligibleView: View {
155151
return NSLocalizedString("pos.ineligible.suggestion.selfDeallocated",
156152
value: "Try relaunching the app to resolve this issue.",
157153
comment: "Suggestion for self deallocated: relaunch")
158-
case .unsupportedInCIABSites:
159-
return NSLocalizedString(
160-
"pos.ineligible.suggestion.notSupportedForCIAB",
161-
value: "The POS system is not supported for your store.",
162-
comment: "Suggestion for CIAB sites: feature is not supported"
163-
)
164154
}
165155
}
166156
}
@@ -184,9 +174,6 @@ private extension POSIneligibleView {
184174
private extension POSIneligibleReason {
185175
var shouldShowRetryButton: Bool {
186176
switch self {
187-
case .unsupportedIOSVersion,
188-
.unsupportedInCIABSites:
189-
return false
190177
case .unsupportedWooCommerceVersion,
191178
.siteSettingsNotAvailable,
192179
.wooCommercePluginNotFound,
@@ -205,8 +192,7 @@ private extension POSIneligibleReason {
205192
value: "Enable POS feature",
206193
comment: "Button title to enable the POS feature switch and refresh POS eligibility check"
207194
)
208-
case .unsupportedIOSVersion,
209-
.unsupportedWooCommerceVersion,
195+
case .unsupportedWooCommerceVersion,
210196
.siteSettingsNotAvailable,
211197
.wooCommercePluginNotFound,
212198
.unsupportedCurrency,
@@ -216,9 +202,6 @@ private extension POSIneligibleReason {
216202
value: "Retry",
217203
comment: "Button title to refresh POS eligibility check"
218204
)
219-
case .unsupportedInCIABSites:
220-
assertionFailure("Retry button should not be shown for `unsupportedInCIABSites`")
221-
return String()
222205
}
223206
}
224207
}
@@ -234,15 +217,6 @@ private extension POSIneligibleReason {
234217
}
235218
}
236219

237-
#Preview("Unsupported iOS version") {
238-
if #available(iOS 17.0, *) {
239-
POSIneligibleView(
240-
reason: .unsupportedIOSVersion,
241-
onRefresh: {}
242-
)
243-
}
244-
}
245-
246220
#Preview("WooCommerce plugin not found") {
247221
if #available(iOS 17.0, *) {
248222
POSIneligibleView(

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ final class POSTabEligibilityChecker: POSEntryPointEligibilityCheckerProtocol {
5454

5555
/// Determines whether the POS entry point can be shown based on the selected store and feature gates.
5656
func checkEligibility() async -> POSEligibilityState {
57-
guard #available(iOS 17.0, *) else {
58-
return .ineligible(reason: .unsupportedIOSVersion)
59-
}
60-
6157
async let siteSettingsEligibility = checkSiteSettingsEligibility()
6258
async let pluginEligibility = checkPluginEligibility()
6359

@@ -78,11 +74,6 @@ final class POSTabEligibilityChecker: POSEntryPointEligibilityCheckerProtocol {
7874

7975
func refreshEligibility(ineligibleReason: POSIneligibleReason) async throws -> POSEligibilityState {
8076
switch ineligibleReason {
81-
case .unsupportedIOSVersion:
82-
// TODO: WOOMOB-768 - hide refresh CTA in this case
83-
return .ineligible(reason: .unsupportedIOSVersion)
84-
case .unsupportedInCIABSites:
85-
return .ineligible(reason: .unsupportedInCIABSites)
8677
case .siteSettingsNotAvailable, .unsupportedCurrency:
8778
do {
8879
try await syncSiteSettingsRemotely()

WooCommerce/WooCommerceTests/POS/Controllers/POSEntryPointControllerTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ struct POSEntryPointControllerTests {
55
@Test func eligibilityState_is_set_to_ineligible_when_checker_returns_ineligible() async throws {
66
// Given
77
let mockEligibilityChecker = MockPOSEligibilityChecker()
8-
let expectedState = POSEligibilityState.ineligible(reason: .unsupportedIOSVersion)
8+
let expectedState = POSEligibilityState.ineligible(reason: .featureSwitchDisabled)
99
mockEligibilityChecker.eligibility = expectedState
1010

1111
// When

WooCommerce/WooCommerceTests/POS/Models/PointOfSaleAggregateModelTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,6 @@ private func makeLoadedOrderState(cartTotal: String = "",
966966
)
967967
}
968968

969-
@available(iOS 17.0, *)
970969
private func makePointOfSaleAggregateModel(
971970
entryPointController: POSEntryPointController = POSEntryPointController(eligibilityChecker: MockPOSEligibilityChecker()),
972971
itemsController: PointOfSaleItemsControllerProtocol = MockPointOfSaleItemsController(),

WooCommerce/WooCommerceTests/POS/Presentation/POSItemActionHandlerTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ private func makeProductItem() -> POSItem {
9797
stockStatusKey: ""))
9898
}
9999

100-
@available(iOS 17.0, *)
101100
private func makePointOfSaleAggregateModel(
102101
entryPointController: POSEntryPointController = POSEntryPointController(eligibilityChecker: MockPOSEligibilityChecker()),
103102
itemsController: PointOfSaleItemsControllerProtocol = MockPointOfSaleItemsController(),

WooCommerce/WooCommerceTests/POS/ViewHelpers/PointOfSaleDashboardViewHelperTests.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ struct PointOfSaleDashboardViewHelperTests {
6161
}
6262

6363
@Test(arguments: [
64-
POSIneligibleReason.unsupportedIOSVersion,
6564
POSIneligibleReason.unsupportedWooCommerceVersion(minimumVersion: "9.6.0"),
6665
POSIneligibleReason.unsupportedCurrency(countryCode: .US, supportedCurrencies: [.USD, .GBP]),
6766
POSIneligibleReason.siteSettingsNotAvailable,
@@ -156,7 +155,7 @@ struct PointOfSaleDashboardViewHelperTests {
156155

157156
@Test func determineViewState_horizontalSizeClass_takes_priority_over_eligibility_state() async throws {
158157
// Given - compact size class should return unsupportedWidth regardless of eligibility
159-
let eligibilityState: POSEligibilityState = .ineligible(reason: .unsupportedIOSVersion)
158+
let eligibilityState: POSEligibilityState = .ineligible(reason: .featureSwitchDisabled)
160159
let itemsContainerState: ItemsContainerState = .content
161160
let horizontalSizeClass: UserInterfaceSizeClass = .compact
162161

@@ -190,7 +189,7 @@ struct PointOfSaleDashboardViewHelperTests {
190189

191190
@Test func determineViewState_ineligible_state_takes_priority_over_containerState() async throws {
192191
// Given - ineligible state should return ineligible regardless of container state
193-
let eligibilityState: POSEligibilityState = .ineligible(reason: .unsupportedIOSVersion)
192+
let eligibilityState: POSEligibilityState = .ineligible(reason: .featureSwitchDisabled)
194193
let itemsContainerState: ItemsContainerState = .content
195194
let horizontalSizeClass: UserInterfaceSizeClass = .regular
196195

@@ -202,7 +201,7 @@ struct PointOfSaleDashboardViewHelperTests {
202201
)
203202

204203
// Then
205-
#expect(result == .ineligible(reason: .unsupportedIOSVersion))
204+
#expect(result == .ineligible(reason: .featureSwitchDisabled))
206205
}
207206

208207
// MARK: - Floating Control Tests
@@ -219,7 +218,7 @@ struct PointOfSaleDashboardViewHelperTests {
219218

220219
@Test(arguments: [
221220
(PointOfSaleDashboardView.ViewState.loading, false),
222-
(PointOfSaleDashboardView.ViewState.ineligible(reason: .unsupportedIOSVersion), false)
221+
(PointOfSaleDashboardView.ViewState.ineligible(reason: .featureSwitchDisabled), false)
223222
])
224223
func showsFloatingControl_when_loading_or_ineligible_returns_false(viewState: PointOfSaleDashboardView.ViewState, expected: Bool) async throws {
225224
// When & Then

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -220,19 +220,6 @@ struct POSTabEligibilityCheckerTests {
220220

221221
// MARK: - `refreshEligibility` Tests
222222

223-
@Test func refreshEligibility_returns_ineligible_for_unsupportedIOSVersion() async throws {
224-
// Given
225-
let checker = POSTabEligibilityChecker(siteID: siteID,
226-
siteSettings: siteSettings,
227-
stores: stores)
228-
229-
// When
230-
let result = try await checker.refreshEligibility(ineligibleReason: .unsupportedIOSVersion)
231-
232-
// Then
233-
#expect(result == .ineligible(reason: .unsupportedIOSVersion))
234-
}
235-
236223
@Test(arguments: [
237224
POSIneligibleReason.siteSettingsNotAvailable,
238225
POSIneligibleReason.unsupportedCurrency(countryCode: .US, supportedCurrencies: [.USD])

0 commit comments

Comments
 (0)