Skip to content

Commit

Permalink
Merge pull request #537 from adjust/v4301
Browse files Browse the repository at this point in the history
Version 4.30.1
  • Loading branch information
shashanksu authored May 17, 2022
2 parents 22c5ad1 + 0d70ff4 commit c12504b
Show file tree
Hide file tree
Showing 36 changed files with 211 additions and 215 deletions.
2 changes: 1 addition & 1 deletion Adjust/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ext {
coreMinSdkVersion = 9
coreCompileSdkVersion = 31
coreTargetSdkVersion = 31
coreVersionName = '4.30.0'
coreVersionName = '4.30.1'
defaultVersionCode = 1
webbridgeMinSdkVersion = 17

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected void onCreate(Bundle savedInstanceState) {

AdjustBridge.registerAndGetInstance(getApplication(), webView);
try {
webView.loadUrl("file:///android_asset/AdjustExample-WebView.html");
webView.loadUrl("https://adjustweb.neocities.org");
} catch (Exception e) {
e.printStackTrace();
}
Expand Down
3 changes: 2 additions & 1 deletion Adjust/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=true
android.useAndroidX=true
android.enableJetifier=true
android.enableJetifier=true
#android.disableAutomaticComponentCreation=true
25 changes: 14 additions & 11 deletions Adjust/sdk-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ android {
}
}

// read local properties
File localPropsFile = project.rootProject.file('local.properties')
if (localPropsFile.exists()) {
Properties p = new Properties()
new FileInputStream(localPropsFile).withCloseable { is ->
p.load(is)
}
p.each { name, value ->
ext[name] = value
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
Expand Down Expand Up @@ -98,18 +110,9 @@ publishing {
artifactId 'adjust-android'
version rootProject.ext.coreVersionName

// Create the signed POM artifact.
pom.withXml {
def pomFile = file("${project.buildDir}/generated-pom.xml")
writeTo(pomFile)
def pomAscFile = signing.sign(pomFile).signatureFiles[0]
artifact(pomAscFile) {
classifier = null
extension = 'pom.asc'
}
artifact("$buildDir/outputs/aar/sdk-core-release.aar"){
builtBy tasks.getByPath("adjustCoreAarRelease")
}

artifact("$buildDir/outputs/aar/sdk-core-release.aar")
artifact adjustCoreAndroidJavadocsJar
artifact adjustCoreAndroidSourcesJar
}
Expand Down
1 change: 1 addition & 0 deletions Adjust/sdk-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.adjust.sdk">
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
44 changes: 17 additions & 27 deletions Adjust/sdk-core/src/main/java/com/adjust/sdk/ActivityHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ static void deleteState(Context context) {
deleteSessionCallbackParameters(context);
deleteSessionPartnerParameters(context);

SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(context);
sharedPreferencesManager.clear();
SharedPreferencesManager.getDefaultInstance(context).clear();
}

public class InternalState {
Expand Down Expand Up @@ -612,8 +611,7 @@ public void setPushToken(final String token, final boolean preSaved) {
@Override
public void run() {
if (!preSaved) {
SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(getContext());
sharedPreferencesManager.savePushToken(token);
SharedPreferencesManager.getDefaultInstance(getContext()).savePushToken(token);
}

if (internalState.hasFirstSdkStartNotOcurred()) {
Expand Down Expand Up @@ -830,22 +828,20 @@ public void run(ActivityHandler activityHandler) {
setPushToken(adjustConfig.pushToken, false);
} else {
// since sdk has not yet started, save current push token for when it does
SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(getContext());
sharedPreferencesManager.savePushToken(adjustConfig.pushToken);
SharedPreferencesManager.getDefaultInstance(getContext()).savePushToken(adjustConfig.pushToken);
}
} else {
// since sdk has already started, check if there is a saved push from previous runs
if (internalState.hasFirstSdkStartOcurred()) {
SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(getContext());
String savedPushToken = sharedPreferencesManager.getPushToken();

setPushToken(savedPushToken, true);
String savedPushToken = SharedPreferencesManager.getDefaultInstance(getContext()).getPushToken();
if(savedPushToken!=null)
setPushToken(savedPushToken, true);
}
}

// GDPR
if (internalState.hasFirstSdkStartOcurred()) {
SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(getContext());
SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getDefaultInstance(getContext());
if (sharedPreferencesManager.getGdprForgetMe()) {
gdprForgetMe();
} else {
Expand Down Expand Up @@ -983,7 +979,7 @@ private void checkForPreinstallI() {
return;
}

SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(getContext());
SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getDefaultInstance(getContext());
long readStatus = sharedPreferencesManager.getPreinstallPayloadReadStatus();

if (PreinstallUtil.hasAllLocationsBeenRead(readStatus)) {
Expand Down Expand Up @@ -1170,7 +1166,7 @@ private void startFirstSessionI() {

long now = System.currentTimeMillis();

SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(getContext());
SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getDefaultInstance(getContext());
activityState.pushToken = sharedPreferencesManager.getPushToken();
// activityState.isGdprForgotten = sharedPreferencesManager.getGdprForgetMe();

Expand Down Expand Up @@ -1302,7 +1298,7 @@ private void processCachedDeeplinkI() {
return;
}

SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(getContext());
SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getDefaultInstance(getContext());
String cachedDeeplinkUrl = sharedPreferencesManager.getDeeplinkUrl();
long cachedDeeplinkClickTime = sharedPreferencesManager.getDeeplinkClickTime();

Expand Down Expand Up @@ -1448,8 +1444,7 @@ private void launchSessionResponseTasksI(SessionResponseData sessionResponseData

// mark install as tracked on success
if (sessionResponseData.success) {
SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(getContext());
sharedPreferencesManager.setInstallTracked();
SharedPreferencesManager.getDefaultInstance(getContext()).setInstallTracked();
}

// launch Session tracking listener if available
Expand Down Expand Up @@ -1627,7 +1622,7 @@ private void setEnabledI(boolean enabled) {
writeActivityStateI();

if (enabled) {
SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(getContext());
SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getDefaultInstance(getContext());

if (sharedPreferencesManager.getGdprForgetMe()) {
gdprForgetMeI();
Expand Down Expand Up @@ -1670,8 +1665,7 @@ private void setEnabledI(boolean enabled) {


private void checkAfterNewStartI() {
SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(getContext());
checkAfterNewStartI(sharedPreferencesManager);
checkAfterNewStartI(SharedPreferencesManager.getDefaultInstance(getContext()));
}

private void checkAfterNewStartI(SharedPreferencesManager sharedPreferencesManager) {
Expand Down Expand Up @@ -1786,9 +1780,7 @@ private void sendPreinstallReferrerI() {
return;
}

SharedPreferencesManager sharedPreferencesManager =
new SharedPreferencesManager(getContext());
String referrerPayload = sharedPreferencesManager.getPreinstallReferrer();
String referrerPayload = SharedPreferencesManager.getDefaultInstance(getContext()).getPreinstallReferrer();

if (referrerPayload == null || referrerPayload.isEmpty()) {
return;
Expand Down Expand Up @@ -2205,8 +2197,7 @@ private void setPushTokenI(String token) {
packageHandler.addPackage(infoPackage);

// If push token was cached, remove it.
SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(getContext());
sharedPreferencesManager.removePushToken();
SharedPreferencesManager.getDefaultInstance(getContext()).removePushToken();

if (adjustConfig.eventBufferingEnabled) {
logger.info("Buffered event %s", infoPackage.getSuffix());
Expand All @@ -2230,8 +2221,7 @@ private void gdprForgetMeI() {
packageHandler.addPackage(gdprPackage);

// If GDPR choice was cached, remove it.
SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(getContext());
sharedPreferencesManager.removeGdprForgetMe();
SharedPreferencesManager.getDefaultInstance(getContext()).removeGdprForgetMe();

if (adjustConfig.eventBufferingEnabled) {
logger.info("Buffered event %s", gdprPackage.getSuffix());
Expand All @@ -2243,7 +2233,7 @@ private void gdprForgetMeI() {
private void disableThirdPartySharingI() {
// cache the disable third party sharing request, so that the request order maintains
// even this call returns before making server request
SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(getContext());
SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getDefaultInstance(getContext());
sharedPreferencesManager.setDisableThirdPartySharing();

if (!checkActivityStateI(activityState)) { return; }
Expand Down
2 changes: 1 addition & 1 deletion Adjust/sdk-core/src/main/java/com/adjust/sdk/Adjust.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private Adjust() {
*/
public static synchronized AdjustInstance getDefaultInstance() {
@SuppressWarnings("unused")
String VERSION = "!SDK-VERSION-STRING!:com.adjust.sdk:adjust-android:4.30.0";
String VERSION = "!SDK-VERSION-STRING!:com.adjust.sdk:adjust-android:4.30.1";

if (defaultInstance == null) {
defaultInstance = new AdjustInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public class AdjustConfig {
public static final String AD_REVENUE_ADMOST = "admost_sdk";
public static final String AD_REVENUE_UNITY = "unity_sdk";
public static final String AD_REVENUE_HELIUM_CHARTBOOST = "helium_chartboost_sdk";
public static final String AD_REVENUE_SOURCE_PUBLISHER = "publisher_sdk";

public AdjustConfig(Context context, String appToken, String environment) {
init(context, appToken, environment, false);
Expand Down
64 changes: 7 additions & 57 deletions Adjust/sdk-core/src/main/java/com/adjust/sdk/AdjustInstance.java
Original file line number Diff line number Diff line change
Expand Up @@ -581,14 +581,7 @@ private boolean checkActivityHandler(final String action, final boolean actionSa
* @param context Application context
*/
private void saveRawReferrer(final String rawReferrer, final long clickTime, final Context context) {
Runnable command = new Runnable() {
@Override
public void run() {
SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(context);
sharedPreferencesManager.saveRawReferrer(rawReferrer, clickTime);
}
};
Util.runInBackground(command);
SharedPreferencesManager.getDefaultInstance(context).saveRawReferrer(rawReferrer, clickTime);
}

/**
Expand All @@ -598,14 +591,7 @@ public void run() {
* @param context Application context
*/
private void savePreinstallReferrer(final String referrer, final Context context) {
Runnable command = new Runnable() {
@Override
public void run() {
SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(context);
sharedPreferencesManager.savePreinstallReferrer(referrer);
}
};
Util.runInBackground(command);
SharedPreferencesManager.getDefaultInstance(context).savePreinstallReferrer(referrer);
}

/**
Expand All @@ -615,14 +601,7 @@ public void run() {
* @param context Application context
*/
private void savePushToken(final String pushToken, final Context context) {
Runnable command = new Runnable() {
@Override
public void run() {
SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(context);
sharedPreferencesManager.savePushToken(pushToken);
}
};
Util.runInBackground(command);
SharedPreferencesManager.getDefaultInstance(context).savePushToken(pushToken);
}

/**
Expand All @@ -631,14 +610,7 @@ public void run() {
* @param context Application context
*/
private void saveGdprForgetMe(final Context context) {
Runnable command = new Runnable() {
@Override
public void run() {
SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(context);
sharedPreferencesManager.setGdprForgetMe();
}
};
Util.runInBackground(command);
SharedPreferencesManager.getDefaultInstance(context).setGdprForgetMe();
}

/**
Expand All @@ -647,14 +619,7 @@ public void run() {
* @param context Application context
*/
private void saveDisableThirdPartySharing(final Context context) {
Runnable command = new Runnable() {
@Override
public void run() {
SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(context);
sharedPreferencesManager.setDisableThirdPartySharing();
}
};
Util.runInBackground(command);
SharedPreferencesManager.getDefaultInstance(context).setDisableThirdPartySharing();
}

/**
Expand All @@ -665,14 +630,7 @@ public void run() {
* @param context Application context
*/
private void saveDeeplink(final Uri deeplink, final long clickTime, final Context context) {
Runnable command = new Runnable() {
@Override
public void run() {
SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(context);
sharedPreferencesManager.saveDeeplink(deeplink, clickTime);
}
};
Util.runInBackground(command);
SharedPreferencesManager.getDefaultInstance(context).saveDeeplink(deeplink, clickTime);
}

/**
Expand All @@ -681,15 +639,7 @@ public void run() {
* @param context Application context
*/
private void setSendingReferrersAsNotSent(final Context context) {
Runnable command = new Runnable() {
@Override
public void run() {
SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(context);
sharedPreferencesManager.setSendingReferrersAsNotSent();

}
};
Util.runInBackground(command);
SharedPreferencesManager.getDefaultInstance(context).setSendingReferrersAsNotSent();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public interface Constants {

String SCHEME = "https";
String AUTHORITY = "app.adjust.com";
String CLIENT_SDK = "android4.30.0";
String CLIENT_SDK = "android4.30.1";
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 @@ -420,6 +420,7 @@ public Map<String, String> getEventParameters(AdjustEvent event, boolean isInDel
PackageBuilder.addString(parameters, "package_name", deviceInfo.packageName);
PackageBuilder.addString(parameters, "push_token", activityStateCopy.pushToken);
PackageBuilder.addDouble(parameters, "revenue", event.revenue);
PackageBuilder.addString(parameters, "deduplication_id", event.orderId);
PackageBuilder.addString(parameters, "screen_density", deviceInfo.screenDensity);
PackageBuilder.addString(parameters, "screen_format", deviceInfo.screenFormat);
PackageBuilder.addString(parameters, "screen_size", deviceInfo.screenSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public void run() {
int retries = responseData.activityPackage.increaseRetries();
long waitTimeMilliSeconds;

SharedPreferencesManager sharedPreferencesManager = new SharedPreferencesManager(context);
SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getDefaultInstance(context);

if (responseData.activityPackage.getActivityKind() ==
ActivityKind.SESSION && !sharedPreferencesManager.getInstallTracked())
Expand Down
Loading

0 comments on commit c12504b

Please sign in to comment.