diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e4c4f1a1..684954b78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,27 @@ # Optimizely Android X SDK Changelog +### 1.4.0-beta-RC1 +August 2, 2017 + +- Release candidate for 1.4.0 + +*Bug Fixes* + +- Better javadocs. +- Cleanup any resource leaks. +- Better exception handling to avoid any crashes. +- Fix proguard rules. +- Fix logger issue. +- Allow EventRescheduler to work with wifi change intent filter (you don't have to include that intent filter). +- Remove unused imports. + +*Breaking Changes* + +- Must include intent filter for EventRescheduler and DatafileRescheduler in the application manifest if the developer wants to use them (see the test-app manifest for an example). +- Pass context into OptimizelyManager.Builder. +- UserProfileService added. +- Background processes are not running by default. +- Various handlers (EventHandler, DatafileHandler, ErrorHandler) can be overridden. + ### 1.4.0-alpha-RC1 July 26, 2017 diff --git a/android-sdk/src/main/java/com/optimizely/ab/android/sdk/OptimizelyClient.java b/android-sdk/src/main/java/com/optimizely/ab/android/sdk/OptimizelyClient.java index e6b1540c6..ab2715cca 100644 --- a/android-sdk/src/main/java/com/optimizely/ab/android/sdk/OptimizelyClient.java +++ b/android-sdk/src/main/java/com/optimizely/ab/android/sdk/OptimizelyClient.java @@ -47,7 +47,7 @@ public class OptimizelyClient { private final Logger logger; @Nullable private Optimizely optimizely; - @NonNull private Map defaultAttributes; + @NonNull private Map defaultAttributes = new HashMap<>(); OptimizelyClient(@Nullable Optimizely optimizely, @NonNull Logger logger) { this.optimizely = optimizely; @@ -59,7 +59,6 @@ public class OptimizelyClient { the public methods here were called before initialize. So, we start with an empty map of default attributes until the manager is initialized. */ - defaultAttributes = Collections.EMPTY_MAP; } /** diff --git a/android-sdk/src/main/java/com/optimizely/ab/android/sdk/OptimizelyManager.java b/android-sdk/src/main/java/com/optimizely/ab/android/sdk/OptimizelyManager.java index 16cbfad64..374457a05 100644 --- a/android-sdk/src/main/java/com/optimizely/ab/android/sdk/OptimizelyManager.java +++ b/android-sdk/src/main/java/com/optimizely/ab/android/sdk/OptimizelyManager.java @@ -61,7 +61,7 @@ public class OptimizelyManager { private final long datafileDownloadInterval; private final long eventDispatchInterval; @Nullable private EventHandler eventHandler = null; - @NonNull private ErrorHandler errorHandler; + @Nullable private ErrorHandler errorHandler; @NonNull private Logger logger; @NonNull private final String projectId; @NonNull private UserProfileService userProfileService; diff --git a/datafile-handler/src/main/java/com/optimizely/ab/android/datafile_handler/BackgroundWatchersCache.java b/datafile-handler/src/main/java/com/optimizely/ab/android/datafile_handler/BackgroundWatchersCache.java index 33c334c24..0b96dfb9b 100644 --- a/datafile-handler/src/main/java/com/optimizely/ab/android/datafile_handler/BackgroundWatchersCache.java +++ b/datafile-handler/src/main/java/com/optimizely/ab/android/datafile_handler/BackgroundWatchersCache.java @@ -54,7 +54,7 @@ class BackgroundWatchersCache { } /** - * Set the watching flag for the proejct id. + * Set the watching flag for the project id. * @param projectId project id to set watching. * @param watching flag to signify if the project is running in the background. * @return boolean indicating whether the set succeed or not diff --git a/datafile-handler/src/main/java/com/optimizely/ab/android/datafile_handler/DatafileCache.java b/datafile-handler/src/main/java/com/optimizely/ab/android/datafile_handler/DatafileCache.java index fa0106847..362b3ac5e 100644 --- a/datafile-handler/src/main/java/com/optimizely/ab/android/datafile_handler/DatafileCache.java +++ b/datafile-handler/src/main/java/com/optimizely/ab/android/datafile_handler/DatafileCache.java @@ -27,7 +27,7 @@ import org.slf4j.Logger; /** - * Abstracts the actual data "file" {@link java.io.File}. to a cached file + * Abstracts the actual datafile to a cached file containing the JSONObject as a string. */ public class DatafileCache { @@ -76,7 +76,7 @@ public String getFileName() { /** * Loads the datafile from cache into a JSONObject - * @return JSONObject if exists or nulll if it doesn't or there was a problem + * @return JSONObject if exists or null if it doesn't or there was a problem */ @Nullable public JSONObject load() { diff --git a/datafile-handler/src/main/java/com/optimizely/ab/android/datafile_handler/DatafileClient.java b/datafile-handler/src/main/java/com/optimizely/ab/android/datafile_handler/DatafileClient.java index 4c7a9fe0b..024a6131a 100644 --- a/datafile-handler/src/main/java/com/optimizely/ab/android/datafile_handler/DatafileClient.java +++ b/datafile-handler/src/main/java/com/optimizely/ab/android/datafile_handler/DatafileClient.java @@ -23,7 +23,6 @@ import org.slf4j.Logger; -import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; diff --git a/datafile-handler/src/main/java/com/optimizely/ab/android/datafile_handler/DatafileLoader.java b/datafile-handler/src/main/java/com/optimizely/ab/android/datafile_handler/DatafileLoader.java index 34f45b7db..1dc628049 100644 --- a/datafile-handler/src/main/java/com/optimizely/ab/android/datafile_handler/DatafileLoader.java +++ b/datafile-handler/src/main/java/com/optimizely/ab/android/datafile_handler/DatafileLoader.java @@ -96,10 +96,10 @@ private static class LoadDatafileFromCacheTask extends AsyncTask> convertJSONObjectToMap(JSONObject public static JSONObject convertMapToJSONObject(Map> userProfilesMap) throws Exception { JSONObject userProfilesJson = new JSONObject(); - Iterator userProfileIterator = userProfilesMap.entrySet().iterator(); - while (userProfileIterator.hasNext()) { - Map.Entry userProfileEntry = (Map.Entry) userProfileIterator.next(); + for (Map.Entry> userProfileEntry : userProfilesMap.entrySet()) { Map userProfileMap = (Map) userProfileEntry.getValue(); String userId = (String) userProfileMap.get(userIdKey); Map> experimentBucketMap = (Map>) userProfileMap.get(experimentBucketMapKey); JSONObject experimentBucketMapJson = new JSONObject(); - Iterator experimentBucketMapIterator = experimentBucketMap.entrySet().iterator(); - while (experimentBucketMapIterator.hasNext()) { - Map.Entry experimentBucketMapEntry = (Map.Entry) experimentBucketMapIterator.next(); + for (Map.Entry> experimentBucketMapEntry : experimentBucketMap.entrySet()) { String experimentId = (String) experimentBucketMapEntry.getKey(); - Map decisionsMap = (Map) experimentBucketMapEntry.getValue(); + Map decisionsMap = experimentBucketMapEntry.getValue(); JSONObject decisionJson = new JSONObject(); decisionJson.put(variationIdKey, decisionsMap.get (variationIdKey));