Skip to content

Commit 588a61d

Browse files
committed
Bug fixes.
1 parent a620d01 commit 588a61d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

OptimizelySDK/Optimizely/OptimizelyManager.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,16 +296,18 @@ open class OptimizelyManager: NSObject {
296296
var args: Array<Any?> = (self.notificationCenter as! DefaultNotificationCenter).getArgumentsForDecisionListener(notificationType: decisionType, userId: userId, attributes: attributes)
297297

298298
var decisionInfo = [String:Any]()
299+
var sourceInfo = [String:Any]()
300+
sourceInfo[Constants.ExperimentDecisionInfoKeys.experiment] = experiment.key
301+
sourceInfo[Constants.ExperimentDecisionInfoKeys.variation] = NSNull()
299302

300303
// fix DecisionService to throw error
301304
guard let variation = decisionService.getVariation(config: config, userId: userId, experiment: experiment, attributes: attributes ?? OptimizelyAttributes()) else {
305+
decisionInfo = sourceInfo
302306
args.append(decisionInfo)
303307
self.notificationCenter.sendNotifications(type: NotificationType.Decision.rawValue, args: args)
304308
throw OptimizelyError.variationUnknown
305309
}
306310

307-
var sourceInfo = [String:Any]()
308-
sourceInfo[Constants.ExperimentDecisionInfoKeys.experiment] = experiment.key
309311
sourceInfo[Constants.ExperimentDecisionInfoKeys.variation] = variation.key
310312
decisionInfo = sourceInfo
311313

0 commit comments

Comments
 (0)