Skip to content

Commit 1c7879c

Browse files
committed
Move locale based POS tab visibility from FeatureFlagAction.isRemoteFeatureFlagEnabled to SettingAction.isFeatureEnabled because the remote feature flag still falls back to local feature flag which results in all locales seeing the POS tab.
1 parent ea83273 commit 1c7879c

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

Modules/Sources/Yosemite/Model/Mocks/ActionHandlers/MockSettingActionHandler.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@ struct MockSettingActionHandler: MockActionHandler {
2828
case .isFeatureEnabled(_, let feature, let onCompletion):
2929
switch feature {
3030
case .pointOfSale:
31-
// One of the requirements for the POS tab to show up.
32-
onCompletion(.success(true))
31+
// Only enables POS feature for eligible locales (US and UK variants).
32+
let locale = Locale.current
33+
let localeIdentifier = locale.identifier
34+
let isEligibleCountry = localeIdentifier.hasPrefix("en_US") ||
35+
localeIdentifier.hasPrefix("en_GB") ||
36+
localeIdentifier == "en-US" ||
37+
localeIdentifier == "en-GB"
38+
onCompletion(.success(isEligibleCountry))
3339
}
3440
default: unimplementedAction(action: action)
3541
}

Modules/Sources/Yosemite/Model/Mocks/MockStoresManager.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,7 @@ public class MockStoresManager: StoresManager {
166166
case let action as FeatureFlagAction:
167167
switch action {
168168
case let .isRemoteFeatureFlagEnabled(_, _, completion):
169-
// Only enables POS feature for eligible countries from locale.
170-
let locale = Locale.current
171-
let countryCode = locale.region?.identifier ?? ""
172-
let isEligibleCountry = countryCode == "US" || countryCode == "GB"
173-
completion(isEligibleCountry)
169+
completion(true)
174170
}
175171
default:
176172
fatalError("Unable to handle action: \(action.identifier) \(String(describing: action))")

0 commit comments

Comments
 (0)