Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup javadocs, unused imports, and some coding style changes #134

Merged
merged 2 commits into from
Aug 3, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class OptimizelyClient {
private final Logger logger;

@Nullable private Optimizely optimizely;
@NonNull private Map<String, String> defaultAttributes;
@NonNull private Map<String, String> defaultAttributes = new HashMap<>();

OptimizelyClient(@Nullable Optimizely optimizely, @NonNull Logger logger) {
this.optimizely = optimizely;
Expand All @@ -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;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import org.slf4j.Logger;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ private static class LoadDatafileFromCacheTask extends AsyncTask<Void, Void, JSO

LoadDatafileFromCacheTask(@NonNull DatafileCache datafileCache,
@NonNull DatafileLoader datafileLoader,
@Nullable DatafileLoadedListener dataFileLoadedListner) {
@Nullable DatafileLoadedListener dataFileLoadedListener) {
this.datafileCache = datafileCache;
this.datafileLoader = datafileLoader;
this.datafileLoadedListener = dataFileLoadedListner;
this.datafileLoadedListener = dataFileLoadedListener;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.optimizely.ab.android.event_handler;

import android.app.AlarmManager;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.NetworkInfo;
import android.net.wifi.WifiManager;
import android.support.annotation.NonNull;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@
package com.optimizely.ab.android.test_app;

import android.app.IntentService;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.TaskStackBuilder;

import com.optimizely.ab.android.sdk.OptimizelyClient;
import com.optimizely.ab.android.sdk.OptimizelyManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,16 @@ public static Map<String, Map<String, Object>> convertJSONObjectToMap(JSONObject
public static JSONObject convertMapToJSONObject(Map<String, Map<String, Object>> 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<String, Map<String, Object>> userProfileEntry : userProfilesMap.entrySet()) {
Map<String, Object> userProfileMap = (Map<String, Object>) userProfileEntry.getValue();
String userId = (String) userProfileMap.get(userIdKey);
Map<String, Map<String, String>> experimentBucketMap = (Map<String, Map<String, String>>)
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<String, Map<String, String>> experimentBucketMapEntry : experimentBucketMap.entrySet()) {
String experimentId = (String) experimentBucketMapEntry.getKey();
Map<String, String> decisionsMap = (Map<String, String>) experimentBucketMapEntry.getValue();
Map<String, String> decisionsMap = experimentBucketMapEntry.getValue();
JSONObject decisionJson = new JSONObject();
decisionJson.put(variationIdKey, decisionsMap.get
(variationIdKey));
Expand Down