|
1 | | -/* |
2 | | - * Copyright 2017, Optimizely |
| 1 | +/** |
| 2 | + * |
| 3 | + * Copyright 2016, Optimizely and contributors |
3 | 4 | * |
4 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 6 | * you may not use this file except in compliance with the License. |
|
32 | 33 | import com.optimizely.ab.error.RaiseExceptionErrorHandler; |
33 | 34 | import com.optimizely.ab.event.EventHandler; |
34 | 35 | import com.optimizely.ab.event.LogEvent; |
| 36 | +import com.optimizely.ab.event.internal.BuildVersionInfo; |
35 | 37 | import com.optimizely.ab.event.internal.EventBuilder; |
36 | 38 | import com.optimizely.ab.event.internal.EventBuilderV1; |
37 | 39 | import com.optimizely.ab.event.internal.EventBuilderV2; |
@@ -256,6 +258,9 @@ private void track(@Nonnull String eventName, |
256 | 258 | } catch (Exception e) { |
257 | 259 | logger.error("Unexpected exception in event dispatcher", e); |
258 | 260 | } |
| 261 | + |
| 262 | + notificationBroadcaster.broadcastEventTracked(eventName, userId, attributes, eventValue, |
| 263 | + conversionEvent); |
259 | 264 | } |
260 | 265 |
|
261 | 266 | //======== live variable getters ========// |
@@ -350,24 +355,24 @@ private void track(@Nonnull String eventName, |
350 | 355 | return null; |
351 | 356 | } |
352 | 357 |
|
353 | | - public @Nullable Float getVariableFloat(@Nonnull String variableKey, |
354 | | - @Nonnull String userId, |
355 | | - boolean activateExperiment) throws UnknownLiveVariableException { |
356 | | - return getVariableFloat(variableKey, userId, Collections.<String, String>emptyMap(), activateExperiment); |
| 358 | + public @Nullable Double getVariableDouble(@Nonnull String variableKey, |
| 359 | + @Nonnull String userId, |
| 360 | + boolean activateExperiment) throws UnknownLiveVariableException { |
| 361 | + return getVariableDouble(variableKey, userId, Collections.<String, String>emptyMap(), activateExperiment); |
357 | 362 | } |
358 | 363 |
|
359 | | - public @Nullable Float getVariableFloat(@Nonnull String variableKey, |
360 | | - @Nonnull String userId, |
361 | | - @Nonnull Map<String, String> attributes, |
362 | | - boolean activateExperiment) |
| 364 | + public @Nullable Double getVariableDouble(@Nonnull String variableKey, |
| 365 | + @Nonnull String userId, |
| 366 | + @Nonnull Map<String, String> attributes, |
| 367 | + boolean activateExperiment) |
363 | 368 | throws UnknownLiveVariableException { |
364 | 369 |
|
365 | 370 | String variableValueString = getVariableString(variableKey, userId, attributes, activateExperiment); |
366 | 371 | if (variableValueString != null) { |
367 | 372 | try { |
368 | | - return Float.parseFloat(variableValueString); |
| 373 | + return Double.parseDouble(variableValueString); |
369 | 374 | } catch (NumberFormatException e) { |
370 | | - logger.error("Variable value \"{}\" for live variable \"{}\" is not a float.", variableValueString, |
| 375 | + logger.error("Variable value \"{}\" for live variable \"{}\" is not a double.", variableValueString, |
371 | 376 | variableKey); |
372 | 377 | } |
373 | 378 | } |
@@ -691,7 +696,7 @@ public Optimizely build() throws ConfigParseException { |
691 | 696 | } |
692 | 697 |
|
693 | 698 | if (clientVersion == null) { |
694 | | - clientVersion = BuildConfig.VERSION; |
| 699 | + clientVersion = BuildVersionInfo.VERSION; |
695 | 700 | } |
696 | 701 |
|
697 | 702 | if (eventBuilder == null) { |
|
0 commit comments