Skip to content

Commit

Permalink
Release 6.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
weiqiangliu committed Feb 25, 2022
1 parent 3cdf5d1 commit ef67566
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 8 deletions.
2 changes: 1 addition & 1 deletion SensorsAnalyticsSDK/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply plugin: 'com.android.library'
apply plugin: 'signing'
apply plugin: 'maven-publish'

version = "6.2.2"
version = "6.2.3"
def min_plugin_version = "3.4.0"

android {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,17 @@ public void onActivityPaused(Activity activity) {
try {
int hashCode = activity.hashCode();
if (mResumedActivities.containsKey(hashCode)) {
trackAppPageLeave(mResumedActivities.get(hashCode));
JSONObject properties = mResumedActivities.get(hashCode);
String referrer = properties == null ? "" : properties.optString("$referrer");
long startTime = properties == null ? 0 : properties.optLong(START_TIME);
properties = AopUtil.buildTitleAndScreenName(activity);
properties.put(START_TIME, startTime);
String url = SensorsDataUtils.getScreenUrl(activity);
properties.put("$url", url);
if (!TextUtils.isEmpty(referrer)) {
properties.put("$referrer", referrer);
}
trackAppPageLeave(properties);
mResumedActivities.remove(hashCode);
}
} catch (Exception e) {
Expand Down Expand Up @@ -122,7 +132,7 @@ private void trackActivityStart(Activity activity) {
String url = SensorsDataUtils.getScreenUrl(activity);
properties.put("$url", url);
String referrer = AutoTrackUtils.getLastScreenUrl();
if (!TextUtils.isEmpty(referrer)) {
if (!properties.has("$referrer") && !TextUtils.isEmpty(referrer)) {
properties.put("$referrer", referrer);
}
properties.put(START_TIME, SystemClock.elapsedRealtime());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,19 @@ private void trackAppPageLeave(Object object) {
int hashCode = object.hashCode();
if (mResumedFragments.containsKey(hashCode)) {
JSONObject properties = mResumedFragments.get(hashCode);
mResumedFragments.remove(hashCode);
if (properties != null) {
trackPageLeaveEvent(properties);
long startTime = properties == null ? 0 : properties.optLong(START_TIME);
String referrer = properties == null ? "" : properties.optString("$referrer");

properties = new JSONObject();
AopUtil.getScreenNameAndTitleFromFragment(properties, object, null);
properties.put(START_TIME, startTime);
String url = SensorsDataUtils.getScreenUrl(object);
properties.put("$url", url);
if (!TextUtils.isEmpty(referrer)) {
properties.put("$referrer", referrer);
}
mResumedFragments.remove(hashCode);
trackPageLeaveEvent(properties);
}
} catch (Exception e) {
SALog.printStackTrace(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,8 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL(EVENTS_TIME_INDEX);
db.execSQL(CHANNEL_EVENT_PERSISTENT_TABLE);
}

@Override
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public String getLoginId() {
public String getLoginIdFromLocal() {
try {
PersistentLoginId persistentLoginId = (PersistentLoginId) PersistentLoader.loadPersistent(DbParams.PersistentName.LOGIN_ID);
return (persistentLoginId == null) ? "" : persistentLoginId.get();
return (persistentLoginId == null) ? "" : persistentLoginId.get();
} catch (Exception e) {
SALog.printStackTrace(e);
}
Expand Down Expand Up @@ -366,6 +366,9 @@ public String getIdentitiesFromLocal() {
}

private String decodeIdentities(String identities) {
if (identities == null) {
return null;
}
return Base64Coder.decodeString(identities.substring(identities.indexOf(":") + 1));
}

Expand Down Expand Up @@ -407,7 +410,7 @@ public String getLoginIdKey() {
public String getLoginIdKeyFromLocal() {
try {
LoginIdKeyPersistent loginIdKeyPersistent = (LoginIdKeyPersistent) PersistentLoader.loadPersistent(DbParams.PersistentName.PERSISTENT_LOGIN_ID_KEY);
return (loginIdKeyPersistent == null) ? "" : loginIdKeyPersistent.get();
return (loginIdKeyPersistent == null) ? "" : loginIdKeyPersistent.get();
} catch (Exception e) {
SALog.printStackTrace(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,9 @@ public static String getAndroidID(Context context) {
try {
if (TextUtils.isEmpty(androidID)) {
androidID = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
if (!isValidAndroidId(androidID)) {
androidID = "";
}
}
} catch (Exception e) {
SALog.printStackTrace(e);
Expand Down

0 comments on commit ef67566

Please sign in to comment.