Chomp v9.11版本的 MD5 值为:8dd6a6008d51ff2822fc9bfb17203c9f
以下内容为反编译后的 BabayagaTask.java 源代码,内容仅作参考
package com.uservoice.uservoicesdk.babayaga;
import android.net.http.AndroidHttpClient;
import android.os.AsyncTask;
import android.util.Base64;
import android.util.Log;
import com.amazon.aps.shared.metrics.model.ApsMetricsDataMap;
import com.smaato.sdk.core.dns.DnsName;
import com.uservoice.uservoicesdk.Session;
import com.uservoice.uservoicesdk.UserVoice;
import com.uservoice.uservoicesdk.babayaga.Babayaga;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URLEncoder;
import java.util.Date;
import java.util.Map;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.util.EntityUtils;
import org.json.JSONObject;
public class BabayagaTask extends AsyncTask<String, String, Void> {
private final String event;
private final Map<String, Object> eventProps;
private final Map<String, Object> traits;
private final String uvts;
public BabayagaTask(String str, String str2, Map<String, Object> map, Map<String, Object> map2) {
this.event = str;
this.uvts = str2;
this.traits = map;
this.eventProps = map2;
}
@Override
public Void doInBackground(String... strArr) {
AndroidHttpClient androidHttpClient;
String str;
String str2;
HttpEntity entity;
StatusLine statusLine;
AndroidHttpClient androidHttpClient2 = null;
try {
JSONObject jSONObject = new JSONObject();
Map<String, Object> map = this.traits;
if (map != null && !map.isEmpty()) {
jSONObject.put(ApsMetricsDataMap.APSMETRICS_FIELD_URL, new JSONObject(this.traits));
}
Map<String, Object> map2 = this.eventProps;
if (map2 != null && !map2.isEmpty()) {
jSONObject.put("e", this.eventProps);
}
if (Session.getInstance().getClientConfig() != null) {
str = Session.getInstance().getClientConfig().getSubdomainId();
str2 = ApsMetricsDataMap.APSMETRICS_FIELD_TIMESTAMP;
} else {
str = Session.getInstance().getConfig().getSite().split(DnsName.ESCAPED_DOT)[0];
str2 = "t/k";
}
StringBuilder sb2 = new StringBuilder(String.format("https://%s/%s/%s/%s/%s", Babayaga.DOMAIN, str2, str, this.event.equals(Babayaga.Event.VIEW_APP) ? Babayaga.EXTERNAL_CHANNEL : Babayaga.CHANNEL, this.event));
if (this.uvts != null) {
sb2.append("/");
sb2.append(this.uvts);
}
sb2.append("/track.js?_=");
sb2.append(new Date().getTime());
sb2.append("&c=_");
if (jSONObject.length() != 0) {
sb2.append("&d=");
try {
sb2.append(URLEncoder.encode(Base64.encodeToString(jSONObject.toString().getBytes(), 2), "UTF-8"));
} catch (UnsupportedEncodingException e10) {
throw new RuntimeException(e10);
}
}
Log.d("UV", sb2.toString());
HttpGet httpGet = new HttpGet();
httpGet.setURI(new URI(sb2.toString()));
androidHttpClient = AndroidHttpClient.newInstance(String.format("uservoice-android-%s", UserVoice.getVersion()), Session.getInstance().getContext());
try {
try {
HttpResponse execute = androidHttpClient.execute(httpGet);
entity = execute.getEntity();
statusLine = execute.getStatusLine();
} catch (Exception e11) {
e = e11;
e.printStackTrace();
Log.e("UV", String.format("%s: %s", e.getClass().getName(), e.getMessage()));
}
} catch (Throwable th) {
th = th;
androidHttpClient2 = androidHttpClient;
if (androidHttpClient2 != null) {
androidHttpClient2.close();
}
throw th;
}
} catch (Exception e12) {
e = e12;
androidHttpClient = null;
e.printStackTrace();
Log.e("UV", String.format("%s: %s", e.getClass().getName(), e.getMessage()));
} catch (Throwable th2) {
th = th2;
if (androidHttpClient2 != null) {
}
throw th;
}
if ((statusLine != null ? statusLine.getStatusCode() : 0) != 200) {
androidHttpClient.close();
return null;
}
String entityUtils = entity != null ? EntityUtils.toString(entity) : null;
if (entityUtils != null && entityUtils.length() > 0) {
Babayaga.setUvts(new JSONObject(entityUtils.substring(2, entityUtils.length() - 2)).getString("uvts"));
}
androidHttpClient.close();
return null;
}
}