@@ -179,31 +179,28 @@ public static Optimizely newDefaultInstance(String sdkKey) {
179179 * @param fallback Fallback datafile string used by the ProjectConfigManager to be immediately available.
180180 */
181181 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 );
190184 }
191185
192186 /**
193187 * Returns a new Optimizely instance with authenticated datafile support.
194188 *
195189 * @param sdkKey SDK key used to build the ProjectConfigManager.
196- * @param datafileAuthToken Token for authenticated datafile access.
197190 * @param fallback Fallback datafile string used by the ProjectConfigManager to be immediately available.
191+ * @param datafileAuthToken Token for authenticated datafile access.
198192 */
199- public static Optimizely newDefaultInstance (String sdkKey , String datafileAuthToken , String fallback ) {
193+ public static Optimizely newDefaultInstance (String sdkKey , String fallback , String datafileAuthToken ) {
200194 NotificationCenter notificationCenter = new NotificationCenter ();
201195
202196 HttpProjectConfigManager .Builder builder = HttpProjectConfigManager .builder ()
203197 .withDatafile (fallback )
204198 .withNotificationCenter (notificationCenter )
205- .withSdkKey (sdkKey )
206- .withDatafileAuthToken (datafileAuthToken );
199+ .withSdkKey (sdkKey );
200+
201+ if (datafileAuthToken != null ) {
202+ builder .withDatafileAuthToken (datafileAuthToken );
203+ }
207204
208205 return newDefaultInstance (builder .build (), notificationCenter );
209206 }
0 commit comments