Skip to content

Commit 99cf50d

Browse files
committed
Update CIABEligibilityChecker logic to account new garden fields of a Site
1 parent 39c7c34 commit 99cf50d

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

WooCommerce/Classes/CIAB/CIABEligibilityChecker.swift

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@ extension CIABEligibilityChecker: CIABEligibilityCheckerProtocol {
2020
}
2121

2222
func isSiteCIAB(_ site: Site) -> Bool {
23-
/// Temp logic
24-
/// If site name contains either `garden` or `ciab` then it's considered a CIAB site
25-
return isCIABSupportedForBuildEnvironment && CIABUnlockingSiteNameSubstrings.allCases.contains {
26-
site.name.lowercased().contains($0.rawValue)
27-
}
23+
return site.isCIAB
2824
}
2925

3026
func isFeatureSupportedForCurrentSite(_ feature: CIABAffectedFeature) -> Bool {
@@ -39,22 +35,15 @@ extension CIABEligibilityChecker: CIABEligibilityCheckerProtocol {
3935
}
4036
}
4137

42-
// MARK: - Temporary constants for CIAB identifying logic
38+
// MARK: - Site checks
4339

44-
fileprivate extension CIABEligibilityChecker {
45-
enum CIABUnlockingSiteNameSubstrings: String, CaseIterable {
46-
case garden
47-
case ciab
40+
private extension Site {
41+
var isCIAB: Bool {
42+
return isGarden && gardenName == GardenName.commerce.rawValue
4843
}
4944
}
5045

51-
// MARK: - Temporary environment checks
52-
53-
import enum WooFoundationCore.BuildConfiguration
54-
55-
private extension CIABEligibilityChecker {
56-
var isCIABSupportedForBuildEnvironment: Bool {
57-
let buildConfig = BuildConfiguration.current
58-
return buildConfig == .localDeveloper || buildConfig == .alpha
59-
}
46+
private enum GardenName: String {
47+
/// Garden name for CIAB sites
48+
case commerce
6049
}

0 commit comments

Comments
 (0)