iKredit v1.2.0.3版本的 MD5 值为:2c00c5c79eecbd6be4c3c546c28d778d

以下内容为反编译后的 CreateOneLinkHttpTask.java 源代码,内容仅作参考


package com.appsflyer;

import android.content.Context;
import com.appsflyer.share.Constants;
import com.appsflyer.share.LinkGenerator;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
import javax.net.ssl.HttpsURLConnection;
import org.json.JSONException;
import org.json.JSONObject;

public class CreateOneLinkHttpTask extends OneLinkHttpTask {

    private Map<String, String> f139;

    private String f140;

    private boolean f141;

    private String f142;

    private ResponseListener f143;

    private String f144;

    private Context f145;

    public interface ResponseListener {
        void onResponse(String str);

        void onResponseError(String str);
    }

    public CreateOneLinkHttpTask(String str, Map<String, String> map, AppsFlyerLibCore appsFlyerLibCore, Context context, boolean z) {
        this.f142 = "";
        this.f141 = false;
        this.f141 = z;
        this.f145 = context;
        if (context != null) {
            this.f142 = context.getPackageName();
        } else {
            AFLogger.afWarnLog("CreateOneLinkHttpTask: context can't be null");
        }
        this.f152 = str;
        this.f140 = "-1";
        this.f139 = map;
    }

    public void setListener(ResponseListener responseListener) {
        this.f143 = responseListener;
    }

    public void setBrandDomain(String str) {
        this.f144 = str;
    }

    @Override
    protected final void mo139(HttpsURLConnection httpsURLConnection) throws JSONException, IOException {
        if (this.f141) {
            return;
        }
        httpsURLConnection.setRequestMethod("POST");
        httpsURLConnection.setDoInput(true);
        httpsURLConnection.setDoOutput(true);
        httpsURLConnection.setUseCaches(false);
        JSONObject jSONObject = new JSONObject();
        JSONObject jSONObject2 = new JSONObject(this.f139);
        jSONObject.put("ttl", this.f140);
        jSONObject.put("data", jSONObject2);
        String str = this.f144;
        if (str != null) {
            jSONObject.put("brand_domain", str);
        }
        httpsURLConnection.connect();
        DataOutputStream dataOutputStream = new DataOutputStream(httpsURLConnection.getOutputStream());
        dataOutputStream.writeBytes(jSONObject.toString());
        dataOutputStream.flush();
        dataOutputStream.close();
    }

    @Override
    protected final String mo137() {
        StringBuilder sb = new StringBuilder();
        sb.append(ServerConfigHandler.getUrl("https://%sonelink.%s/shortlink-sdk/v1"));
        sb.append(Constants.URL_PATH_DELIMITER);
        sb.append(this.f152);
        return sb.toString();
    }

    @Override
    protected final void mo138(String str) {
        try {
            JSONObject jSONObject = new JSONObject(str);
            Iterator<String> keys = jSONObject.keys();
            while (keys.hasNext()) {
                this.f143.onResponse(jSONObject.optString(keys.next()));
            }
        } catch (JSONException e) {
            this.f143.onResponseError("Can't parse one link data");
            AFLogger.afErrorLog("Error while parsing to json ".concat(String.valueOf(str)), e);
        }
    }

    @Override
    protected final void mo140() {
        LinkGenerator addParameters = new LinkGenerator(Constants.USER_INVITE_LINK_TYPE).setBaseURL(this.f152, AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.ONELINK_DOMAIN), this.f142).addParameter(Constants.URL_SITE_ID, this.f142).addParameters(this.f139);
        String string = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.APP_USER_ID);
        if (string != null) {
            addParameters.setReferrerCustomerId(string);
        }
        this.f143.onResponse(addParameters.generateLink());
    }
}