小红书.apk(点击下载) / b.java


package com.mob.secverify.pure.core.ope.wo.core;

import android.content.Context;
import android.net.Network;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import com.ali.auth.third.core.model.KernelMessageConstants;
import com.alibaba.baichuan.trade.biz.applink.adapter.AppLinkConstants;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import com.mob.secverify.pure.core.ope.wo.c.a;
import com.mob.secverify.pure.core.ope.wo.c.e;
import com.mob.secverify.pure.core.ope.wo.c.g;
import com.mob.secverify.pure.core.ope.wo.listener.WoCallback;
import com.mob.secverify.pure.core.ope.wo.net.WoHttpManager;
import com.mob.secverify.pure.core.ope.wo.net.WoNetwork;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.HashMap;
import org.json.JSONObject;

/* compiled from: WoCoreImpl */
public class b {

    /* renamed from: a  reason: collision with root package name */
    private static volatile b f29741a;

    /* renamed from: b  reason: collision with root package name */
    private Handler f29742b = new Handler(Looper.getMainLooper());

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

    private String a(Context context, int i10, String str) {
        String str2;
        try {
            String packageName = context.getPackageName();
            String b14 = com.mob.secverify.pure.core.ope.wo.c.b.b(context, context.getPackageName());
            String a14 = com.mob.secverify.pure.core.ope.wo.a.b.a();
            if (i10 != 2) {
                str2 = "1";
            } else {
                str2 = "";
            }
            String str3 = "" + System.currentTimeMillis();
            String a15 = e.a(com.mob.secverify.pure.core.ope.wo.c.b.b(context).getBytes());
            String decode = URLDecoder.decode(com.mob.secverify.pure.core.ope.wo.c.b.e(str), "utf-8");
            String a16 = com.mob.secverify.pure.core.ope.wo.c.b.a(str2 + a14 + "30100" + "jsonp" + a15 + decode + packageName + b14 + str3 + "4.6.0AR002B0101" + com.mob.secverify.pure.core.ope.wo.a.b.b());
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("client_id", a14);
            jSONObject.put("client_type", "30100");
            jSONObject.put("format", "jsonp");
            jSONObject.put(HiAnalyticsConstant.HaKey.BI_KEY_VERSION, "4.6.0AR002B0101");
            if (i10 != 2) {
                jSONObject.put("business_type", str2);
            }
            jSONObject.put("packname", packageName);
            jSONObject.put("packsign", URLEncoder.encode(b14, "utf-8"));
            jSONObject.put("timeStamp", str3);
            jSONObject.put("key", decode);
            jSONObject.put("fp", a15);
            jSONObject.put(AppLinkConstants.SIGN, a16);
            return jSONObject.toString();
        } catch (Throwable unused) {
            return "";
        }
    }

    private HashMap<String, String> a(Context context) {
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("model", Build.MODEL);
        hashMap.put("system", Build.VERSION.RELEASE);
        hashMap.put("device_id", g.a(context));
        return hashMap;
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void a(Context context, int i10, String str, String str2, Network network, final WoCallback woCallback) {
        try {
            String a14 = a(context, i10, str);
            WoHttpManager.a().a(str2 + a.a(a14, "&"), a(context), network, new WoHttpManager.ExcutorCallback() {
                /* class com.mob.secverify.pure.core.ope.wo.core.b.AnonymousClass1 */

                @Override // com.mob.secverify.pure.core.ope.wo.net.WoHttpManager.ExcutorCallback
                public void complete(String str) {
                    WoNetwork.a().b();
                    if (TextUtils.isEmpty(str)) {
                        woCallback.onResult(KernelMessageConstants.QRCODE_CLIENT_EXPIRED, "网络请求响应为空");
                    } else {
                        woCallback.onResult(0, str);
                    }
                }
            });
        } catch (Exception e14) {
            woCallback.onResult(10009, "10009" + e14.getMessage());
            WoNetwork.a().b();
        }
    }

    public void a(final Context context, final int i10, final String str, final WoCallback woCallback) {
        try {
            if (com.mob.secverify.pure.core.ope.wo.c.b.a(context.getApplicationContext()) == 1) {
                this.f29742b.post(new Runnable() {
                    /* class com.mob.secverify.pure.core.ope.wo.core.b.AnonymousClass2 */

                    public void run() {
                        WoNetwork.a().a(context, "https://opencloud.wostore.cn/openapi/netauth/precheck/wp?", new WoNetwork.NetInterface() {
                            /* class com.mob.secverify.pure.core.ope.wo.core.b.AnonymousClass2.AnonymousClass1 */

                            @Override // com.mob.secverify.pure.core.ope.wo.net.WoNetwork.NetInterface
                            public void onSwitch(boolean z14, Network network) {
                                if (z14) {
                                    AnonymousClass2 r83 = AnonymousClass2.this;
                                    b.this.a(context, i10, str, "https://opencloud.wostore.cn/openapi/netauth/precheck/wp?", network, woCallback);
                                    return;
                                }
                                woCallback.onResult(10003, "无法切换至数据网络");
                                WoNetwork.a().b();
                            }
                        });
                    }
                });
            } else if (com.mob.secverify.pure.core.ope.wo.c.b.a(context.getApplicationContext()) == 0) {
                a(context, i10, str, "https://opencloud.wostore.cn/openapi/netauth/precheck/wp?", null, woCallback);
            } else {
                woCallback.onResult(10004, "数据网络未开启");
                WoNetwork.a().b();
            }
        } catch (Exception e14) {
            woCallback.onResult(10005, "网络判断异常" + e14.getMessage());
            WoNetwork.a().b();
        }
    }
}