Skip to content

Commit 4f270c8

Browse files
committed
Recommended changes made.
1 parent 3b43924 commit 4f270c8

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

OptimizelySDK/Implementation/DefaultNotificationCenter.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,5 +157,12 @@ public class DefaultNotificationCenter : OPTNotificationCenter {
157157
}
158158
}
159159

160-
160+
public func getArgumentsForDecisionListener(notificationType: String, userId: String, attributes: OptimizelyAttributes?) -> Array<Any?> {
161+
var args = Array<Any?>()
162+
args.append(notificationType)
163+
args.append(userId)
164+
args.append(attributes ?? OptimizelyAttributes())
165+
return args
166+
}
167+
161168
}

OptimizelySDK/Optimizely/OptimizelyManager.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,9 @@ open class OptimizelyManager: NSObject {
323323
guard let experiment = config.getExperiment(key: experimentKey) else {
324324
throw OptimizelyError.experimentUnknown
325325
}
326-
327-
var args = Array<Any?>()
328-
args.append(Constants.DecisionTypeKeys.experiment)
329-
args.append(userId)
330-
args.append(attributes ?? OptimizelyAttributes())
326+
327+
var args: Array<Any?> = (self.notificationCenter as! DefaultNotificationCenter).getArgumentsForDecisionListener(notificationType: Constants.DecisionTypeKeys.experiment, userId: userId, attributes: attributes)
328+
331329
var decisionInfo = Dictionary<String,Any>()
332330
decisionInfo[Constants.NotificationKeys.experiment] = nil
333331
decisionInfo[Constants.NotificationKeys.variation] = nil

0 commit comments

Comments
 (0)