@@ -24,8 +24,7 @@ class ProjectConfig {
24
24
// local runtime forcedVariations [UserId: [ExperimentId: VariationId]]
25
25
// NOTE: experiment.forcedVariations use [ExperimentKey: VariationKey] instead of ids
26
26
27
- private var whitelistUsers = [ String: [ String: String] ] ( )
28
- private var experimentFeatureMap = [ String: [ String] ] ( )
27
+ var whitelistUsers = [ String: [ String: String] ] ( )
29
28
30
29
init ( datafile: Data ) throws {
31
30
do {
@@ -36,7 +35,6 @@ class ProjectConfig {
36
35
if !isValidVersion( version: self . project. version) {
37
36
throw OptimizelyError . dataFileVersionInvalid ( self . project. version)
38
37
}
39
- generateExperimentFeatureMap ( )
40
38
}
41
39
42
40
convenience init ( datafile: String ) throws {
@@ -90,20 +88,6 @@ extension ProjectConfig {
90
88
// old versions (< 4) of datafiles not supported
91
89
return [ " 4 " ] . contains ( version)
92
90
}
93
-
94
- private func generateExperimentFeatureMap( ) {
95
- for feature in project. featureFlags {
96
- for id in feature. experimentIds {
97
- if var featureIdArray = experimentFeatureMap [ id] {
98
- featureIdArray. append ( feature. id)
99
- experimentFeatureMap [ id] = featureIdArray
100
- }
101
- else {
102
- experimentFeatureMap [ id] = [ feature. id]
103
- }
104
- }
105
- }
106
- }
107
91
}
108
92
109
93
// MARK: - Project Access
@@ -192,7 +176,12 @@ extension ProjectConfig {
192
176
* Returns true if experiment belongs to any feature, false otherwise.
193
177
*/
194
178
func isFeatureExperiment( id: String ) -> Bool {
195
- return experimentFeatureMap. keys. contains ( id)
179
+ if let _ = project. featureFlags. map ( { $0. experimentIds. contains ( id) } ) . first {
180
+ return true
181
+ }
182
+ else {
183
+ return false
184
+ }
196
185
}
197
186
198
187
/**
0 commit comments