花瓣 v4.6.12版本的 MD5 值为:6a3515d4d16d98931f1b3d25a91b257e

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


package com.sigmob.sdk.base;

import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import com.czhj.sdk.common.ClientMetadata;
import com.czhj.sdk.common.models.Config;
import com.czhj.sdk.common.network.Networking;
import com.czhj.sdk.common.network.SigmobRequestQueue;
import com.czhj.sdk.logger.SigmobLog;
import com.czhj.volley.VolleyError;
import com.czhj.wire.Wire;
import com.huawei.hms.framework.common.ContainerUtils;
import com.huawei.hms.push.constant.RemoteMessageConst;
import com.sigmob.sdk.base.models.config.Android;
import com.sigmob.sdk.base.models.config.Common;
import com.sigmob.sdk.base.models.config.CommonEndpointsConfig;
import com.sigmob.sdk.base.models.config.DialogSetting;
import com.sigmob.sdk.base.models.config.NativeConfig;
import com.sigmob.sdk.base.models.config.RvConfig;
import com.sigmob.sdk.base.models.config.SdkConfig;
import com.sigmob.sdk.base.models.config.SdkConfigResponse;
import com.sigmob.sdk.base.models.config.SplashConfig;
import com.sigmob.sdk.base.network.d;
import com.sigmob.windad.WindAdOptions;
import com.sigmob.windad.WindAds;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.List;
public class i {
    private static final String a = "sdkConfigVer";
    private static i b = null;
    private static boolean c = false;
    private a k;
    private final String f11131f = "4.4.0";
    private long f11133h = 0;
    private SdkConfig f11134i = null;
    private SdkConfig j = null;
    private final Handler f11129d = new Handler(Looper.getMainLooper());
    private final Runnable f11130e = new Runnable() {
        @Override
        public void run() {
            i.this.S();
        }
    };
    private boolean f11132g = true;

    public interface a {
        void a();
    }

    private i() {
        R();
    }

    private void R() {
        if (this.f11134i == null) {
            SdkConfig.Builder builder = new SdkConfig.Builder();
            Common.Builder builder2 = new Common.Builder();
            Android.Builder builder3 = new Android.Builder();
            builder2.endpoints(new CommonEndpointsConfig.Builder().build());
            RvConfig.Builder builder4 = new RvConfig.Builder();
            builder4.cacheTop(4);
            builder2.rv_config(builder4.build());
            builder2.configRefresh(1000);
            builder2.disable_up_location(Boolean.TRUE);
            builder2.is_gdpr_region(Boolean.FALSE);
            builder2.enable_debug_level(Boolean.FALSE);
            builder3.disable_boot_mark(Boolean.TRUE);
            builder3.disableUpAppInfo(Boolean.TRUE);
            builder3.oaid_api_is_disable(Boolean.TRUE);
            builder3.enable_permission(Boolean.FALSE);
            builder3.enable_report_crash(Boolean.FALSE);
            builder.common_config(builder2.build());
            builder.android_config(builder3.build());
            this.f11134i = builder.build();
        }
    }

    public void S() {
        if (com.sigmob.sdk.b.b() == null) {
            return;
        }
        if (ClientMetadata.getInstance().isNetworkConnected(c()) && c.a().i()) {
            T();
            return;
        }
        SigmobLog.d("Can't load an ad because there is no network connectivity.");
        V();
    }

    private void T() {
        SigmobRequestQueue requestQueue = Networking.getRequestQueue();
        com.sigmob.sdk.base.network.d dVar = new com.sigmob.sdk.base.network.d(c(), new d.a() {
            @Override
            public void a(SdkConfigResponse sdkConfigResponse) {
                SigmobLog.d(sdkConfigResponse.toString());
                SdkConfig sdkConfig = sdkConfigResponse.config;
                if (sdkConfig != null) {
                    i.this.b(sdkConfig);
                    i.this.a(sdkConfig);
                } else {
                    SigmobLog.e(sdkConfigResponse.error_message);
                }
                i.this.V();
            }

            @Override
            public void onErrorResponse(VolleyError volleyError) {
                SigmobLog.e(volleyError.toString());
                i.this.V();
            }
        });
        if (requestQueue == null) {
            SigmobLog.e("queue is null");
            V();
            return;
        }
        requestQueue.add(dVar);
        SigmobLog.i("update sdk config");
    }

    private void U() {
        this.f11129d.removeCallbacks(this.f11130e);
    }

    public void V() {
        U();
        if (this.f11132g) {
            this.f11129d.postDelayed(this.f11130e, Math.max(30000L, this.f11133h));
        }
    }

    private SplashConfig W() {
        if (i() != null) {
            return i().splash_config;
        }
        return null;
    }

    private NativeConfig X() {
        if (i() != null) {
            return i().native_config;
        }
        return null;
    }

    public static i a() {
        if (b == null) {
            synchronized (i.class) {
                if (b == null) {
                    b = new i();
                }
            }
        }
        return b;
    }

    public void a(SdkConfig sdkConfig) {
        ObjectOutputStream objectOutputStream;
        if (sdkConfig != null) {
            ObjectOutputStream objectOutputStream2 = null;
            File file = new File(com.sigmob.sdk.base.utils.b.a() + "/config");
            if (file.exists()) {
                file.delete();
            }
            file.getParentFile().mkdirs();
            try {
                try {
                    try {
                        objectOutputStream = new ObjectOutputStream(new FileOutputStream(file));
                    } catch (IOException e2) {
                        e = e2;
                    }
                } catch (Throwable th) {
                    th = th;
                }
                try {
                    sdkConfig.encode(objectOutputStream);
                    com.sigmob.sdk.base.utils.c.a().edit().putString(a, "4.4.0").apply();
                    objectOutputStream.close();
                } catch (IOException e3) {
                    e = e3;
                    objectOutputStream2 = objectOutputStream;
                    SigmobLog.e(e.getMessage());
                    if (objectOutputStream2 != null) {
                        objectOutputStream2.close();
                    }
                } catch (Throwable th2) {
                    th = th2;
                    objectOutputStream2 = objectOutputStream;
                    if (objectOutputStream2 != null) {
                        try {
                            objectOutputStream2.close();
                        } catch (IOException e4) {
                            SigmobLog.e(e4.getMessage());
                        }
                    }
                    throw th;
                }
            } catch (IOException e5) {
                SigmobLog.e(e5.getMessage());
            }
        }
    }

    public static String b() {
        return "appId=" + WindAds.sharedAds().getAppId() + ContainerUtils.FIELD_DELIMITER + "sdkVersion=4.4.0";
    }

    public void b(SdkConfig sdkConfig) {
        Common common;
        if (sdkConfig == null || (common = sdkConfig.common_config) == null) {
            return;
        }
        this.j = sdkConfig;
        c = common.is_gdpr_region.booleanValue();
        this.f11133h = this.j.common_config.configRefresh.intValue() * 1000;
        a aVar = this.k;
        if (aVar != null) {
            aVar.a();
        }
        Config.sharedInstance().update(c, P(), O(), K(), k(), C(), B());
    }

    public static String c() {
        String str;
        WindAdOptions options = WindAds.sharedAds().getOptions();
        if (options == null || options.getExtData() == null || (str = options.getExtData().get(h.f11123d)) == null || TextUtils.isEmpty(str)) {
            if (TextUtils.isEmpty(h.f11125f)) {
                return "https://adservice.sigmob.cn/sigmob/config?" + b();
            }
            return h.f11125f + "?" + b();
        } else if (str.indexOf(63) == -1) {
            return str + "?" + b();
        } else {
            return str + ContainerUtils.FIELD_DELIMITER + b();
        }
    }

    public static String d() {
        return "https://adservice.sigmob.cn/extconfig?" + b();
    }

    public static boolean g() {
        return c;
    }

    public int A() {
        int intValue = i() != null ? ((Integer) Wire.get(i().tracking_retry_interval, 180)).intValue() : 10;
        return (intValue >= 10 ? intValue : 10) * 1000;
    }

    public int B() {
        int intValue = Common.DEFAULT_MAX_SEND_LOG_RECORDS.intValue();
        if (i() != null) {
            intValue = ((Integer) Wire.get(i().max_send_log_records, Common.DEFAULT_MAX_SEND_LOG_RECORDS)).intValue();
        }
        return intValue < 10 ? Common.DEFAULT_MAX_SEND_LOG_RECORDS.intValue() : intValue;
    }

    public int C() {
        int intValue;
        if (i() == null || (intValue = ((Integer) Wire.get(i().send_log_interval, 3)).intValue()) < 3) {
            return 3;
        }
        return intValue;
    }

    public List<Integer> D() {
        if (i() != null) {
            return i().dclog_blacklist;
        }
        return null;
    }

    public boolean E() {
        if (i() != null) {
            return ((Boolean) Wire.get(i().enable_debug_level, Boolean.FALSE)).booleanValue();
        }
        return false;
    }

    public long F() {
        if (i() != null) {
            long intValue = ((Integer) Wire.get(i().load_interval, 0)).intValue();
            if (intValue < 1) {
                return 0L;
            }
            return intValue * 1000;
        }
        return 0L;
    }

    public boolean G() {
        if (i() != null) {
            return ((Boolean) Wire.get(i().disable_up_location, Boolean.FALSE)).booleanValue();
        }
        return true;
    }

    public boolean H() {
        if (j() != null) {
            return ((Boolean) Wire.get(j().disableUpAppInfo, Boolean.FALSE)).booleanValue();
        }
        return true;
    }

    public int I() {
        if (j() != null) {
            return ((Integer) Wire.get(j().report_log, 0)).intValue();
        }
        return 0;
    }

    public boolean J() {
        Android j = j();
        return j != null && ((Integer) Wire.get(j.up_wifi_list_interval, 0)).intValue() >= 60;
    }

    public int K() {
        if (j() != null) {
            return ((Integer) Wire.get(j().disable_up_oaid, 0)).intValue();
        }
        return 0;
    }

    public boolean L() {
        if (j() != null) {
            return ((Boolean) Wire.get(j().enable_permission, Boolean.FALSE)).booleanValue();
        }
        return false;
    }

    public int M() {
        if (j() != null) {
            return ((Integer) Wire.get(j().apk_expired_time, 0)).intValue();
        }
        return 0;
    }

    public boolean N() {
        if (j() != null) {
            return ((Boolean) Wire.get(j().enable_report_crash, Boolean.FALSE)).booleanValue();
        }
        return false;
    }

    public boolean O() {
        if (j() != null) {
            return ((Boolean) Wire.get(j().oaid_api_is_disable, Boolean.FALSE)).booleanValue();
        }
        return true;
    }

    public boolean P() {
        if (j() != null) {
            return ((Boolean) Wire.get(j().disable_boot_mark, Boolean.FALSE)).booleanValue();
        }
        return true;
    }

    public int Q() {
        return 20;
    }

    public i a(a aVar) {
        this.k = aVar;
        return b;
    }

    public boolean a(String str) {
        if (!v() || i().anti_fraud_log.events == null) {
            return false;
        }
        return i().anti_fraud_log.events.contains(str);
    }

    public void e() {
        ObjectInputStream objectInputStream = null;
        String string = com.sigmob.sdk.base.utils.c.a().getString(a, null);
        File file = new File(com.sigmob.sdk.base.utils.b.a() + "/config");
        if ("4.4.0".equals(string)) {
            try {
                if (file.exists()) {
                    try {
                        ObjectInputStream objectInputStream2 = new ObjectInputStream(new FileInputStream(file));
                        try {
                            b(SdkConfig.ADAPTER.decode(objectInputStream2));
                            objectInputStream2.close();
                        } catch (Throwable th) {
                            th = th;
                            objectInputStream = objectInputStream2;
                            try {
                                b(this.f11134i);
                                SigmobLog.e(th.getMessage());
                                if (objectInputStream != null) {
                                    objectInputStream.close();
                                    return;
                                }
                                return;
                            } catch (Throwable th2) {
                                if (objectInputStream != null) {
                                    try {
                                        objectInputStream.close();
                                    } catch (Throwable th3) {
                                        SigmobLog.e(th3.getMessage());
                                    }
                                }
                                throw th2;
                            }
                        }
                    } catch (Throwable th4) {
                        th = th4;
                    }
                    return;
                }
            } catch (Throwable th5) {
                SigmobLog.e(th5.getMessage());
                return;
            }
        }
        b(this.f11134i);
    }

    public void f() {
        U();
        this.f11129d.post(this.f11130e);
    }

    public SdkConfig h() {
        SdkConfig sdkConfig = this.j;
        return sdkConfig == null ? this.f11134i : sdkConfig;
    }

    public Common i() {
        if (h() == null) {
            return null;
        }
        return h().common_config;
    }

    public Android j() {
        if (h() == null) {
            return null;
        }
        return h().android_config;
    }

    public String k() {
        StringBuilder sb;
        String str;
        String str2 = i().endpoints.log;
        if (TextUtils.isEmpty(str2)) {
            str2 = "https://dc.sigmob.cn/log";
        }
        if (str2.indexOf(63) == -1) {
            sb = new StringBuilder();
            sb.append(str2);
            str = "?";
        } else {
            sb = new StringBuilder();
            sb.append(str2);
            str = ContainerUtils.FIELD_DELIMITER;
        }
        sb.append(str);
        sb.append(b());
        return sb.toString();
    }

    public String l() {
        StringBuilder sb;
        String str;
        String str2 = i().endpoints.ads;
        if (TextUtils.isEmpty(str2)) {
            str2 = "https://adservice.sigmob.cn/ad/v4";
        }
        if (str2.indexOf(63) == -1) {
            sb = new StringBuilder();
            sb.append(str2);
            str = "?";
        } else {
            sb = new StringBuilder();
            sb.append(str2);
            str = ContainerUtils.FIELD_DELIMITER;
        }
        sb.append(str);
        sb.append(b());
        return sb.toString();
    }

    public String m() {
        StringBuilder sb;
        String str;
        String str2 = i().endpoints.hb_ads;
        if (TextUtils.isEmpty(str2)) {
            str2 = "https://adservice.sigmob.cn/hb/v2/ad";
        }
        if (str2.indexOf(63) == -1) {
            sb = new StringBuilder();
            sb.append(str2);
            str = "?";
        } else {
            sb = new StringBuilder();
            sb.append(str2);
            str = ContainerUtils.FIELD_DELIMITER;
        }
        sb.append(str);
        sb.append(b());
        return sb.toString();
    }

    public RvConfig n() {
        if (i() != null) {
            return i().rv_config;
        }
        return null;
    }

    public int o() {
        if (n() != null) {
            return ((Integer) Wire.get(n().cacheTop, 5)).intValue();
        }
        return 5;
    }

    public long p() {
        if (n() != null) {
            int intValue = ((Integer) Wire.get(n().ad_load_timeout, 45)).intValue();
            if (intValue < 10) {
                intValue = 10;
            }
            return intValue * 1000;
        }
        return 45000L;
    }

    public DialogSetting q() {
        if (n() != null) {
            return n().close_dialog_setting;
        }
        return null;
    }

    public int r() {
        if (W() == null) {
            return 50;
        }
        return ((Integer) Wire.get(W().cacheTop, 50)).intValue();
    }

    public long s() {
        int intValue = W() != null ? ((Integer) Wire.get(W().material_expired_time, 2)).intValue() : 2;
        return intValue < 0 ? intValue : intValue * 24 * 60 * 60 * 1000;
    }

    public int t() {
        if (X() != null) {
            return ((Integer) Wire.get(X().cacheTop, 50)).intValue();
        }
        return 50;
    }

    public long u() {
        if (X() != null) {
            int intValue = X().ad_load_timeout.intValue();
            if (intValue < 10) {
                intValue = 10;
            }
            return intValue * 1000;
        }
        return 45000L;
    }

    public boolean v() {
        return (i() == null || i().anti_fraud_log == null || i().anti_fraud_log.events == null) ? false : true;
    }

    public int w() {
        if (!v() || i().anti_fraud_log.motion_config == null) {
            return 0;
        }
        return i().anti_fraud_log.motion_config.interval.intValue();
    }

    public int x() {
        if (!v() || i().anti_fraud_log.motion_config == null) {
            return 0;
        }
        return i().anti_fraud_log.motion_config.count.intValue();
    }

    public int y() {
        if (!v() || i().anti_fraud_log.motion_config == null) {
            return 0;
        }
        return i().anti_fraud_log.motion_config.queue_max.intValue() + (-50) < i().anti_fraud_log.motion_config.count.intValue() * 2 ? (i().anti_fraud_log.motion_config.count.intValue() * 2) + 50 : i().anti_fraud_log.motion_config.queue_max.intValue();
    }

    public long z() {
        long intValue = i() != null ? ((Integer) Wire.get(i().tracking_expiration_time, Integer.valueOf((int) RemoteMessageConst.DEFAULT_TTL))).intValue() : 180L;
        return (intValue >= 180 ? intValue : 180L) * 1000;
    }
}