Skip to content

Commit

Permalink
Merge pull request #313 from adjust/v4121
Browse files Browse the repository at this point in the history
Version 4.12.1
  • Loading branch information
nonelse authored Jan 31, 2018
2 parents e32fa81 + 5b354c1 commit da45c9d
Show file tree
Hide file tree
Showing 31 changed files with 72 additions and 64 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.0"
return "4.12.1"
}

android {
Expand Down
10 changes: 5 additions & 5 deletions Adjust/adjust/src/main/java/com/adjust/sdk/ActivityPackage.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ public ActivityPackage(ActivityKind activityKind) {
}

public String toString() {
return String.format(Locale.US, "%s%s", activityKind.toString(), suffix);
return Util.formatString("%s%s", activityKind.toString(), suffix);
}

public String getExtendedString() {
StringBuilder builder = new StringBuilder();
builder.append(String.format(Locale.US, "Path: %s\n", path));
builder.append(String.format(Locale.US, "ClientSdk: %s\n", clientSdk));
builder.append(Util.formatString("Path: %s\n", path));
builder.append(Util.formatString("ClientSdk: %s\n", clientSdk));

if (parameters != null) {
builder.append("Parameters:");
Expand All @@ -160,14 +160,14 @@ public String getExtendedString() {
if (stringsToExclude.contains(key)) {
continue;
}
builder.append(String.format(Locale.US, "\n\t%-16s %s", key, entry.getValue()));
builder.append(Util.formatString("\n\t%-16s %s", key, entry.getValue()));
}
}
return builder.toString();
}

protected String getFailureMessage() {
return String.format(Locale.US, "Failed to track %s%s", activityKind.toString(), suffix);
return Util.formatString("Failed to track %s%s", activityKind.toString(), suffix);
}

private void writeObject(ObjectOutputStream stream) throws IOException {
Expand Down
6 changes: 2 additions & 4 deletions Adjust/adjust/src/main/java/com/adjust/sdk/ActivityState.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ protected boolean findOrderId(String orderId) {

@Override
public String toString() {
return String.format(Locale.US,
"ec:%d sc:%d ssc:%d sl:%.1f ts:%.1f la:%s uuid:%s",
return Util.formatString("ec:%d sc:%d ssc:%d sl:%.1f ts:%.1f la:%s uuid:%s",
eventCount, sessionCount, subsessionCount,
sessionLength / 1000.0, timeSpent / 1000.0,
stamp(lastActivity), uuid);
Expand Down Expand Up @@ -214,8 +213,7 @@ private void writeObject(ObjectOutputStream stream) throws IOException {
private static String stamp(long dateMillis) {
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(dateMillis);
return String.format(Locale.US,
"%02d:%02d:%02d",
return Util.formatString("%02d:%02d:%02d",
calendar.HOUR_OF_DAY,
calendar.MINUTE,
calendar.SECOND);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public int hashCode() {

@Override
public String toString() {
return String.format(Locale.US, "tt:%s tn:%s net:%s cam:%s adg:%s cre:%s cl:%s adid:%s",
return Util.formatString("tt:%s tn:%s net:%s cam:%s adg:%s cre:%s cl:%s adid:%s",
trackerToken, trackerName, network, campaign, adgroup, creative, clickLabel, adid);
}

Expand Down
4 changes: 2 additions & 2 deletions Adjust/adjust/src/main/java/com/adjust/sdk/AdjustConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ public void setUserAgent(String userAgent) {
}

public void setAppSecret(long secretId, long info1, long info2, long info3, long info4) {
this.secretId = String.format("%d", secretId);
this.appSecret = String.format("%d%d%d%d", info1, info2, info3, info4);
this.secretId = Util.formatString("%d", secretId);
this.appSecret = Util.formatString("%d%d%d%d", info1, info2, info3, info4);
}

public void setReadMobileEquipmentIdentity(boolean readMobileEquipmentIdentity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class AdjustEventFailure {

@Override
public String toString() {
return String.format(Locale.US, "Event Failure msg:%s time:%s adid:%s event:%s retry:%b json:%s",
return Util.formatString("Event Failure msg:%s time:%s adid:%s event:%s retry:%b json:%s",
message, timestamp, adid, eventToken, willRetry, jsonResponse);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class AdjustEventSuccess {

@Override
public String toString() {
return String.format(Locale.US, "Event Success msg:%s time:%s adid:%s event:%s json:%s",
return Util.formatString("Event Success msg:%s time:%s adid:%s event:%s json:%s",
message, timestamp, adid, eventToken, jsonResponse);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class AdjustSessionFailure {

@Override
public String toString() {
return String.format(Locale.US, "Session Failure msg:%s time:%s adid:%s retry:%b json:%s",
return Util.formatString("Session Failure msg:%s time:%s adid:%s retry:%b json:%s",
message, timestamp, adid, willRetry, jsonResponse);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class AdjustSessionSuccess {

@Override
public String toString() {
return String.format(Locale.US, "Session Success msg:%s time:%s adid:%s json:%s",
return Util.formatString("Session Success msg:%s time:%s adid:%s json:%s",
message, timestamp, adid, jsonResponse);
}
}
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.0";
String CLIENT_SDK = "android4.12.1";
String LOGTAG = "Adjust";
String REFTAG = "reftag";
String INSTALL_REFERRER = "install_referrer";
Expand Down
2 changes: 1 addition & 1 deletion Adjust/adjust/src/main/java/com/adjust/sdk/DeviceInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ private String getClientSdk(String sdkPrefix) {
if (sdkPrefix == null) {
return Constants.CLIENT_SDK;
} else {
return String.format(Locale.US, "%s@%s", sdkPrefix, Constants.CLIENT_SDK);
return Util.formatString("%s@%s", sdkPrefix, Constants.CLIENT_SDK);
}
}

Expand Down
28 changes: 14 additions & 14 deletions Adjust/adjust/src/main/java/com/adjust/sdk/Logger.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ public void verbose(String message, Object... parameters) {
}
if (logLevel.androidLogLevel <= Log.VERBOSE) {
try {
Log.v(LOGTAG, String.format(Locale.US, message, parameters));
Log.v(LOGTAG, Util.formatString(message, parameters));
} catch (Exception e) {
Log.e(LOGTAG, String.format(Locale.US, formatErrorMessage, message, Arrays.toString(parameters)));
Log.e(LOGTAG, Util.formatString(formatErrorMessage, message, Arrays.toString(parameters)));
}
}
}
Expand All @@ -70,9 +70,9 @@ public void debug(String message, Object... parameters) {
}
if (logLevel.androidLogLevel <= Log.DEBUG) {
try {
Log.d(LOGTAG, String.format(Locale.US, message, parameters));
Log.d(LOGTAG, Util.formatString(message, parameters));
} catch (Exception e) {
Log.e(LOGTAG, String.format(Locale.US, formatErrorMessage, message, Arrays.toString(parameters)));
Log.e(LOGTAG, Util.formatString(formatErrorMessage, message, Arrays.toString(parameters)));
}
}
}
Expand All @@ -84,9 +84,9 @@ public void info(String message, Object... parameters) {
}
if (logLevel.androidLogLevel <= Log.INFO) {
try {
Log.i(LOGTAG, String.format(Locale.US, message, parameters));
Log.i(LOGTAG, Util.formatString(message, parameters));
} catch (Exception e) {
Log.e(LOGTAG, String.format(Locale.US, formatErrorMessage, message, Arrays.toString(parameters)));
Log.e(LOGTAG, Util.formatString(formatErrorMessage, message, Arrays.toString(parameters)));
}
}
}
Expand All @@ -98,9 +98,9 @@ public void warn(String message, Object... parameters) {
}
if (logLevel.androidLogLevel <= Log.WARN) {
try {
Log.w(LOGTAG, String.format(Locale.US, message, parameters));
Log.w(LOGTAG, Util.formatString(message, parameters));
} catch (Exception e) {
Log.e(LOGTAG, String.format(Locale.US, formatErrorMessage, message, Arrays.toString(parameters)));
Log.e(LOGTAG, Util.formatString(formatErrorMessage, message, Arrays.toString(parameters)));
}
}
}
Expand All @@ -109,9 +109,9 @@ public void warn(String message, Object... parameters) {
public void warnInProduction(String message, Object... parameters) {
if (logLevel.androidLogLevel <= Log.WARN) {
try {
Log.w(LOGTAG, String.format(Locale.US, message, parameters));
Log.w(LOGTAG, Util.formatString(message, parameters));
} catch (Exception e) {
Log.e(LOGTAG, String.format(Locale.US, formatErrorMessage, message, Arrays.toString(parameters)));
Log.e(LOGTAG, Util.formatString(formatErrorMessage, message, Arrays.toString(parameters)));
}
}
}
Expand All @@ -124,9 +124,9 @@ public void error(String message, Object... parameters) {
}
if (logLevel.androidLogLevel <= Log.ERROR) {
try {
Log.e(LOGTAG, String.format(Locale.US, message, parameters));
Log.e(LOGTAG, Util.formatString(message, parameters));
} catch (Exception e) {
Log.e(LOGTAG, String.format(Locale.US, formatErrorMessage, message, Arrays.toString(parameters)));
Log.e(LOGTAG, Util.formatString(formatErrorMessage, message, Arrays.toString(parameters)));
}
}
}
Expand All @@ -138,9 +138,9 @@ public void Assert(String message, Object... parameters) {
}
if(logLevel.androidLogLevel <= Log.ASSERT) {
try {
Log.println(Log.ASSERT, LOGTAG, String.format(Locale.US, message, parameters));
Log.println(Log.ASSERT, LOGTAG, Util.formatString(message, parameters));
} catch (Exception e) {
Log.e(LOGTAG, String.format(Locale.US, formatErrorMessage, message, Arrays.toString(parameters)));
Log.e(LOGTAG, Util.formatString(formatErrorMessage, message, Arrays.toString(parameters)));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,9 @@ private void fillPluginKeys(Map<String, String> parameters) {

private String getEventSuffix(AdjustEvent event) {
if (event.revenue == null) {
return String.format(Locale.US, "'%s'", event.eventToken);
return Util.formatString("'%s'", event.eventToken);
} else {
return String.format(Locale.US, "(%.5f %s, '%s')", event.revenue, event.currency, event.eventToken);
return Util.formatString("(%.5f %s, '%s')", event.revenue, event.currency, event.eventToken);
}
}

Expand Down Expand Up @@ -415,7 +415,7 @@ public static void addBoolean(Map<String, String> parameters, String key, Boolea
public static void addDouble(Map<String, String> parameters, String key, Double value) {
if (value == null) return;

String doubleString = String.format(Locale.US, "%.5f", value);
String doubleString = Util.formatString("%.5f", value);

PackageBuilder.addString(parameters, key, doubleString);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private void sendI(ActivityPackage activityPackage, int queueSize) {
private void closePackageI(ActivityPackage activityPackage, String message, Throwable throwable) {
final String packageMessage = activityPackage.getFailureMessage();
final String reasonString = Util.getReasonString(message, throwable);
String finalMessage = String.format("%s. (%s) Will retry later", packageMessage, reasonString);
String finalMessage = Util.formatString("%s. (%s) Will retry later", packageMessage, reasonString);
logger.error(finalMessage);

ResponseData responseData = ResponseData.buildResponseData(activityPackage);
Expand All @@ -108,7 +108,7 @@ private void closePackageI(ActivityPackage activityPackage, String message, Thro
private void sendNextPackageI(ActivityPackage activityPackage, String message, Throwable throwable) {
final String failureMessage = activityPackage.getFailureMessage();
final String reasonString = Util.getReasonString(message, throwable);
String finalMessage = String.format("%s. (%s)", failureMessage, reasonString);
String finalMessage = Util.formatString("%s. (%s)", failureMessage, reasonString);
logger.error(finalMessage);

ResponseData responseData = ResponseData.buildResponseData(activityPackage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static ResponseData buildResponseData(ActivityPackage activityPackage) {

@Override
public String toString() {
return String.format(Locale.US, "message:%s timestamp:%s json:%s",
return Util.formatString("message:%s timestamp:%s json:%s",
message, timestamp, jsonResponse);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ private void logErrorMessageI(final ActivityPackage sdkClickPackage,
final Throwable throwable) {
final String packageMessage = sdkClickPackage.getFailureMessage();
final String reasonString = Util.getReasonString(message, throwable);
final String finalMessage = String.format("%s. (%s)", packageMessage, reasonString);
final String finalMessage = Util.formatString("%s. (%s)", packageMessage, reasonString);

logger.error(finalMessage);
}
Expand Down
12 changes: 8 additions & 4 deletions Adjust/adjust/src/main/java/com/adjust/sdk/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static String quote(String string) {
return string;
}

return String.format(Locale.US, "'%s'", string);
return Util.formatString("'%s'", string);
}

public static String getPlayAdId(Context context) {
Expand Down Expand Up @@ -448,7 +448,7 @@ public static String hash(final String text, final String method) {
public static String convertToHex(final byte[] bytes) {
final BigInteger bigInt = new BigInteger(1, bytes);
final String formatString = "%0" + (bytes.length << 1) + "x";
return String.format(Locale.US, formatString, bigInt);
return Util.formatString(formatString, bigInt);
}

public static String[] getSupportedAbis() {
Expand All @@ -461,9 +461,9 @@ public static String getCpuAbi() {

public static String getReasonString(String message, Throwable throwable) {
if (throwable != null) {
return String.format(Locale.US, "%s: %s", message, throwable);
return Util.formatString("%s: %s", message, throwable);
} else {
return String.format(Locale.US, "%s", message);
return Util.formatString("%s", message);
}
}

Expand Down Expand Up @@ -623,4 +623,8 @@ public static String getMnc(Context context) {
return null;
}
}

public static String formatString(String format, Object... args) {
return String.format(Locale.US, format, args);
}
}
12 changes: 6 additions & 6 deletions Adjust/adjust/src/main/java/com/adjust/sdk/UtilNetworking.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private static ResponseData readHttpResponse(HttpsURLConnection connection, Acti
try {
jsonResponse = new JSONObject(stringResponse);
} catch (JSONException e) {
String message = String.format("Failed to parse json response. (%s)", e.getMessage());
String message = Util.formatString("Failed to parse json response. (%s)", e.getMessage());
logger.error(message);
responseData.message = message;
}
Expand Down Expand Up @@ -267,12 +267,12 @@ private static String buildAuthorizationHeader(Map<String, String> parameters,
String signature = Util.sha256(signatureDetails.get("clear_signature"));
String fields = signatureDetails.get("fields");

String secretIdHeader = String.format("secret_id=\"%s\"", secretId);
String signatureHeader = String.format("signature=\"%s\"", signature);
String algorithmHeader = String.format("algorithm=\"%s\"", algorithm);
String fieldsHeader = String.format("headers=\"%s\"", fields);
String secretIdHeader = Util.formatString("secret_id=\"%s\"", secretId);
String signatureHeader = Util.formatString("signature=\"%s\"", signature);
String algorithmHeader = Util.formatString("algorithm=\"%s\"", algorithm);
String fieldsHeader = Util.formatString("headers=\"%s\"", fields);

String authorizationHeader = String.format("Signature %s,%s,%s,%s", secretIdHeader, signatureHeader, algorithmHeader, fieldsHeader);
String authorizationHeader = Util.formatString("Signature %s,%s,%s,%s", secretIdHeader, signatureHeader, algorithmHeader, fieldsHeader);
getLogger().verbose("authorizationHeader: %s", authorizationHeader);

return authorizationHeader;
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.0'
//compile 'com.adjust.sdk:adjust-android:4.12.1'

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.0</version>
<version>4.12.1</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.0</version>
<version>4.12.1</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.0</version>
<version>4.12.1</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.0</version>
<version>4.12.1</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.0";
clientSdk = "android4.12.1";
suffix = "";
attribution = new AdjustAttribution();
playServices = true;
Expand Down
Loading

0 comments on commit da45c9d

Please sign in to comment.