8000 [FSSDK-9001] Fix: ODP should be enabled by default when initialized o… · optimizely/csharp-sdk@c5592e7 · GitHub
[go: up one dir, main page]

Skip to content

Commit c5592e7

Browse files
authored
[FSSDK-9001] Fix: ODP should be enabled by default when initialized optimizely using OptimizelyFactory (#337)
* using default odp manager when initializing optimizely using optimizelyFactory to enable it by default * Added use odp check
1 parent e620c08 commit c5592e7

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

OptimizelySDK/OptimizelyFactory.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2021, Optimizely
2+
* Copyright 2019-2021, 2023, Optimizely
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use file except in compliance with the License.
@@ -14,6 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17+
#if !(NET35 || NET40 || NETSTANDARD1_6)
18+
#define USE_ODP
19+
#endif
20+
1721
using System;
1822
#if !NETSTANDARD1_6 && !NET35
1923
using System.Configuration;
@@ -27,6 +31,11 @@
2731
using OptimizelySDK.Logger;
2832
using OptimizelySDK.Notifications;
2933

34+
#if USE_ODP
35+
using OptimizelySDK.Odp;
36+
#endif
37+
38+
3039
namespace OptimizelySDK
3140
{
3241
/// <summary>
@@ -215,8 +224,18 @@ public static Optimizely NewDefaultInstance(ProjectConfigManager configManager,
215224
UserProfileService userprofileService = null, EventProcessor eventProcessor = null
216225
)
217226
{
227+
#if USE_ODP
228+
var odpManager = new OdpManager.Builder()
229+
.WithErrorHandler(errorHandler)
230+
.WithLogger(logger)
231+
.Build();
232+
return new Optimizely(configManager, notificationCenter, eventDispatcher, logger,
233+
errorHandler, userprofileService, eventProcessor, null, odpManager);
234+
#else
218235
return new Optimizely(configManager, notificationCenter, eventDispatcher, logger,
219236
errorHandler, userprofileService, eventProcessor);
237+
#endif
238+
220239
}
221240
}
222241
}

0 commit comments

Comments
 (0)
0