导航菜单

页面标题

页面副标题

Fancy Optimizer v4.6.3 - b.java 源代码

正在查看: Fancy Optimizer v4.6.3 应用的 b.java JAVA 源代码文件

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


package com.mbridge.msdk.a;

import android.content.Context;
import android.text.TextUtils;
import android.webkit.WebView;
import com.iab.omid.library.mmadbridge.Omid;
import com.iab.omid.library.mmadbridge.adsession.AdSession;
import com.iab.omid.library.mmadbridge.adsession.AdSessionConfiguration;
import com.iab.omid.library.mmadbridge.adsession.AdSessionContext;
import com.iab.omid.library.mmadbridge.adsession.CreativeType;
import com.iab.omid.library.mmadbridge.adsession.ImpressionType;
import com.iab.omid.library.mmadbridge.adsession.Owner;
import com.iab.omid.library.mmadbridge.adsession.Partner;
import com.iab.omid.library.mmadbridge.adsession.VerificationScriptResource;
import com.mbridge.msdk.MBridgeConstans;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mbridge.msdk.foundation.same.b.c;
import com.mbridge.msdk.foundation.same.b.e;
import com.mbridge.msdk.foundation.same.report.d;
import com.mbridge.msdk.foundation.tools.t;
import com.mbridge.msdk.foundation.tools.v;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public final class b {
    public static void a(final Context context) {
        if (TextUtils.isEmpty(MBridgeConstans.OMID_JS_SERVICE_URL)) {
            MBridgeConstans.OMID_JS_SERVICE_CONTENT = "";
            new d(context).a("", "", "", "", "fetch OM failed, OMID_JS_SERVICE_URL null");
        } else {
            if (context == null) {
                return;
            }
            try {
                new a(context.getApplicationContext()).a(0, MBridgeConstans.OMID_JS_SERVICE_URL, (com.mbridge.msdk.foundation.same.net.g.d) null, new com.mbridge.msdk.foundation.same.net.b.a() {
                    public final void a(final String str) {
                        MBridgeConstans.OMID_JS_SERVICE_CONTENT = str;
                        v.a("OMSDK", "fetch OMJSContent success, content = " + str);
                        new Thread(new Runnable() {
                            @Override
                            public final void run() {
                                try {
                                    File file = new File(e.b(c.i), "/omsdk/om_js_content.txt");
                                    if (file.exists()) {
                                        file.delete();
                                    }
                                    t.a(str.getBytes(), file);
                                } catch (Exception e2) {
                                    v.a("OMSDK", e2.getMessage());
                                }
                            }
                        }).start();
                    }

                    public final void b(String str) {
                        v.a("OMSDK", "fetch OMJSContent failed, errorCode = " + str);
                        new d(context).a("", "", "", "", "fetch OM failed, request failed");
                    }
                });
            } catch (Exception e2) {
                v.d("OMSDK", e2.getMessage());
            }
        }
    }

    public static void b(final Context context) {
        if (TextUtils.isEmpty(MBridgeConstans.OMID_JS_H5_URL)) {
            MBridgeConstans.OMID_JS_H5_CONTENT = "";
            new d(context).a("", "", "", "", "fetch OM failed, OMID_JS_H5_URL null");
        } else {
            if (context == null) {
                return;
            }
            try {
                new a(context.getApplicationContext()).a(0, MBridgeConstans.OMID_JS_H5_URL, (com.mbridge.msdk.foundation.same.net.g.d) null, new com.mbridge.msdk.foundation.same.net.b.a() {
                    public final void a(final String str) {
                        MBridgeConstans.OMID_JS_H5_CONTENT = str;
                        v.a("OMSDK", "fetch OMJSH5Content success, content = " + str);
                        new Thread(new Runnable() {
                            @Override
                            public final void run() {
                                try {
                                    File file = new File(e.b(c.i), "/omsdk/om_js_h5_content.txt");
                                    if (file.exists()) {
                                        file.delete();
                                    }
                                    t.a(str.getBytes(), file);
                                } catch (Exception e2) {
                                    v.a("OMSDK", e2.getMessage());
                                }
                            }
                        }).start();
                    }

                    public final void b(String str) {
                        v.a("OMSDK", "fetch OMJSH5Content failed, errorCode = " + str);
                        new d(context).a("", "", "", "", "fetch OM H5 failed, request failed");
                    }
                });
            } catch (Exception e2) {
                v.d("OMSDK", e2.getMessage());
            }
        }
    }

    private static void c(Context context) {
        if (Omid.isActive()) {
            return;
        }
        Omid.activate(context);
    }

    private static List<VerificationScriptResource> a(String str, Context context, String str2, String str3, String str4, String str5) {
        VerificationScriptResource createVerificationScriptResourceWithParameters;
        ArrayList arrayList = new ArrayList();
        try {
            JSONArray jSONArray = new JSONArray(str);
            if (str != null) {
                for (int i2 = 0; i2 < jSONArray.length(); i2++) {
                    JSONObject optJSONObject = jSONArray.optJSONObject(i2);
                    String optString = optJSONObject.optString("vkey", "");
                    URL url = new URL(optJSONObject.optString("et_url", ""));
                    String optString2 = optJSONObject.optString("verification_p", "");
                    if (TextUtils.isEmpty(optString2)) {
                        if (TextUtils.isEmpty(optString)) {
                            createVerificationScriptResourceWithParameters = VerificationScriptResource.createVerificationScriptResourceWithoutParameters(url);
                        } else {
                            createVerificationScriptResourceWithParameters = VerificationScriptResource.createVerificationScriptResourceWithoutParameters(url);
                        }
                    } else {
                        createVerificationScriptResourceWithParameters = VerificationScriptResource.createVerificationScriptResourceWithParameters(optString, url, optString2);
                    }
                    arrayList.add(createVerificationScriptResourceWithParameters);
                }
            }
        } catch (IllegalArgumentException e2) {
            v.d("OMSDK", e2.getMessage());
            new d(context).a(str2, str5, str3, str4, "failed, exception " + e2.getMessage());
        } catch (MalformedURLException e3) {
            v.d("OMSDK", e3.getMessage());
            new d(context).a(str2, str5, str3, str4, "failed, exception " + e3.getMessage());
        } catch (JSONException e4) {
            v.d("OMSDK", e4.getMessage());
            new d(context).a(str2, str5, str3, str4, "failed, exception " + e4.getMessage());
        }
        return arrayList;
    }

    private static String b() {
        try {
            File file = new File(e.b(c.i), "/omsdk/om_js_h5_content.txt");
            return file.exists() ? t.a(file) : "";
        } catch (Exception e2) {
            v.a("OMSDK", e2.getMessage());
            return "";
        }
    }

    public static AdSession a(Context context, WebView webView, String str, CampaignEx campaignEx) {
        if (TextUtils.isEmpty(MBridgeConstans.OMID_JS_SERVICE_CONTENT)) {
            MBridgeConstans.OMID_JS_SERVICE_CONTENT = a();
        }
        if (TextUtils.isEmpty(MBridgeConstans.OMID_JS_H5_CONTENT)) {
            MBridgeConstans.OMID_JS_H5_CONTENT = b();
        }
        if (!TextUtils.isEmpty(MBridgeConstans.OMID_JS_SERVICE_CONTENT) && !TextUtils.isEmpty(campaignEx.getOmid())) {
            CreativeType creativeType = CreativeType.DEFINED_BY_JAVASCRIPT;
            c(context);
            ImpressionType impressionType = ImpressionType.BEGIN_TO_RENDER;
            Owner owner = Owner.JAVASCRIPT;
            CreativeType creativeType2 = CreativeType.HTML_DISPLAY;
            AdSession createAdSession = AdSession.createAdSession(AdSessionConfiguration.createAdSessionConfiguration(creativeType, impressionType, owner, Owner.NONE, false), AdSessionContext.createHtmlAdSessionContext(Partner.createPartner("Mintegral", "MAL_16.2.51"), webView, (String) null, (String) null));
            createAdSession.registerAdView(webView);
            return createAdSession;
        }
        v.a("OMSDK", "createNativeAdSession: TextUtils.isEmpty(omid) = " + TextUtils.isEmpty(campaignEx.getOmid()) + " TextUtils.isEmpty(MIntegralConstans.OMID_JS_SERVICE_CONTENT) = " + TextUtils.isEmpty(MBridgeConstans.OMID_JS_SERVICE_CONTENT));
        new d(context).a(campaignEx.getRequestId(), campaignEx.getRequestIdNotice(), campaignEx.getId(), campaignEx.getCampaignUnitId(), "failed, OMID_JS_SERVICE_CONTENT null or omid null");
        return null;
    }

    public static AdSession a(Context context, boolean z, String str, String str2, String str3, String str4, String str5, String str6) {
        Partner createPartner;
        CreativeType creativeType;
        ImpressionType impressionType;
        Owner owner;
        if (TextUtils.isEmpty(MBridgeConstans.OMID_JS_SERVICE_CONTENT)) {
            MBridgeConstans.OMID_JS_SERVICE_CONTENT = a();
        }
        AdSession adSession = null;
        if (!TextUtils.isEmpty(MBridgeConstans.OMID_JS_SERVICE_CONTENT) && !TextUtils.isEmpty(str)) {
            try {
                c(context);
                createPartner = Partner.createPartner("Mintegral", "MAL_16.2.51");
                creativeType = CreativeType.NATIVE_DISPLAY;
                impressionType = ImpressionType.LOADED;
                owner = Owner.NATIVE;
            } catch (IllegalArgumentException e2) {
                e = e2;
            } catch (Exception e3) {
                e = e3;
            }
            try {
                adSession = AdSession.createAdSession(AdSessionConfiguration.createAdSessionConfiguration(creativeType, impressionType, owner, z ? Owner.NONE : owner, false), AdSessionContext.createNativeAdSessionContext(createPartner, MBridgeConstans.OMID_JS_SERVICE_CONTENT, a(str, context, str2, str3, str4, str6), str5, str2));
                v.a("OMSDK", "adSession create success");
                return adSession;
            } catch (IllegalArgumentException e4) {
                e = e4;
                v.d("OMSDK", e.getMessage());
                new d(context).a(str2, str6, str3, str4, "failed, exception " + e.getMessage());
                return adSession;
            } catch (Exception e5) {
                e = e5;
                v.d("OMSDK", e.getMessage());
                new d(context).a(str2, str6, str3, str4, "failed, exception " + e.getMessage());
                return adSession;
            }
        }
        v.a("OMSDK", "createNativeAdSession: TextUtils.isEmpty(omid) = " + TextUtils.isEmpty(str) + " TextUtils.isEmpty(MIntegralConstans.OMID_JS_SERVICE_CONTENT) = " + TextUtils.isEmpty(MBridgeConstans.OMID_JS_SERVICE_CONTENT));
        new d(context).a(str2, str6, str3, str4, "failed, OMID_JS_SERVICE_CONTENT null or omid null");
        return null;
    }

    private static String a() {
        try {
            return t.a(new File(e.b(c.i), "/omsdk/om_js_content.txt"));
        } catch (Exception e2) {
            v.a("OMSDK", e2.getMessage());
            return "";
        }
    }

    public static String a(String str) {
        if (TextUtils.isEmpty(MBridgeConstans.OMID_JS_H5_CONTENT)) {
            MBridgeConstans.OMID_JS_H5_CONTENT = b();
        }
        return TextUtils.isEmpty(str) ? str : str.replace("/*OMSDK_INSERT_HERE*/", MBridgeConstans.OMID_JS_H5_CONTENT).replace("[INSERT RESOURCE URL]", "https://s3-us-west-2.amazonaws.com/omsdk-files/compliance-js/omid-validation-verification-script-v1.js");
    }
}