S T G SuperAPPS v9.99.99版本的 MD5 值为:ec866d8c695a659ed10459d6bd169615
以下内容为反编译后的 OneLinkHttpTask.java 源代码,内容仅作参考
package com.appsflyer;
import android.text.TextUtils;
import java.io.IOException;
import java.net.URL;
import java.util.Map;
import javax.net.ssl.HttpsURLConnection;
import org.json.JSONException;
public abstract class OneLinkHttpTask implements Runnable {
protected static String BASE_URL = "https://%sonelink.%s/shortlink-sdk/v1";
static final String NO_CONNECTION_ERROR_MSG = "Can't get one link data";
private static final int WAIT_TIMEOUT = 3000;
private AppsFlyerLibCore afLib;
private HttpsUrlConnectionProvider connectionProvider;
public String oneLinkId;
public static class HttpsUrlConnectionProvider {
final HttpsURLConnection m127(String str) throws IOException {
return (HttpsURLConnection) new URL(str).openConnection();
}
}
public OneLinkHttpTask(AppsFlyerLibCore appsFlyerLibCore) {
this.afLib = appsFlyerLibCore;
}
private void doRequest() {
String str;
Throwable th2;
String str2 = "";
long currentTimeMillis = System.currentTimeMillis() / 1000;
String oneLinkUrl = getOneLinkUrl();
AFLogger.afRDLog("oneLinkUrl: " + oneLinkUrl);
try {
HttpsURLConnection m127 = this.connectionProvider.m127(oneLinkUrl);
m127.addRequestProperty("content-type", "application/json");
m127.addRequestProperty("authorization", HashUtils.getOneLinkAuthorization(currentTimeMillis));
m127.addRequestProperty("af-timestamp", String.valueOf(currentTimeMillis));
m127.setReadTimeout(WAIT_TIMEOUT);
m127.setConnectTimeout(WAIT_TIMEOUT);
initRequest(m127);
int responseCode = m127.getResponseCode();
str = this.afLib.readServerResponse(m127);
try {
if (responseCode == 200) {
AFLogger.afInfoLog("Status 200 ok");
} else {
str2 = "Response code = " + responseCode + " content = " + str;
}
} catch (Throwable th3) {
th2 = th3;
AFLogger.afErrorLog("Error while calling " + oneLinkUrl, th2);
str2 = "Error while calling " + oneLinkUrl + " stacktrace: " + th2.toString();
if (!TextUtils.isEmpty(str2)) {
}
}
} catch (Throwable th4) {
str = "";
th2 = th4;
}
if (!TextUtils.isEmpty(str2)) {
AFLogger.afInfoLog("Connection call succeeded: " + str);
handleResponse(str);
return;
}
AFLogger.afWarnLog("Connection error: " + str2);
onErrorResponse();
}
public static void setUrl(Map<String, String> map) {
for (Map.Entry<String, String> entry : map.entrySet()) {
if ("onelink".equals(entry.getKey())) {
BASE_URL = entry.getValue();
}
}
}
protected abstract String getOneLinkUrl();
protected abstract void handleResponse(String str);
protected abstract void initRequest(HttpsURLConnection httpsURLConnection) throws JSONException, IOException;
protected abstract void onErrorResponse();
@Override
public void run() {
doRequest();
}
public void setConnProvider(HttpsUrlConnectionProvider httpsUrlConnectionProvider) {
this.connectionProvider = httpsUrlConnectionProvider;
}
}