Skip to content

Commit

Permalink
Merge pull request #319 from adjust/v4123
Browse files Browse the repository at this point in the history
Version 4.12.3
  • Loading branch information
nonelse authored Mar 7, 2018
2 parents d0f04cf + da32360 commit 7ea52e0
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Adjust/adjust/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.library'

def getVersionName() {
return "4.12.2"
return "4.12.3"
}

android {
Expand Down
2 changes: 1 addition & 1 deletion Adjust/adjust/src/main/java/com/adjust/sdk/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public interface Constants {
String BASE_URL = "https://app.adjust.com";
String SCHEME = "https";
String AUTHORITY = "app.adjust.com";
String CLIENT_SDK = "android4.12.2";
String CLIENT_SDK = "android4.12.3";
String LOGTAG = "Adjust";
String REFTAG = "reftag";
String INSTALL_REFERRER = "install_referrer";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public class SharedPreferencesManager {
*/
private static final int INDEX_IS_SENDING = 2;

/**
* Number of persisted referrers.
*/
private static final int REFERRERS_COUNT = 10;

/**
* Shared preferences of the app.
*/
Expand All @@ -71,14 +76,18 @@ public SharedPreferencesManager(final Context context) {
*/
public synchronized void saveRawReferrer(final String rawReferrer, final long clickTime) {
try {
if (getRawReferrer(rawReferrer, clickTime) != null) {
return;
}

JSONArray rawReferrerArray = getRawReferrerArray();

if (getRawReferrer(rawReferrer, clickTime) != null) {
// There are exactly REFERRERS_COUNT saved referrers, do nothing.
if (rawReferrerArray.length() == REFERRERS_COUNT) {
return;
}

JSONArray newRawReferrer = new JSONArray();

newRawReferrer.put(INDEX_RAW_REFERRER, rawReferrer);
newRawReferrer.put(INDEX_CLICK_TIME, clickTime);
newRawReferrer.put(INDEX_IS_SENDING, 0);
Expand All @@ -95,7 +104,11 @@ public synchronized void saveRawReferrer(final String rawReferrer, final long cl
* @param rawReferrerArray Array of referrers to be saved
*/
public synchronized void saveRawReferrerArray(final JSONArray rawReferrerArray) {
saveString(PREFS_KEY_RAW_REFERRERS, rawReferrerArray.toString());
try {
saveString(PREFS_KEY_RAW_REFERRERS, rawReferrerArray.toString());
} catch (Throwable t) {
remove(PREFS_KEY_RAW_REFERRERS);
}
}

/**
Expand Down Expand Up @@ -160,13 +173,27 @@ public synchronized JSONArray getRawReferrer(final String rawReferrer, final lon
* @return JSONArray of saved referrers. Defaults to empty JSONArray if none found.
*/
public synchronized JSONArray getRawReferrerArray() {
try {
String referrerQueueString = getString(PREFS_KEY_RAW_REFERRERS);
String referrerQueueString = getString(PREFS_KEY_RAW_REFERRERS);

if (referrerQueueString != null) {
try {
JSONArray rawReferrerArray = new JSONArray(referrerQueueString);

// Initial move for those who have more than REFERRERS_COUNT stored already.
// Cut the array and leave it with only REFERRERS_COUNT elements.
if (rawReferrerArray.length() > REFERRERS_COUNT) {
JSONArray tempReferrerArray = new JSONArray();
for (int i = 0; i < REFERRERS_COUNT; i += 1) {
tempReferrerArray.put(rawReferrerArray.get(i));
}
saveRawReferrerArray(tempReferrerArray);
return tempReferrerArray;
}

if (referrerQueueString != null) {
return new JSONArray(referrerQueueString);
} catch (JSONException e) {
} catch (Throwable t) {
}
} catch (JSONException e) {
}

return new JSONArray();
Expand Down Expand Up @@ -306,6 +333,11 @@ private synchronized String getString(final String key) {
return this.sharedPreferences.getString(key, null);
} catch (ClassCastException e) {
return null;
} catch (Throwable t) {
if (key.equals(PREFS_KEY_RAW_REFERRERS)) {
remove(PREFS_KEY_RAW_REFERRERS);
}
return null;
}
}

Expand Down
2 changes: 1 addition & 1 deletion Adjust/example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies {
// running mvn package
//compile fileTree(dir: '../target', include: ['*.jar'])
// using maven repository
//compile 'com.adjust.sdk:adjust-android:4.12.2'
//compile 'com.adjust.sdk:adjust-android:4.12.3'

debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.4'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
Expand Down
2 changes: 1 addition & 1 deletion Adjust/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>adjust-android</artifactId>
<groupId>com.adjust.sdk</groupId>
<version>4.12.2</version>
<version>4.12.3</version>
<packaging>jar</packaging>
<name>Adjust Android SDK</name>
<url>https://github.com/adjust/android_sdk</url>
Expand Down
2 changes: 1 addition & 1 deletion Adjust/pom_criteo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>adjust-android-criteo</artifactId>
<groupId>com.adjust.sdk</groupId>
<version>4.12.2</version>
<version>4.12.3</version>
<packaging>jar</packaging>
<name>Adjust Android SDK</name>
<url>https://github.com/adjust/android_sdk</url>
Expand Down
2 changes: 1 addition & 1 deletion Adjust/pom_sociomantic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>adjust-android-sociomantic</artifactId>
<groupId>com.adjust.sdk</groupId>
<version>4.12.2</version>
<version>4.12.3</version>
<packaging>jar</packaging>
<name>Adjust Android SDK</name>
<url>https://github.com/adjust/android_sdk</url>
Expand Down
2 changes: 1 addition & 1 deletion Adjust/pom_trademob.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>adjust-android-trademob</artifactId>
<groupId>com.adjust.sdk</groupId>
<version>4.12.2</version>
<version>4.12.3</version>
<packaging>jar</packaging>
<name>Adjust Android SDK</name>
<url>https://github.com/adjust/android_sdk</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public TestActivityPackage(ActivityPackage activityPackage) {
// default values
appToken = "123456789012";
environment = "sandbox";
clientSdk = "android4.12.2";
clientSdk = "android4.12.3";
suffix = "";
attribution = new AdjustAttribution();
playServices = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ private void startTestSession() {
//testLibrary.addTestDirectory("current/sdkInfo");
//testLibrary.addTest("current/appSecret/Test_AppSecret_no_secret");

testLibrary.startTestSession("android4.12.2");
testLibrary.startTestSession("android4.12.3");
}
}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### Version 4.12.3 (7th March 2018)
#### Fixed
- Fixed random `OutOfMemoryError` occurrences when reading/writing referrers array.

---

### Version 4.12.2 (28th February 2018)
#### Changed
- Capturing information about silently ignored runtime exceptions by scheduled executor.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ These are the minimal steps required to integrate the Adjust SDK into your Andro
If you are using Maven, add the following to your `build.gradle` file:

```
compile 'com.adjust.sdk:adjust-android:4.12.2'
compile 'com.adjust.sdk:adjust-android:4.12.3'
compile 'com.android.installreferrer:installreferrer:1.0'
```

**Note**: If you are using `Gradle 3.0.0 or above`, make sure to use the `implementation` keyword instead of `compile` as follows:

```
implementation 'com.adjust.sdk:adjust-android:4.12.2'
implementation 'com.adjust.sdk:adjust-android:4.12.3'
implementation 'com.android.installreferrer:installreferrer:1.0'
```

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.12.2
4.12.3
2 changes: 1 addition & 1 deletion doc/english/criteo_plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Add the dependency of the adjust sdk with the Criteo plugin:

```
compile 'com.adjust.sdk:adjust-android-criteo:4.12.2'
compile 'com.adjust.sdk:adjust-android-criteo:4.12.3'
```

Or integrate adjust with Criteo events by following these steps:
Expand Down
2 changes: 1 addition & 1 deletion doc/english/migrate.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Migrate your adjust SDK for Android to 4.12.2 from 3.6.2
## Migrate your adjust SDK for Android to 4.12.3 from 3.6.2

### The Application class

Expand Down
2 changes: 1 addition & 1 deletion doc/english/sociomantic_plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Add the dependency of the adjust sdk with the Sociomantic plugin:

```
compile 'com.adjust.sdk:adjust-android-sociomantic:4.12.2'
compile 'com.adjust.sdk:adjust-android-sociomantic:4.12.3'
```

Or integrate adjust with Sociomantic events by following these steps:
Expand Down
2 changes: 1 addition & 1 deletion doc/english/trademob_plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Add the dependency of the adjust sdk with the Trademob plugin:

```
compile 'com.adjust.sdk:adjust-android-trademob:4.12.2'
compile 'com.adjust.sdk:adjust-android-trademob:4.12.3'
```

Or integrate adjust with Trademob events by following these steps:
Expand Down

0 comments on commit 7ea52e0

Please sign in to comment.