导航菜单

页面标题

页面副标题

Biko v2.0.23 - Ctry.java 源代码

正在查看: Biko v2.0.23 应用的 Ctry.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package q;

import android.content.Context;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.text.TextUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import okhttp3.MediaType;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import org.json.JSONObject;
import org.shadow.apache.commons.lang3.StringUtils;
import p012throws.Ccase;
import p012throws.Ccatch;
import s.Cfor;
import tech.sud.logger.LogUtils;
import tech.sud.mgp.base.ThreadUtils;
import tech.sud.mgp.core.GameInfo;
import tech.sud.mgp.core.ISudListenerGetMGInfo;
import tech.sud.mgp.core.ISudListenerInitSDK;
import tech.sud.mgp.logger.SudLogger;

public class Ctry implements Cbreak {

    public static final String f97catch = p005static.Cdo.m44do(Ctry.class, do.do.do("SudMGP "));

    public static final String[] f98class = {"https://dev-fqs.sudden.ltd/", "https://dev-fqs.sud.ltd/"};

    public static final String[] f99const = {"https://fat-fqs.sudden.ltd/", "https://fat-fqs.sudcdn.cloud/", "https://fat-fqs.sud.ltd/"};

    public static final String[] f100final = {"https://sim-fqs.sudden.ltd/", "https://sim-fqs.sudcdn.cloud/", "https://sim-fqs.sud.ltd/"};

    public static final String[] f101super = {"https://fqs.sudden.ltd/", "https://fqs.sudcdn.cloud/", "https://fqs.sud.ltd/"};

    public Map<Long, GameInfo> f102break;

    public final HandlerThread f105else;

    public String f107goto;

    public List<GameInfo> f110this;

    public boolean f104do = false;

    public String f108if = "";

    public String f106for = "";

    public String f109new = "";

    public String f111try = "";

    public String f103case = "";

    public class Cdo implements Runnable {

        public final long f113do;

        public final long f114for;

        public final String f115if;

        public final Looper f116new;

        public final ISudListenerGetMGInfo f117try;

        public class RunnableC0002do implements Runnable {

            public final int f118do;

            public final String f119for;

            public final GameInfo f120if;

            public RunnableC0002do(int i, GameInfo gameInfo, String str) {
                this.f118do = i;
                this.f120if = gameInfo;
                this.f119for = str;
            }

            @Override
            public void run() {
                Cdo cdo = Cdo.this;
                if (cdo.f117try != null) {
                    if (this.f118do == 0) {
                        Ctry ctry = Ctry.this;
                        long j = cdo.f113do;
                        ctry.f102break.put(Long.valueOf(j), this.f120if);
                        Cdo.this.f117try.onSuccess(this.f120if);
                        return;
                    }
                    GameInfo gameInfo = Ctry.this.f102break.get(Long.valueOf(cdo.f113do));
                    if (gameInfo != null) {
                        Cdo.this.f117try.onSuccess(gameInfo);
                    } else {
                        Cdo.this.f117try.onFailure(this.f118do, this.f119for);
                    }
                }
            }
        }

        public Cdo(long j, String str, long j2, Looper looper, ISudListenerGetMGInfo iSudListenerGetMGInfo) {
            this.f113do = j;
            this.f115if = str;
            this.f114for = j2;
            this.f116new = looper;
            this.f117try = iSudListenerGetMGInfo;
        }

        @Override
        public void run() {
            GameInfo gameInfo = new GameInfo();
            x.Cdo cdo = new x.Cdo("getMGInfo");
            cdo.f552else = String.valueOf(this.f113do);
            Cfor cfor = new Cfor();
            cdo.f553final = cfor;
            int i = 0;
            String str = null;
            try {
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("sdk_token", this.f115if);
                jSONObject.put("mg_id", this.f113do);
                jSONObject.put("client_version", this.f114for);
                Cbreak cbreak = w.Cif.f507do;
                jSONObject.put("platform", 2);
                jSONObject.put("uengine_version", "2020.3.48f1c1");
                String jSONObject2 = jSONObject.toString();
                Ctry ctry = Ctry.this;
                JSONObject jSONObject3 = new JSONObject(Ctry.m14do(ctry, ctry.f109new, jSONObject2, cdo.f554for, cfor));
                i = jSONObject3.getInt("ret_code");
                str = jSONObject3.getString("ret_msg");
                Ctry.m18do(Ctry.this, jSONObject3, gameInfo);
            } catch (Exception e) {
                e.printStackTrace();
                if (i == 0) {
                    i = v.Cfor.m177do(e);
                    str = e.toString();
                }
            }
            cdo.f565try = i;
            if (str != null) {
                cdo.f547case = str;
            }
            String str2 = x.Cif.f570do;
            ThreadUtils.postUITask(new x.Cfor(cdo.toString(), cdo.f551do, i));
            Ctry.m17do(Ctry.this, this.f116new, new RunnableC0002do(i, gameInfo, str));
        }
    }

    public interface Cif {
    }

    public Ctry() {
        HandlerThread handlerThread = new HandlerThread("mgThread");
        this.f105else = handlerThread;
        this.f107goto = "";
        this.f110this = new ArrayList(0);
        this.f102break = new HashMap();
        handlerThread.start();
        m26if();
    }

    public static String m14do(Ctry ctry, String str, String str2, String str3, Cfor cfor) {
        ctry.getClass();
        String string = ((ResponseBody) Objects.requireNonNull(q.Cdo.f63if.newCall(m15do(str3, cfor).url(str).post(RequestBody.create(MediaType.get("application/json; charset=utf-8"), str2)).build()).execute().body())).string();
        ThreadUtils.postUITask(new Cthis(ctry, str, str3));
        return string;
    }

    public final String m20do(String[] strArr, int i) {
        if (strArr != null && strArr.length != 0) {
            int i2 = i > 0 ? i - 1 : 0;
            if (i2 < strArr.length) {
                return strArr[i2];
            }
        }
        return null;
    }

    public void m22do() {
        this.f104do = false;
        this.f108if = "";
        this.f106for = "";
        this.f109new = "";
        this.f111try = "";
        this.f103case = "";
        this.f107goto = "";
        this.f110this.clear();
        this.f102break.clear();
    }

    public final void m24do(Runnable runnable) {
        new Handler(this.f105else.getLooper()).post(runnable);
    }

    public final void m26if() {
        q.Cdo.f62do.f159for = 4;
        int i = w.Cif.f514try;
        s.Cif.f157new = i == 4 || i == 3;
    }

    public static void m17do(Ctry ctry, Looper looper, Runnable runnable) {
        ctry.getClass();
        new Handler(looper).post(runnable);
    }

    public static void m18do(Ctry ctry, JSONObject jSONObject, GameInfo gameInfo) {
        ctry.getClass();
        JSONObject jSONObject2 = jSONObject.getJSONObject("data").getJSONObject("mg_info");
        gameInfo.mgId = jSONObject2.getLong("mg_id");
        gameInfo.name = ctry.m21do(jSONObject2.getJSONObject("name")).m218do(w.Cif.f509for);
        gameInfo.version = jSONObject2.getString("version");
        gameInfo.orientation = jSONObject2.getInt("orientation");
        gameInfo.screenMode = jSONObject2.getInt("screen_mode");
        gameInfo.url = jSONObject2.getString("url");
        gameInfo.eUrl = jSONObject2.getString("eurl");
        if (jSONObject2.has("auturl")) {
            gameInfo.autUrl = jSONObject2.getString("auturl");
        }
        gameInfo.appID = jSONObject2.getString("game_app_id");
        gameInfo.hash = jSONObject2.getString("hash");
        gameInfo.engine = jSONObject2.getInt("engine");
        if (jSONObject2.has("unity_framework_type")) {
            gameInfo.unityFrameworkType = jSONObject2.getInt("unity_framework_type");
        }
        gameInfo.require = jSONObject2.getString("require").split(";");
        gameInfo.bigLoadingPic = ctry.m21do(jSONObject2.getJSONObject("big_loading_pic")).m218do(w.Cif.f509for);
        gameInfo.dynamicConfig = jSONObject2.has("dynamic_config") ? jSONObject2.getJSONObject("dynamic_config").toString() : "{}";
        gameInfo.clientVersion = jSONObject2.getLong("client_version");
    }

    public static Request.Builder m15do(String str, Cfor cfor) {
        Request.Builder addHeader = new Request.Builder().addHeader("sud-sdk-version", "1.4.6.1211").addHeader("sud-sdk-version-alias", "v1.4.6.1211-lite");
        Cbreak cbreak = w.Cif.f507do;
        Request.Builder addHeader2 = addHeader.addHeader("sud-sdk-platform", String.valueOf(2)).addHeader("sud-sdk-app-id", w.Cif.f506case).addHeader("sud-sdk-bundle-id", w.Cif.f510goto).addHeader("sud-sdk-trace-id", w.Cif.f513this).addHeader("sud-sdk-request-id", str).addHeader("sud-sdk-user-id", x.Cif.f570do).addHeader("sud-sdk-sud-is-dynamic", String.valueOf(true)).addHeader("sud-sdk-et-is-dynamic", String.valueOf(true)).addHeader("Referer", w.Cfor.m219do()).addHeader("sud-device-brand", Ccatch.m116do(p012throws.Cfor.m119do())).addHeader("sud-os-version", p012throws.Cfor.m123if()).addHeader("sud-device-id", p012throws.Cfor.m122for());
        addHeader2.tag(Cfor.class, cfor);
        return addHeader2;
    }

    public final void m25do(String str, int i, final Cif cif) {
        String m20do;
        String str2 = this.f108if;
        if (str2 != null && !str2.isEmpty()) {
            ((Cfor) cif).m13do();
            return;
        }
        int i2 = w.Cif.f514try;
        if (i2 == 4) {
            m20do = m20do(f98class, i);
        } else {
            m20do = i2 == 3 ? m20do(f99const, i) : i2 == 2 ? m20do(f100final, i) : m20do(f101super, i);
        }
        LogUtils.file("HttpService", "getFQSInfo baseUrl:" + m20do);
        SudLogger.d(f97catch, "getFQSInfo baseUrl:" + m20do);
        final String str3 = m20do + Ccase.m114do(str);
        final Looper myLooper = Looper.myLooper();
        final x.Cdo cdo = new x.Cdo("getFQSInfo");
        final Cfor cfor = new Cfor();
        cdo.f553final = cfor;
        m24do(new Runnable() {
            @Override
            public final void run() {
                Ctry.this.m16do(str3, cdo, cfor, myLooper, cif);
            }
        });
    }

    public void m23do(long j, ISudListenerGetMGInfo iSudListenerGetMGInfo) {
        if (!this.f104do) {
            if (iSudListenerGetMGInfo != null) {
                iSudListenerGetMGInfo.onFailure(-10103, "Please call initSDK first successfully");
            }
        } else {
            GameInfo gameInfo = this.f102break.get(Long.valueOf(j));
            long j2 = gameInfo != null ? gameInfo.clientVersion : 0L;
            m24do(new Cdo(j, this.f107goto, j2, Looper.myLooper(), iSudListenerGetMGInfo));
        }
    }

    public void m19do(v.Cdo cdo, String str, Cif cif) {
        int i;
        if (cif == null) {
            return;
        }
        if (!TextUtils.isEmpty(str)) {
            this.f108if = str;
            ((Cfor) cif).m13do();
            return;
        }
        StringBuilder sb = do.do.do("getFQSInfo fail appId=");
        sb.append(w.Cif.f506case);
        StringBuilder sb2 = new StringBuilder(sb.toString());
        StringBuilder sb3 = do.do.do(" isTestEnv=");
        sb3.append(w.Cif.f511if);
        sb2.append(sb3.toString());
        sb2.append(StringUtils.SPACE);
        sb2.append(" ret_code=" + cdo.f379do);
        sb2.append(" null == getSDKTokenUrl || getSDKTokenUrl.isEmpty(), Please contact SUD, Open production environment service");
        String str2 = cdo.f380if;
        if (str2 != null) {
            sb2.append(str2);
        }
        int i2 = cdo.f379do;
        String sb4 = sb2.toString();
        Cfor cfor = (Cfor) cif;
        int i3 = cfor.f66case;
        if (i3 > 0 && (i = cfor.f68else) < i3) {
            Ctry ctry = cfor.f70goto;
            Context context = cfor.f67do;
            String str3 = cfor.f71if;
            String str4 = cfor.f69for;
            boolean z2 = cfor.f72new;
            ISudListenerInitSDK iSudListenerInitSDK = cfor.f73try;
            int i4 = i + 1;
            ctry.getClass();
            ctry.m25do(str3, i4, new Cfor(ctry, context, str3, str4, z2, iSudListenerInitSDK, i3, i4));
            return;
        }
        cfor.f73try.onFailure(i2, sb4);
    }

    public void m16do(String str, x.Cdo cdo, Cfor cfor, Looper looper, final Cif cif) {
        String str2;
        String string;
        final String str3 = "";
        final v.Cdo cdo2 = new v.Cdo();
        try {
            cdo2.f379do = 0;
            cdo2.f380if = "success";
            String str4 = cdo.f554for;
            string = ((ResponseBody) Objects.requireNonNull(q.Cdo.f63if.newCall(m15do(str4, cfor).url(str).get().build()).execute().body())).string();
            ThreadUtils.postUITask(new Cgoto(this, str, str4));
        } catch (Exception e) {
            e = e;
            str2 = "";
        }
        try {
            str3 = new JSONObject(string).getString("url");
            if (TextUtils.isEmpty(str3)) {
                cdo2.f379do = -1;
                cdo2.f380if = "url is null or empty";
            }
        } catch (Exception e2) {
            e = e2;
            String str5 = str3;
            str3 = string;
            str2 = str5;
            e.printStackTrace();
            if (cdo2.f379do == 0) {
                cdo2.f379do = v.Cfor.m177do(e);
                cdo2.f380if = e.toString();
            }
            cdo.getClass();
            if (str3 != null) {
                cdo.f559new = str3;
            }
            cdo.f565try = cdo2.f379do;
            String str6 = cdo2.f380if;
            if (str6 != null) {
                cdo.f547case = str6;
            }
            str3 = str2;
            String str7 = x.Cif.f570do;
            ThreadUtils.postUITask(new x.Cfor(cdo.toString(), cdo.f551do, cdo.f565try));
            new Handler(looper).post(new Runnable() {
                @Override
                public final void run() {
                    Ctry.this.m19do(cdo2, str3, cif);
                }
            });
        }
        String str72 = x.Cif.f570do;
        ThreadUtils.postUITask(new x.Cfor(cdo.toString(), cdo.f551do, cdo.f565try));
        new Handler(looper).post(new Runnable() {
            @Override
            public final void run() {
                Ctry.this.m19do(cdo2, str3, cif);
            }
        });
    }

    public final w.Cdo m21do(JSONObject jSONObject) {
        w.Cdo cdo = new w.Cdo();
        Iterator<String> keys = jSONObject.keys();
        while (keys.hasNext()) {
            String next = keys.next();
            cdo.f505do.put(next, jSONObject.getString(next));
        }
        return cdo;
    }
}