导航菜单

页面标题

页面副标题

凤凰之城 v1.0.3 - ServerResponse.java 源代码

正在查看: 凤凰之城 v1.0.3 应用的 ServerResponse.java JAVA 源代码文件

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


package com.octopus.ad.internal.network;

import android.annotation.SuppressLint;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.content.MutableContextWrapper;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Pair;
import android.view.View;
import android.webkit.WebView;
import com.octopus.ad.NativeAdResponse;
import com.octopus.ad.Octopus;
import com.octopus.ad.R;
import com.octopus.ad.internal.j;
import com.octopus.ad.internal.k;
import com.octopus.ad.internal.n;
import com.octopus.ad.internal.o;
import com.octopus.ad.internal.r;
import com.octopus.ad.internal.s;
import com.octopus.ad.internal.utilities.HTTPGet;
import com.octopus.ad.internal.utilities.HaoboLog;
import com.octopus.ad.internal.utilities.StringUtil;
import com.octopus.ad.internal.utilities.UrlUtil;
import com.octopus.ad.internal.utilities.ViewUtil;
import com.octopus.ad.internal.utilities.WebviewUtil;
import com.octopus.ad.model.ComplianceInfo;
import com.octopus.ad.model.c;
import com.octopus.ad.model.e;
import com.octopus.ad.model.g;
import com.octopus.ad.model.h;
import com.octopus.ad.model.i;
import com.octopus.ad.utils.OctUtil;
import com.octopus.ad.utils.ThreadUtils;
import com.octopus.ad.utils.b.d;
import com.octopus.ad.utils.b.f;
import com.sigmob.sdk.base.mta.PointParamKey;
import com.tencent.mm.opensdk.modelbiz.WXLaunchMiniProgram;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import io.flutter.plugin.platform.PlatformPlugin;
import java.io.File;
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.json.JSONObject;

@SuppressLint({"NewApi"})
public class ServerResponse {
    private boolean A;
    private int B;
    private AdLogoInfo C;
    private AdLogoInfo D;
    private boolean E;
    private boolean F;
    private boolean G;
    private boolean H;
    private boolean I;
    private int J;
    private int K;
    private int L;
    private String M;
    private String N;
    private int O;
    private int P;
    private boolean Q;
    private boolean R;
    private boolean S;
    private boolean T;
    private Boolean U;
    private boolean V;
    private boolean W;
    private String X;
    private String Y;
    private String Z;
    public String a;
    private List<c.i> aA;
    private String aB;
    private String aC;
    private long aD;
    private n aE;
    private List<Pair<j, String>> aF;
    private String aG;
    private String aH;
    private String aI;
    private String aJ;
    private boolean aK;
    private boolean aL;
    private boolean aM;
    private LinkedList<String> aN;
    private HashMap<String, Object> aO;
    private boolean aP;
    private boolean aQ;
    private boolean aR;
    private long aS;
    private long aT;
    private boolean aU;
    private int aV;
    private boolean aW;
    private boolean aX;
    private String aa;
    private String ab;
    private String ac;
    private String ad;
    private int ae;
    private Map<String, Object> af;
    private com.octopus.ad.a.a ag;
    private com.octopus.ad.internal.nativead.c ah;
    private com.octopus.ad.internal.view.b ai;
    private c.k aj;
    private c.l ak;
    private c.y al;
    private h am;
    private WebView an;
    private e ao;
    private c.b.a ap;
    private int aq;
    private String ar;
    private String as;
    private String at;
    private String au;
    private ComplianceInfo av;
    private i aw;
    private c.b ax;
    private c.o ay;
    private c.w az;
    public String b;
    private g.a c;
    private int d;
    private int e;
    private int f;
    private int g;
    private int h;
    private int i;
    private int j;
    private boolean k;
    private boolean l;
    private boolean m;
    private boolean n;
    private boolean o;
    private boolean p;
    private boolean q;
    private boolean r;
    private boolean s;
    private boolean t;
    private boolean u;
    private boolean v;
    private boolean w;
    private boolean x;
    private int y;
    private int z;

    public static class AdLogoInfo {
        public static int TYPE_PIC = 0;
        public static int TYPE_TEXT = 1;
        public String adurl;
        public int type = 0;

        public String getAdurl() {
            return this.adurl;
        }

        public int getType() {
            return this.type;
        }

        public void setAdurl(String str) {
            this.adurl = str;
        }

        public void setType(int i) {
            this.type = i;
        }
    }

    public ServerResponse(c.t tVar, Map<String, List<String>> map, n nVar, String str) {
        this.d = 0;
        this.e = 1;
        this.f = 0;
        this.g = 0;
        this.h = 0;
        this.i = 0;
        this.j = 0;
        this.k = false;
        this.l = false;
        this.m = false;
        this.n = false;
        this.o = false;
        this.p = true;
        this.q = false;
        this.r = true;
        this.s = false;
        this.t = false;
        this.u = false;
        this.v = false;
        this.w = false;
        this.x = false;
        this.y = 0;
        this.z = 0;
        this.A = false;
        this.B = 0;
        this.C = new AdLogoInfo();
        this.D = new AdLogoInfo();
        this.E = false;
        this.Q = false;
        this.R = false;
        this.S = true;
        this.T = true;
        this.aF = new LinkedList();
        this.aN = new LinkedList<>();
        this.aO = new HashMap<>();
        this.aP = false;
        this.aQ = false;
        this.aV = 0;
        if (tVar == null) {
            HaoboLog.clearLastResponse();
            return;
        }
        HaoboLog.setLastResponse(tVar.toString());
        HaoboLog.d(HaoboLog.httpRespLogTag, HaoboLog.getString(R.string.response_body, HaoboLog.getLastResponse()));
        this.aE = nVar;
        this.Z = str;
        a(tVar);
        af();
    }

    private void af() {
        if (!this.p || this.aN.isEmpty() || "m3u8".equalsIgnoreCase(this.ab)) {
            return;
        }
        ThreadUtils.runOnThreadPool(new Runnable() {
            @Override
            public void run() {
                com.octopus.ad.internal.a.h b = o.a().b();
                Iterator it = ServerResponse.this.aN.iterator();
                while (it.hasNext()) {
                    String str = (String) it.next();
                    if (b != null && !b.b(str)) {
                        InputStream inputStream = null;
                        try {
                            try {
                                inputStream = new URL(b.a(str)).openStream();
                                do {
                                } while (inputStream.read(new byte[1024]) != -1);
                                inputStream.close();
                                try {
                                    inputStream.close();
                                } catch (Exception e) {
                                    f.a("OctopusAd", "An Exception Caught", e);
                                }
                            } catch (Throwable th) {
                                if (inputStream != null) {
                                    try {
                                        inputStream.close();
                                    } catch (Exception e4) {
                                        f.a("OctopusAd", "An Exception Caught", e4);
                                    }
                                }
                                throw th;
                            }
                        } catch (Exception unused) {
                            if (ServerResponse.this.ai != null) {
                                ServerResponse.this.ai.a();
                            }
                            HaoboLog.v(HaoboLog.baseLogTag, "preload fail:" + str);
                            if (inputStream != null) {
                                inputStream.close();
                            }
                        }
                    }
                }
            }
        });
    }

    private void ag() {
        if (!o.a().e() || TextUtils.isEmpty(this.ac)) {
            return;
        }
        o.a().d();
        com.octopus.ad.model.a aVar = new com.octopus.ad.model.a();
        aVar.g(this.M);
        aVar.a(this.Z);
        aVar.f(this.ac);
        o.a().g.put("dpForbid", aVar);
    }

    public int A() {
        return this.z;
    }

    public int B() {
        return this.g;
    }

    public int C() {
        return this.f;
    }

    public int D() {
        return this.e;
    }

    public int E() {
        return this.d;
    }

    public c.o F() {
        return this.ay;
    }

    public c.w G() {
        return this.az;
    }

    public boolean H() {
        return this.u;
    }

    public boolean I() {
        return this.v;
    }

    public boolean J() {
        return this.w;
    }

    public boolean K() {
        return this.x;
    }

    public boolean L() {
        return this.T;
    }

    public Boolean M() {
        return this.U;
    }

    public boolean N() {
        return this.V;
    }

    public boolean O() {
        return this.W;
    }

    public boolean P() {
        return true;
    }

    public String Q() {
        return this.aH;
    }

    public String R() {
        return this.aG;
    }

    public String S() {
        return this.aI;
    }

    public Map<String, Object> T() {
        return this.af;
    }

    public void U() {
        if (this.G) {
            return;
        }
        this.G = true;
        new com.octopus.ad.internal.i(UrlUtil.replaceCloseUrl(o.a().n() + "/sdk/closeUrl?slot_id=${SLOT_ID}&req_id=${REQ_ID}", this.M, this.Z)).execute();
    }

    public boolean V() {
        c.w wVar = this.az;
        return (wVar == null || wVar.b() == null || this.az.b().a() != 1) ? false : true;
    }

    public LinkedList<String> W() {
        return this.aN;
    }

    public g.a X() {
        return this.c;
    }

    public void Y() {
        List<c.z> r;
        c.b bVar = this.ax;
        if (bVar == null || this.aR || (r = bVar.r()) == null) {
            return;
        }
        this.aS = System.currentTimeMillis();
        for (int i = 0; i < r.size(); i++) {
            a(r.get(i).a());
            this.aR = true;
        }
    }

    public void Z() {
        List<c.z> r;
        c.b bVar = this.ax;
        if (bVar == null || this.aU || !this.aR || (r = bVar.r()) == null) {
            return;
        }
        for (int i = 0; i < r.size(); i++) {
            a(r.get(i).b());
            this.aU = true;
        }
    }

    public void aa() {
        List<c.z> r;
        c.b bVar = this.ax;
        if (bVar == null || this.aW || !this.aR || (r = bVar.r()) == null) {
            return;
        }
        this.aT = System.currentTimeMillis();
        for (int i = 0; i < r.size(); i++) {
            a(r.get(i).f());
            this.aW = true;
        }
    }

    public void ab() {
        List<c.z> r;
        c.b bVar = this.ax;
        if (bVar == null || this.aX || !this.aR || (r = bVar.r()) == null) {
            return;
        }
        for (int i = 0; i < r.size(); i++) {
            a(r.get(i).g());
            this.aX = true;
        }
    }

    public void ac() {
        if (this.an != null) {
            ThreadUtils.runOnUIThread(new Runnable() {
                @Override
                public void run() {
                    try {
                        if (ServerResponse.this.an != null) {
                            ServerResponse.this.an.destroy();
                            ServerResponse.this.an = null;
                        }
                    } catch (Exception unused) {
                    }
                }
            });
        } else {
            ab();
        }
    }

    public AdLogoInfo ad() {
        return this.C;
    }

    public AdLogoInfo ae() {
        return this.D;
    }

    public n i() {
        return this.aE;
    }

    public List<Pair<j, String>> j() {
        return this.aF;
    }

    public int k() {
        return this.h;
    }

    public int l() {
        return this.i;
    }

    public int m() {
        return this.K;
    }

    public int n() {
        return this.L;
    }

    public String o() {
        return this.N;
    }

    public long p() {
        return this.aD;
    }

    public boolean q() {
        return this.aP;
    }

    public boolean r() {
        return this.aQ;
    }

    public HashMap<String, Object> s() {
        return this.aO;
    }

    public boolean t() {
        return this.k;
    }

    public boolean u() {
        return this.o;
    }

    public boolean v() {
        return this.p;
    }

    public boolean w() {
        return this.r;
    }

    public boolean x() {
        return this.s;
    }

    public boolean y() {
        return this.t;
    }

    public int z() {
        return this.y;
    }

    public void b(String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        try {
            Context k = o.a().k();
            ClipboardManager clipboardManager = (ClipboardManager) k.getSystemService("clipboard");
            if (clipboardManager != null) {
                clipboardManager.setPrimaryClip(ClipData.newPlainText("wordText", str));
                a(k);
            }
        } catch (Exception e) {
            f.a("OctopusAd", "An Exception Caught", e);
        }
    }

    public String c() {
        return this.X;
    }

    public String d() {
        return this.Y;
    }

    public String e() {
        return this.ab;
    }

    public c.l f() {
        return this.ak;
    }

    public c.y g() {
        return this.al;
    }

    public NativeAdResponse h() {
        return this.ah;
    }

    private boolean c(c.t tVar) {
        if (tVar.a() > 0) {
            c.v vVar = tVar.u().get(0);
            this.c = vVar.c();
            this.d = vVar.d();
            this.aa = vVar.e();
            this.e = vVar.f() == g.h.PORTRAIT ? 1 : 2;
            this.i = Integer.parseInt(vVar.h());
            this.h = Integer.parseInt(vVar.i());
            if (vVar.j() != null && X() == g.a.ADP_INTERSTITIAL) {
                c.f j = vVar.j();
                this.f = Integer.parseInt(j.a());
                this.g = Integer.parseInt(j.b());
            } else if (!StringUtil.isEmpty(vVar.b()) && X() == g.a.ADP_REWARD) {
                a("REWARD_ITEM", vVar.b());
            }
            this.M = vVar.a();
            this.k = vVar.x();
            this.l = vVar.y();
            this.m = vVar.z();
            this.n = vVar.A();
            this.ad = vVar.F();
            this.ae = vVar.G();
            this.o = vVar.B();
            this.p = vVar.v();
            this.q = vVar.D();
            this.r = vVar.w();
            this.s = vVar.m();
            this.t = vVar.n();
            this.u = vVar.o();
            this.v = vVar.p();
            this.w = vVar.q();
            this.x = vVar.r();
            this.y = vVar.t();
            this.z = vVar.s();
            this.A = vVar.C();
            this.ay = vVar.k();
            this.az = vVar.l();
            this.O = vVar.H();
            this.L = vVar.g();
            this.j = vVar.u();
            List<c.d> I = vVar.I();
            if (I != null && !I.isEmpty()) {
                this.K = I.get(0).j();
                this.N = I.get(0).k();
                this.aD = I.get(0).c();
            }
            if (this.k && this.i == 0 && this.h == 0) {
                this.i = 720;
                this.h = PlatformPlugin.DEFAULT_SYSTEM_UI;
            }
            if (vVar.J() > 0) {
                int i = 0;
                for (c.d dVar : vVar.I()) {
                    if (i == 0) {
                        this.aC = dVar.b();
                        f.a("OctopusAd", "mAdid = " + this.aC);
                    }
                    if (dVar.i() <= 0 || dVar.h().get(0) == null) {
                        this.aB = dVar.a();
                        c.C0019c f = dVar.f();
                        if (f != null) {
                            if (!TextUtils.isEmpty(f.a())) {
                                this.C.setAdurl(f.a());
                                this.C.setType(AdLogoInfo.TYPE_PIC);
                            } else {
                                this.C.setAdurl(f.b());
                                this.C.setType(AdLogoInfo.TYPE_TEXT);
                            }
                            if (!TextUtils.isEmpty(f.c())) {
                                this.D.setAdurl(f.c());
                                this.D.setType(AdLogoInfo.TYPE_PIC);
                            } else {
                                this.D.setAdurl(f.d());
                                this.D.setType(AdLogoInfo.TYPE_TEXT);
                            }
                        }
                        if (dVar.e() > 0) {
                            for (c.a aVar : dVar.g()) {
                                if (this.p) {
                                    for (int i4 = 0; i4 < aVar.d(); i4++) {
                                        if (!StringUtil.isEmpty(aVar.c().get(i4).a())) {
                                            this.aN.add(aVar.c().get(i4).a());
                                        }
                                    }
                                }
                                if (aVar.d() > 0) {
                                    String a = aVar.c().get(0).a();
                                    if (aVar.a() != g.f.RENDER_VIDEO && aVar.a() != g.f.RENDER_VAST_VIDEO) {
                                        this.aF.add(Pair.create(j.IMAGE, a));
                                    } else {
                                        this.aF.add(Pair.create(j.VIDEO, a));
                                    }
                                }
                            }
                        }
                        if (dVar.d() != null) {
                            c.b d = dVar.d();
                            a(d);
                            c.i k = d.k();
                            if (k != null && !TextUtils.isEmpty(k.a())) {
                                this.a = k.a();
                            }
                            if (k != null && !TextUtils.isEmpty(k.b())) {
                                this.b = k.b();
                            }
                        }
                    }
                    i++;
                    if (!this.aF.isEmpty()) {
                        break;
                    }
                }
            }
        } else {
            HaoboLog.e(HaoboLog.httpRespLogTag, HaoboLog.getString(R.string.blank_ad));
        }
        if (this.aF.isEmpty()) {
            return false;
        }
        this.aP = true;
        return true;
    }

    private boolean d(c.t tVar) {
        if (tVar.a() > 0) {
            for (c.v vVar : tVar.u()) {
                this.p = vVar.v();
                if (vVar.J() > 0) {
                    for (c.d dVar : vVar.I()) {
                        if (dVar.i() <= 0 || dVar.h().get(0) == null) {
                            if (dVar.e() > 0) {
                                for (c.a aVar : dVar.g()) {
                                    if (this.p) {
                                        for (int i = 0; i < aVar.d(); i++) {
                                            if (!StringUtil.isEmpty(aVar.c().get(i).a())) {
                                                this.aN.add(aVar.c().get(i).a());
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        if (this.aN.isEmpty()) {
            return false;
        }
        this.aP = true;
        return true;
    }

    private boolean e(c.t tVar) {
        if (tVar.a() > 0) {
            c.v vVar = tVar.u().get(0);
            this.c = vVar.c();
            this.d = vVar.d();
            this.aa = vVar.e();
            this.e = vVar.f() == g.h.PORTRAIT ? 1 : 2;
            this.i = Integer.parseInt(vVar.h());
            this.h = Integer.parseInt(vVar.i());
            this.L = vVar.g();
            List<c.d> I = vVar.I();
            if (I != null && !I.isEmpty()) {
                this.K = I.get(0).j();
                this.N = I.get(0).k();
                this.aD = I.get(0).c();
            }
            this.M = vVar.a();
            this.k = vVar.x();
            this.l = vVar.y();
            this.m = vVar.z();
            this.n = vVar.A();
            this.ad = vVar.F();
            this.ae = vVar.G();
            this.o = vVar.B();
            this.p = vVar.v();
            this.q = vVar.D();
            this.r = vVar.w();
            this.s = vVar.m();
            this.t = vVar.n();
            this.u = vVar.o();
            this.v = vVar.p();
            this.w = vVar.q();
            this.x = vVar.r();
            this.y = vVar.t();
            this.z = vVar.s();
            this.A = vVar.C();
            this.ay = vVar.k();
            this.az = vVar.l();
            this.O = vVar.H();
            this.j = vVar.u();
            if (this.k && this.i == 0 && this.h == 0) {
                this.i = 720;
                this.h = PlatformPlugin.DEFAULT_SYSTEM_UI;
            }
            if (vVar.J() > 0) {
                for (c.d dVar : vVar.I()) {
                    if (dVar.i() <= 0 || dVar.h().get(0) == null) {
                        this.aB = dVar.a();
                        if (dVar.e() >= 0) {
                            for (c.a aVar : dVar.g()) {
                                if (this.p) {
                                    for (int i = 0; i < aVar.d(); i++) {
                                        if (!StringUtil.isEmpty(aVar.c().get(i).a())) {
                                            this.aN.add(aVar.c().get(i).a());
                                        }
                                    }
                                }
                                if (aVar.a() == g.f.RENDER_JSON || aVar.a() == g.f.RENDER_VIDEO) {
                                    if (aVar.d() > 0) {
                                        try {
                                            c.C0019c f = dVar.f();
                                            if (f != null) {
                                                if (!TextUtils.isEmpty(f.a())) {
                                                    this.C.setAdurl(f.a());
                                                    this.C.setType(AdLogoInfo.TYPE_PIC);
                                                } else {
                                                    this.C.setAdurl(f.b());
                                                    this.C.setType(AdLogoInfo.TYPE_TEXT);
                                                }
                                                if (!TextUtils.isEmpty(f.c())) {
                                                    this.D.setAdurl(f.c());
                                                    this.D.setType(AdLogoInfo.TYPE_PIC);
                                                } else {
                                                    this.D.setAdurl(f.d());
                                                    this.D.setType(AdLogoInfo.TYPE_TEXT);
                                                }
                                            }
                                            com.octopus.ad.internal.nativead.c a = com.octopus.ad.internal.nativead.c.a(new JSONObject(aVar.b()));
                                            this.ah = a;
                                            a.a(this);
                                            this.ah.c(J());
                                            this.ah.a(n());
                                            this.ah.b(ae());
                                            this.ah.a(ad());
                                            this.ah.b(vVar.E());
                                            if (aVar.a() == g.f.RENDER_VIDEO) {
                                                this.ah.a(true);
                                            }
                                            if (dVar.d() != null) {
                                                a(dVar.d());
                                                c.b d = dVar.d();
                                                this.ah.b(!StringUtil.isEmpty(this.aG) ? this.aG : this.aJ);
                                                this.ah.a(dVar.d());
                                                c.i k = d.k();
                                                if (k != null && !TextUtils.isEmpty(k.a())) {
                                                    this.ah.c(k.a());
                                                }
                                                if (k != null && !TextUtils.isEmpty(k.b())) {
                                                    this.ah.d(k.b());
                                                }
                                                List<c.i> s = d.s();
                                                if (s != null && !s.isEmpty()) {
                                                    for (int i4 = 0; i4 < s.size(); i4++) {
                                                        String b = s.get(i4).b();
                                                        if (!TextUtils.isEmpty(b)) {
                                                            this.ah.d(b);
                                                        }
                                                        String a5 = s.get(i4).a();
                                                        if (!TextUtils.isEmpty(a5)) {
                                                            this.ah.c(a5);
                                                        }
                                                    }
                                                }
                                            }
                                        } catch (Exception e) {
                                            f.a("OctopusAd", "An Exception Caught", e);
                                        }
                                        if (this.ah != null) {
                                            this.aP = true;
                                            return true;
                                        }
                                    } else {
                                        continue;
                                    }
                                }
                            }
                        } else {
                            continue;
                        }
                    }
                }
            }
        } else {
            HaoboLog.e(HaoboLog.httpRespLogTag, HaoboLog.getString(R.string.blank_ad));
        }
        if (this.aF.isEmpty()) {
            return false;
        }
        this.aP = true;
        return true;
    }

    private boolean f(c.t tVar) {
        if (tVar.a() > 0) {
            c.v vVar = tVar.u().get(0);
            List<c.d> I = vVar.I();
            if (I != null && !I.isEmpty()) {
                c.d dVar = I.get(0);
                if (dVar.d() != null) {
                    c.b d = dVar.d();
                    a(d);
                    c.i k = d.k();
                    if (k != null && !TextUtils.isEmpty(k.a())) {
                        this.a = k.a();
                    }
                    if (k != null && !TextUtils.isEmpty(k.b())) {
                        this.b = k.b();
                    }
                }
            }
            this.c = vVar.c();
            this.d = vVar.d();
            this.aa = vVar.e();
            this.e = vVar.f() == g.h.PORTRAIT ? 1 : 2;
            this.h = Integer.parseInt(vVar.h());
            this.i = Integer.parseInt(vVar.i());
            this.L = vVar.g();
            List<c.d> I2 = vVar.I();
            if (I2 != null && !I2.isEmpty()) {
                this.K = I2.get(0).j();
                this.N = I2.get(0).k();
                this.aD = I2.get(0).c();
            }
            this.f = 0;
            this.g = 0;
            if (vVar.j() != null && X() == g.a.ADP_INTERSTITIAL) {
                c.f j = vVar.j();
                this.f = Integer.parseInt(j.a());
                this.g = Integer.parseInt(j.b());
            }
        }
        return false;
    }

    public void a(boolean z) {
        this.E = z;
    }

    public c.b a() {
        return this.ax;
    }

    private void a(c.b bVar) {
        this.ax = bVar;
        this.aA = bVar.s();
        this.ap = bVar.o();
        this.ao = bVar.q();
        this.aq = bVar.d();
        this.ar = bVar.e();
        this.as = bVar.f();
        this.at = bVar.g();
        this.au = bVar.h();
        this.av = bVar.i();
        this.aw = bVar.p();
        this.aG = bVar.a();
        this.aH = bVar.b();
        this.aI = bVar.c();
        this.aK = bVar.l();
        this.aL = bVar.m();
        this.aM = bVar.n();
        this.aJ = bVar.j();
        if (TextUtils.isEmpty(this.as)) {
            this.as = "OctopusAd";
        }
        if (TextUtils.isEmpty(this.ar)) {
            this.ar = "OctopusAd";
        }
        if (TextUtils.isEmpty(this.at)) {
            this.at = "Ad Download";
        }
        if (!TextUtils.isEmpty(this.aa)) {
            if (!this.aa.startsWith("https://") && !this.aa.startsWith("http://")) {
                b(this.aa);
            } else {
                new r(this.aa).a(new HTTPGet.ResponseListener() {
                    @Override
                    public void getResponse(boolean z, String str) {
                        if (!z || TextUtils.isEmpty(str)) {
                            return;
                        }
                        try {
                            ServerResponse.this.b(new JSONObject(str).optString(PointParamKey.DATA));
                        } catch (Exception e) {
                            f.a("OctopusAd", "An Exception Caught", e);
                        }
                    }
                }).execute();
            }
        }
        if (this.aM) {
            ThreadUtils.runOnUIThread(new Runnable() {
                @Override
                public void run() {
                    if (TextUtils.isEmpty(ServerResponse.this.aG)) {
                        return;
                    }
                    Context k = o.a().k();
                    ServerResponse.this.an = new WebView(new MutableContextWrapper(k));
                    WebviewUtil.setWebViewSettings(ServerResponse.this.an);
                    ServerResponse.this.an.loadUrl(ServerResponse.this.aG);
                }
            });
        }
    }

    public String b() {
        return this.M;
    }

    private boolean b(c.t tVar) {
        if (tVar.b() == 0) {
            return true;
        }
        HaoboLog.e(HaoboLog.httpRespLogTag, HaoboLog.getString(R.string.response_error, tVar.c(), tVar.g()));
        return false;
    }

    public void b(boolean z) {
        this.R = z;
    }

    private boolean b(Context context) {
        if (this.aw == null || !com.octopus.ad.utils.b.i.b("com.tencent.mm.opensdk.openapi.IWXAPI")) {
            return false;
        }
        IWXAPI createWXAPI = WXAPIFactory.createWXAPI(context, this.aw.b());
        if (!createWXAPI.isWXAppInstalled()) {
            return false;
        }
        WXLaunchMiniProgram.Req req = new WXLaunchMiniProgram.Req();
        req.userName = this.aw.c();
        req.path = this.aw.a();
        req.miniprogramType = 0;
        return createWXAPI.sendReq(req);
    }

    private void d(Context context) {
        WebView webView;
        if (TextUtils.isEmpty(this.aG)) {
            return;
        }
        if (this.aK && this.E) {
            if (this.aG.startsWith("http")) {
                ag();
                if (this.aM && (webView = this.an) != null) {
                    ViewUtil.openLocalBrowser(webView, this.j);
                    return;
                } else {
                    ViewUtil.openLocalBrowser(this.aG, this.j);
                    return;
                }
            }
            return;
        }
        ViewUtil.openSystemBrowser(context, this.aG);
    }

    public void b(int i) {
        List<c.z> r;
        String e;
        c.b bVar = this.ax;
        if (bVar == null || this.aV == i || !this.aR || (r = bVar.r()) == null) {
            return;
        }
        for (int i4 = 0; i4 < r.size(); i4++) {
            c.z zVar = r.get(i4);
            if (i == 1) {
                e = zVar.c();
            } else if (i == 2) {
                e = zVar.d();
            } else {
                e = i == 3 ? zVar.e() : "";
            }
            a(e);
            this.aV = i;
        }
    }

    private void a(final Context context) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    JSONObject jSONObject = new JSONObject();
                    jSONObject.put("slotId", ServerResponse.this.M);
                    jSONObject.put("wordText", ServerResponse.this.aa);
                    jSONObject.put("bundle", context.getPackageName());
                    jSONObject.put("deviceId", Octopus.getOaid(context));
                    String a = com.octopus.ad.utils.b.a.a(com.octopus.ad.utils.b.e.a(), jSONObject.toString());
                    if (a != null) {
                        d.a(o.a().n() + "/sdk/wt", a.getBytes());
                    }
                } catch (Exception e) {
                    f.a("OctopusAd", "An Exception Caught", e);
                }
            }
        }).start();
    }

    private void a(c.t tVar) {
        this.X = tVar.h();
        this.Y = tVar.i();
        this.ac = tVar.k();
        this.T = tVar.l();
        this.U = tVar.m();
        this.V = tVar.n();
        this.W = tVar.o();
        this.aj = tVar.p();
        this.ak = tVar.q();
        this.al = tVar.r();
        this.ab = tVar.j();
        this.am = tVar.s();
        this.af = tVar.t();
        if (b(tVar)) {
            n nVar = this.aE;
            if (nVar == n.PREFETCH) {
                if (d(tVar)) {
                    return;
                }
            } else if (nVar != n.NATIVE && nVar != n.BANNER && nVar != n.DRAW) {
                if (c(tVar)) {
                    return;
                }
            } else if (e(tVar)) {
                return;
            }
            f(tVar);
        }
    }

    public ServerResponse(boolean z) {
        this.d = 0;
        this.e = 1;
        this.f = 0;
        this.g = 0;
        this.h = 0;
        this.i = 0;
        this.j = 0;
        this.k = false;
        this.l = false;
        this.m = false;
        this.n = false;
        this.o = false;
        this.p = true;
        this.q = false;
        this.r = true;
        this.s = false;
        this.t = false;
        this.u = false;
        this.v = false;
        this.w = false;
        this.x = false;
        this.y = 0;
        this.z = 0;
        this.A = false;
        this.B = 0;
        this.C = new AdLogoInfo();
        this.D = new AdLogoInfo();
        this.E = false;
        this.Q = false;
        this.R = false;
        this.S = true;
        this.T = true;
        this.aF = new LinkedList();
        this.aN = new LinkedList<>();
        this.aO = new HashMap<>();
        this.aP = false;
        this.aV = 0;
        this.aQ = z;
    }

    public void a(com.octopus.ad.internal.view.b bVar) {
        this.ai = bVar;
    }

    public void a(String str, Object obj) {
        this.aO.put(str, obj);
    }

    public void a(final boolean z, final com.octopus.ad.a aVar) {
        List<c.i> s;
        this.S = z;
        int i = this.B;
        if (i <= 0) {
            this.B = i + 1;
            if (!StringUtil.isEmpty(this.a)) {
                new com.octopus.ad.internal.i(this.a).execute();
                this.a = "";
            }
            c.b bVar = this.ax;
            if (bVar == null || (s = bVar.s()) == null) {
                return;
            }
            for (int i4 = 0; i4 < s.size(); i4++) {
                c.i iVar = s.get(i4);
                if (iVar != null && !TextUtils.isEmpty(iVar.a())) {
                    String a = iVar.a();
                    if (a.contains("?rv=1")) {
                        ViewUtil.openLocalBrowser(a, this.j);
                    } else {
                        if (a.contains("track=oct")) {
                            if (this.Q) {
                                a = a + "&opt=10";
                            } else if (this.R) {
                                a = a + "&opt=1";
                            } else if (!z) {
                                a = a + "&opt=4";
                            } else if (!this.T) {
                                a = a + "&opt=11";
                            }
                        }
                        s sVar = new s(this.Z, this.M, "imp", a);
                        if (a.contains("track=octimp")) {
                            sVar.a(new HTTPGet.ResponseListener() {
                                @Override
                                public void getResponse(boolean z4, String str) {
                                    com.octopus.ad.a aVar2 = aVar;
                                    if (aVar2 != null) {
                                        if (z4) {
                                            z4 = z;
                                        }
                                        aVar2.a(z4);
                                    }
                                }
                            });
                        }
                        sVar.a();
                    }
                }
            }
        }
    }

    public void a(int i) {
        if (this.H) {
            return;
        }
        this.H = true;
        new com.octopus.ad.internal.i(UrlUtil.replaceWinUrl(o.a().n() + "/sdk/nurl?second_price=${SECOND_PRICE}&slot_id=${SLOT_ID}&adx_code=zysdk2", i, this.M)).execute();
    }

    public void c(int i) {
        c.b bVar;
        Context k;
        c.k kVar;
        try {
            if (this.I || (bVar = this.ax) == null) {
                return;
            }
            this.I = true;
            List<c.i> s = bVar.s();
            if (s != null) {
                for (int i4 = 0; i4 < s.size(); i4++) {
                    c.i iVar = s.get(i4);
                    if (iVar != null && !TextUtils.isEmpty(iVar.c())) {
                        String c = iVar.c();
                        if (c.contains("track=oct")) {
                            Boolean bool = Boolean.TRUE;
                            Boolean bool2 = this.U;
                            if (bool != bool2) {
                                if (this.Q) {
                                    c = c + "&opt=10";
                                } else if (this.R) {
                                    c = c + "&opt=1";
                                } else if (!this.S) {
                                    c = c + "&opt=4";
                                } else if (this.P != 0) {
                                    c = c + "&opt=" + this.P;
                                } else if (Boolean.FALSE == bool2) {
                                    c = c + "&opt=8";
                                } else if (!this.T) {
                                    c = c + "&opt=11";
                                } else if (this.V) {
                                    c = c + "&opt=12";
                                }
                            }
                            String str = c + "&result=" + i;
                            if (i == 0 && (k = o.a().k()) != null && (kVar = this.aj) != null && kVar.a() == 1) {
                                new com.octopus.ad.utils.a().a(k, this.aj.c(), this.aj.d(), this.aj.b());
                            }
                            new com.octopus.ad.internal.i(str).execute();
                        } else {
                            new com.octopus.ad.internal.i(c).execute();
                        }
                    }
                }
            }
        } catch (Exception e) {
            f.a("OctopusAd", "An Exception Caught", e);
        }
    }

    public void a(int i, String str, String str2) {
        if (this.H) {
            return;
        }
        this.H = true;
        new com.octopus.ad.internal.i(UrlUtil.replaceLossUrl(o.a().n() + "/sdk/lurl?win_price=${WIN_PRICE}&lose_reason=${LOSS_REASON}&win_bidder=${WIN_BIDDER}&slot_id=${SLOT_ID}&adx_code=zysdk2", i, str, str2, this.M)).execute();
    }

    public void a(View view, int i, boolean z, com.octopus.ad.model.d dVar) {
        Context context;
        if (view == null) {
            context = o.a().k();
        } else {
            context = view.getContext();
        }
        a(context, i, this.Q, this.R, z, dVar);
    }

    private void a(com.octopus.ad.model.d dVar) {
        if (this.ax == null || this.aA == null) {
            return;
        }
        for (int i = 0; i < this.aA.size(); i++) {
            c.i iVar = this.aA.get(i);
            if (iVar != null && !TextUtils.isEmpty(iVar.b())) {
                String b = iVar.b();
                if (b.contains("?rv=1")) {
                    ViewUtil.openLocalBrowser(b, this.j);
                } else {
                    if (b.contains("track=oct")) {
                        Boolean bool = Boolean.TRUE;
                        Boolean bool2 = this.U;
                        if (bool != bool2) {
                            if (this.Q) {
                                b = b + "&opt=10";
                            } else if (this.R) {
                                b = b + "&opt=1";
                            } else if (!this.S) {
                                b = b + "&opt=4";
                            } else if (this.P != 0) {
                                b = b + "&opt=" + this.P;
                            } else if (Boolean.FALSE == bool2) {
                                b = b + "&opt=8";
                            } else if (!this.T) {
                                b = b + "&opt=11";
                            } else if (this.V) {
                                b = b + "&opt=12";
                            }
                        }
                    }
                    new s(this.Z, this.M, "clk", UrlUtil.replaceClickEventUrl(b, dVar, this.ao)).a();
                }
            }
        }
        this.aA = null;
    }

    public void c(boolean z) {
        this.Q = z;
    }

    @SuppressLint({"WrongConstant"})
    private void c(Context context) {
        try {
            if (TextUtils.isEmpty(this.aH)) {
                return;
            }
            Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(this.aH));
            intent.setFlags(268500993);
            context.startActivity(intent);
        } catch (Exception unused) {
            d(context);
            c(1);
        }
    }

    private void a(final Context context, final int i, final String str) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    if (context == null) {
                        return;
                    }
                    JSONObject jSONObject = new JSONObject();
                    jSONObject.put("requestId", ServerResponse.this.Z);
                    jSONObject.put("slotId", ServerResponse.this.M);
                    jSONObject.put("packageName", context.getPackageName());
                    jSONObject.put("sdkVersion", "1.6.4.6");
                    jSONObject.put("oaid", Octopus.getOaid(context));
                    jSONObject.put("vendor", Build.MANUFACTURER);
                    jSONObject.put("model", Build.MODEL);
                    jSONObject.put("cpu", Build.CPU_ABI);
                    jSONObject.put("osVersion", Build.VERSION.RELEASE + "_" + Build.VERSION.SDK_INT);
                    jSONObject.put("code", i);
                    jSONObject.put("message", str);
                    d.a(o.a().n() + "/sdk/soReport", jSONObject.toString().getBytes());
                } catch (Exception e) {
                    f.a("OctopusAd", "An Exception Caught", e);
                }
            }
        }).start();
    }

    @SuppressLint({"WrongConstant"})
    public void a(final Context context, int i, boolean z, boolean z4, boolean z5, com.octopus.ad.model.d dVar) {
        boolean z6;
        if (!TextUtils.isEmpty(this.ad)) {
            OctUtil.a().setInfo(this.ad);
            OctUtil.a().changeConfig();
            k.a().a(new k.a() {
                @Override
                public void a(String str) {
                    if ("AppSelfForeground".equals(str)) {
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                OctUtil.a().resumeConfig();
                                k.a().b(this);
                            }
                        }, ServerResponse.this.ae);
                    }
                }
            });
        }
        this.J++;
        this.P = i;
        this.Q = z;
        this.R = z4;
        this.S = z5;
        if (z) {
            this.P = 10;
        } else if (z4) {
            this.P = 1;
        }
        f.a("OctopusAd", "handleClick========" + this.F);
        if (!this.F) {
            this.F = true;
            a(dVar);
        }
        f.a("OctopusAd", "mDeepLinkUrl:" + this.aH + ",appDownloadURL = " + this.au + ",mLandingPageUrl = " + this.aG);
        boolean a = com.octopus.ad.utils.b.c.a(context, this.as);
        if ((!this.l || a || this.aq == 3) && !TextUtils.isEmpty(this.aH)) {
            try {
                if (o.a().e() && ((z6 = this.m) || this.n)) {
                    if (!z6) {
                        this.aI = null;
                    }
                    OctUtil.a().a(context.getApplicationContext(), this.aH, this.aI, this.n, new OctUtil.C() {
                        @Override
                        public String e(String str) {
                            ServerResponse.this.a(context, str);
                            return null;
                        }
                    });
                } else {
                    c(context);
                }
                k.a().a(new k.a() {
                    @Override
                    public void a(String str) {
                        if ("AppBackground".equals(str)) {
                            ServerResponse.this.c(0);
                            k.a().b(this);
                        }
                    }
                });
                return;
            } catch (Exception unused) {
                d(context);
                c(1);
                return;
            }
        }
        if (TextUtils.isEmpty(this.au) || this.aq != 2) {
            if (this.aq == 6) {
                boolean b = b(context);
                c(!b ? 1 : 0);
                if (b) {
                    return;
                }
                d(context);
                return;
            }
            d(context);
            return;
        }
        if (a) {
            com.octopus.ad.utils.b.c.b(context, this.as);
            return;
        }
        if (V() && i == 0) {
            i = 6;
        }
        File a5 = com.octopus.ad.utils.b.c.a(context);
        String absolutePath = a5 != null ? a5.getAbsolutePath() : "";
        com.octopus.ad.utils.c.a(context).b(context).a(this.Z).a(this.ag).a(this.av).a(V()).a(i).a(this.ax).a(new com.octopus.ad.utils.b(this.au, this.as + ".apk", this.as, absolutePath, this.ar, this.at, context.getPackageName() + ".octopus.provider", this.ap)).c();
    }

    public void a(Context context, String str) {
        if (context != null) {
            try {
                if (TextUtils.isEmpty(str)) {
                    return;
                }
                int i = -1;
                if (str.equals("1")) {
                    str = "";
                    i = 1;
                } else {
                    if (!str.equals("-1")) {
                        if (str.startsWith("-2,")) {
                            i = -2;
                            str = str.substring(3);
                        } else if (str.equals("-3")) {
                            i = -3;
                        } else if (str.equals("-4")) {
                            if (this.aL) {
                                d(context);
                            }
                            c(-1);
                            str = "";
                            i = -4;
                        } else {
                            i = -5;
                        }
                    }
                    str = "";
                }
                if (i != 1 && i != -4 && i != -5) {
                    c(context);
                }
                if (this.J == 1) {
                    a(context, i, str);
                }
            } catch (Exception e) {
                f.a("OctopusAd", "An Exception Caught", e);
            }
        }
    }

    public void a(com.octopus.ad.a.a aVar) {
        this.ag = aVar;
    }

    public void a(String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        new com.octopus.ad.internal.i(UrlUtil.replaceVideoTrackerUrl(str, this.am, this.aS, this.aT)).execute();
    }
}