Skip to content

Commit

Permalink
4.4.12版本更新
Browse files Browse the repository at this point in the history
  • Loading branch information
wp committed Jul 16, 2020
1 parent 7df4a14 commit 42af0f5
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ans-sdk/analysys_core/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
-keep public interface com.analysys.AnalysysAgent$AnalysysNetworkType{
*;
}
-keep public interface com.analysys.ObserverListener{
*;
}
-keep class com.analysys.ANSAutoPageTracker{
*;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@ public static void setUploadURL(Context context, String url) {
AgentProcess.getInstance().setUploadURL(url);
}

/**
* 设置时间和用户属性的监听
*
* @param context
* @param listener
*/
public static void setObserverListener(Context context, ObserverListener listener) {
AgentProcess.getInstance().setObserverListener(listener);
}

/**
* 设置上传间隔时间
* debug 设置为 0 时,数据上传时间间隔,单位:秒
Expand Down Expand Up @@ -686,4 +696,3 @@ public interface AnalysysNetworkType {
int AnalysysNetworkALL = 0xFF;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.analysys;

/**
* Create by Kevin on 2019-08-28
* Describe:
*/
public interface ObserverListener {
/**
* @param key 用户属性的key值,是上传的时候key值,比如用户ID是xwho
* @param value 用户属性值
*/
void onUserProfile(final String key, final String value);

/**
* @param event 完整的用户上传的json数据
*/
void onEventMessage(final String event);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.analysys.easytouch;

import com.analysys.ObserverListener;
import com.analysys.utils.AnalysysUtil;
import com.analysys.utils.CommonUtils;

/**
* Create by Kevin on 2020/6/3
* Describe:
*/
public class EasytouchProcess {

private final static String OBSERVER_XWHO = "xwho";

private static EasytouchProcess sInstance;

private ObserverListener listener;

private EasytouchProcess() {
}

public static EasytouchProcess getInstance() {
if (sInstance == null) {
synchronized (EasytouchProcess.class) {
if (sInstance == null) {
sInstance = new EasytouchProcess();
}
}
}
return sInstance;
}

public void setObserverListener(ObserverListener listener) {
this.listener = listener;
if (this.listener != null) {
this.listener.onUserProfile(OBSERVER_XWHO, CommonUtils.getUserId(AnalysysUtil.getContext()));
}
}

public void setXwho(final String xwho) {
if (this.listener != null) {
this.listener.onUserProfile(OBSERVER_XWHO, xwho);
}
}

public void setEventMessage(final String message) {
if (this.listener != null) {
this.listener.onEventMessage(message);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import com.analysys.AnsIDControl;
import com.analysys.AnsRamControl;
import com.analysys.AutomaticAcquisition;
import com.analysys.ObserverListener;
import com.analysys.easytouch.EasytouchProcess;
import com.analysys.hybrid.HybridBridge;
import com.analysys.network.UploadManager;
import com.analysys.push.PushListener;
Expand Down Expand Up @@ -166,6 +168,9 @@ public Object call() throws Exception {
});
}

public void setObserverListener(ObserverListener listener) {
EasytouchProcess.getInstance().setObserverListener(listener);
}
/**
* debug 信息处理
*/
Expand Down Expand Up @@ -408,6 +413,7 @@ public void run() {
return;
}
// CommonUtils.setIdFile(context, Constants.SP_DISTINCT_ID, distinctId);
EasytouchProcess.getInstance().setXwho(distinctId);
UserInfo.setDistinctID(distinctId);

}
Expand Down Expand Up @@ -458,6 +464,7 @@ public void run() {
currentTime,Constants.API_ALIAS, Constants.ALIAS, aliasMap, null);

if (!CommonUtils.isEmpty(eventData)) {
EasytouchProcess.getInstance().setXwho(aliasId);
trackEvent(context, Constants.API_ALIAS, Constants.ALIAS, eventData);
sendProfileSetOnce(context, 0,currentTime);
} else {
Expand Down Expand Up @@ -496,6 +503,7 @@ public void run() {
currentTime,Constants.API_ALIAS, Constants.ALIAS, aliasMap, null);

if (!CommonUtils.isEmpty(eventData)) {
EasytouchProcess.getInstance().setXwho(aliasId);
trackEvent(context, Constants.API_ALIAS, Constants.ALIAS, eventData);
sendProfileSetOnce(context, 0,currentTime);
} else {
Expand Down Expand Up @@ -1607,6 +1615,7 @@ private void trackEvent(Context context, String apiName,
if (LogBean.getCode() == Constants.CODE_SUCCESS) {
LogPrompt.showLog(apiName, true);
}
EasytouchProcess.getInstance().setEventMessage(eventData.toString());
UploadManager.getInstance(context).sendManager(eventName, eventData);
}
}
Expand Down
2 changes: 1 addition & 1 deletion config.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ext {

version = '4.4.11'
version = '4.4.12'



Expand Down

0 comments on commit 42af0f5

Please sign in to comment.