@@ -179,31 +179,28 @@ public static Optimizely newDefaultInstance(String sdkKey) {
179
179
* @param fallback Fallback datafile string used by the ProjectConfigManager to be immediately available.
180
180
*/
181
181
public static Optimizely newDefaultInstance (String sdkKey , String fallback ) {
182
- NotificationCenter notificationCenter = new NotificationCenter ();
183
-
184
- HttpProjectConfigManager .Builder builder = HttpProjectConfigManager .builder ()
185
- .withDatafile (fallback )
186
- .withNotificationCenter (notificationCenter )
187
- .withSdkKey (sdkKey );
188
-
189
- return newDefaultInstance (builder .build (), notificationCenter );
182
+ String datafileAuthToken = PropertyUtils .get (HttpProjectConfigManager .CONFIG_DATAFILE_AUTH_TOKEN );
183
+ return newDefaultInstance (sdkKey , fallback , datafileAuthToken );
190
184
}
191
185
192
186
/**
193
187
* Returns a new Optimizely instance with authenticated datafile support.
194
188
*
195
189
* @param sdkKey SDK key used to build the ProjectConfigManager.
196
- * @param datafileAuthToken Token for authenticated datafile access.
197
190
* @param fallback Fallback datafile string used by the ProjectConfigManager to be immediately available.
191
+ * @param datafileAuthToken Token for authenticated datafile access.
198
192
*/
199
- public static Optimizely newDefaultInstance (String sdkKey , String datafileAuthToken , String fallback ) {
193
+ public static Optimizely newDefaultInstance (String sdkKey , String fallback , String datafileAuthToken ) {
200
194
NotificationCenter notificationCenter = new NotificationCenter ();
201
195
202
196
HttpProjectConfigManager .Builder builder = HttpProjectConfigManager .builder ()
203
197
.withDatafile (fallback )
204
198
.withNotificationCenter (notificationCenter )
205
- .withSdkKey (sdkKey )
206
- .withDatafileAuthToken (datafileAuthToken );
199
+ .withSdkKey (sdkKey );
200
+
201
+ if (datafileAuthToken != null ) {
202
+ builder .withDatafileAuthToken (datafileAuthToken );
203
+ }
207
204
208
205
return newDefaultInstance (builder .build (), notificationCenter );
209
206
}
0 commit comments