小源钱包 v1.0.0版本的 MD5 值为:2fddb51fa9867693f901004082511bea

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


package com.g.gysdk.a;

import android.text.TextUtils;
import android.util.Pair;
import androidx.lifecycle.CoroutineLiveDataKt;
import com.g.gysdk.GyCode;
import com.g.gysdk.GyConfig;
import com.g.gysdk.GyErrorCode;
import com.g.gysdk.a.al;
import com.g.gysdk.a.an;
import com.g.gysdk.a.d;
import com.g.gysdk.a.n;
import com.g.gysdk.a.y;
import java.io.Serializable;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import org.json.JSONObject;
public class s {
    public static boolean f8583a = false;
    static boolean f8584b = false;
    private final n f8585c;
    private final n f8586d;
    private final n f8587e;
    private volatile n.e f8588f;
    private volatile n.e f8589g;
    private volatile n.e f8590h;
    private volatile n.e f8591i;
    private volatile n.e f8592j;
    private volatile n.e f8593k;

    public static class AnonymousClass7 {
        static final int[] f8628a;

        static {
            int[] iArr = new int[as.values().length];
            f8628a = iArr;
            try {
                iArr[as.CT.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                f8628a[as.CM.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                f8628a[as.CU.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
        }
    }

    public static class a {
        private static final s f8629a = new s();
    }

    private s() {
        this.f8585c = new p();
        this.f8587e = new o();
        this.f8586d = new q();
    }

    private n a(boolean z10, int i10) throws RuntimeException {
        as a10 = ar.a(z10, i10);
        int i11 = AnonymousClass7.f8628a[a10.ordinal()];
        n nVar = i11 != 1 ? i11 != 2 ? i11 != 3 ? null : this.f8586d : this.f8587e : this.f8585c;
        if (nVar != null) {
            return nVar;
        }
        throw new IllegalStateException("unSupport operator:" + a10.f8455e);
    }

    public static s a() {
        return a.f8629a;
    }

    private static com.g.gysdk.b a(Throwable th, GyCode gyCode, String str) {
        GyErrorCode gyErrorCode = GyErrorCode.UNSUPPORT_OPERATOR;
        if (!ar.c(d.f8503b)) {
            gyErrorCode = GyErrorCode.NO_SIM_CARD;
        }
        com.g.gysdk.b bVar = new com.g.gysdk.b(gyCode, gyErrorCode, am.a(th));
        if (!TextUtils.isEmpty(str)) {
            bVar.a(str, "");
        }
        return bVar;
    }

    private static void a(final n nVar, final n.e eVar, final boolean z10) {
        if (nVar == null) {
            return;
        }
        String str = nVar.f8541a.f8455e;
        if (eVar == null) {
            ak.c("ELogin_" + str + " init with key=null,builtin=" + z10);
        } else if (nVar.c() == 0) {
            al.a(al.b.Work, new Runnable() {
                @Override
                public void run() {
                    n nVar2 = n.this;
                    n.e eVar2 = eVar;
                    nVar2.a((String) ((Pair) eVar2).first, (String) ((Pair) eVar2).second, z10);
                }
            }, true);
        } else {
            ak.a("ELogin_" + str + " inited before, will use new key in next start up");
        }
    }

    public static long b(long j10, long j11) {
        long currentTimeMillis = System.currentTimeMillis();
        if (j10 > currentTimeMillis) {
            j10 = currentTimeMillis;
        }
        long j12 = j11 - (currentTimeMillis - j10);
        return j12 < 0 ? CoroutineLiveDataKt.DEFAULT_TIMEOUT : j12;
    }

    public void a(long j10, final int i10, final r rVar) {
        try {
            final n a10 = a(true, -1);
            an.a("operator_preLogin", b(j10, i10)).a(a10.d()).a(new an.b() {
                @Override
                public void a(final an anVar) {
                    v e10;
                    if (a10.c() != 2) {
                        anVar.a(new com.g.gysdk.b(GyCode.PRELOGIN_ERROR, GyErrorCode.UNKNOWN_ERROR, "运营商SDK初始化异常"));
                        return;
                    }
                    if (s.f8584b && (e10 = a10.e()) != null && e10.k()) {
                        aj.a("preLogin return cache, fromDisk=" + e10.j());
                        com.g.gysdk.b l6 = e10.l();
                        l6.a("isFrom", Integer.valueOf(e10.j() ? 2 : 1));
                        anVar.a(l6);
                        return;
                    }
                    int f10 = a10.f8541a != as.CM ? j.f() : 1;
                    final AtomicInteger atomicInteger = new AtomicInteger();
                    final AtomicBoolean atomicBoolean = new AtomicBoolean();
                    for (int i11 = 0; i11 < f10; i11++) {
                        final int i12 = f10;
                        a10.a(i10, new n.b() {
                            @Override
                            public void a(v vVar) {
                                if ((atomicInteger.incrementAndGet() >= i12 || vVar.b()) && atomicBoolean.compareAndSet(false, true)) {
                                    com.g.gysdk.b l10 = vVar.l();
                                    if (vVar.b()) {
                                        l10.a("isFrom", (Serializable) 0);
                                        a10.a(vVar);
                                    }
                                    b.a("operator_preLogin", l10.g(), l10.e(), l10.h());
                                    anVar.a(l10);
                                }
                            }
                        });
                    }
                }

                @Override
                public void a(Object obj, Throwable th) {
                    com.g.gysdk.b a11 = com.g.gysdk.b.a(obj);
                    if (a11 == null) {
                        a11 = com.g.gysdk.b.a(GyCode.PRELOGIN_ERROR, th);
                    }
                    rVar.a(a11);
                }
            });
        } catch (Throwable th) {
            rVar.a(a(th, GyCode.PRELOGIN_ERROR, "preLogin"));
        }
    }

    public void a(GyConfig gyConfig) {
        this.f8588f = n.e.a(gyConfig.telecomAppId(), gyConfig.telecomAppKey());
        this.f8589g = n.e.a(gyConfig.unicomAppId(), gyConfig.unicomAppKey());
        this.f8590h = n.e.a(gyConfig.mobileAppId(), gyConfig.mobileAppKey());
        f8584b = gyConfig.preLoginUseCache();
        a(gyConfig.eLoginDebug());
    }

    public void a(n.e eVar, n.e eVar2, n.e eVar3) {
        if (n.e.a(eVar, this.f8591i) && n.e.a(eVar2, this.f8593k) && n.e.a(eVar3, this.f8592j)) {
            ak.a("ELogin saveKey ignored, because no changed");
            return;
        }
        this.f8591i = eVar;
        this.f8593k = eVar2;
        this.f8592j = eVar3;
        a(this.f8587e, this.f8593k, false);
        a(this.f8585c, this.f8591i, false);
        a(this.f8586d, this.f8592j, false);
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("0", d.f8506e);
            if (eVar != null) {
                jSONObject.put(com.umeng.analytics.pro.am.av, ((Pair) eVar).first);
                jSONObject.put("b", ((Pair) eVar).second);
            }
            if (eVar2 != null) {
                jSONObject.put(com.umeng.analytics.pro.am.aF, ((Pair) eVar2).first);
                jSONObject.put("d", ((Pair) eVar2).second);
            }
            if (eVar3 != null) {
                jSONObject.put(com.loc.h.f14245e, ((Pair) eVar3).first);
                jSONObject.put(com.loc.h.f14246f, ((Pair) eVar3).second);
            }
            ak.a("ELogin saveKey, ctKey:" + eVar + " cuKey:" + eVar3 + " cmKey:" + eVar2);
        } catch (Throwable th) {
            ak.e("ELogin saveKey new json error", th);
        }
        g.a().a(2, jSONObject.toString());
    }

    public void a(final String str, long j10, final int i10, final r rVar) {
        try {
            final n a10 = a(true, -1);
            an.a("operator_preVerify", b(j10, i10)).a(a10.d()).a(new an.b() {
                @Override
                public void a(an anVar) {
                    if (a10.c() == 2) {
                        a10.a(str, i10, new n.c() {
                            @Override
                            public void a(w wVar) {
                                rVar.a(wVar.i());
                            }
                        });
                    } else {
                        anVar.a(new com.g.gysdk.b(GyCode.PREVERIFY_ERROR, GyErrorCode.UNKNOWN_ERROR, "运营商SDK初始化异常"));
                    }
                }

                @Override
                public void a(Object obj, Throwable th) {
                    com.g.gysdk.b a11 = com.g.gysdk.b.a(obj);
                    if (a11 == null) {
                        a11 = com.g.gysdk.b.a(GyCode.PREVERIFY_ERROR, th);
                    }
                    rVar.a(a11);
                }
            });
        } catch (Throwable th) {
            rVar.a(a(th, GyCode.PREVERIFY_ERROR, "getAccessCode"));
        }
    }

    public void a(final String str, final String str2, final String str3, int i10, long j10, final int i11, final r rVar) {
        try {
            final n a10 = a(false, i10);
            an.a("verity_wait_register", b(j10, i11)).a("register").a(new an.c() {
                @Override
                public void a(Object obj, Throwable th) {
                    if (e.b() == 2) {
                        a10.a(str, str2, str3, i11, new n.d() {
                            @Override
                            public void a(x xVar) {
                                rVar.a(xVar.i());
                            }
                        });
                    } else {
                        rVar.a(new com.g.gysdk.b(GyCode.VERIFY_ERROR, GyErrorCode.UNKNOWN_ERROR, "注册失败或超时"));
                    }
                }
            });
        } catch (Throwable th) {
            rVar.a(a(th, GyCode.VERIFY_ERROR, (String) null));
        }
    }

    public void a(boolean z10) {
        f8583a = z10;
        n nVar = this.f8585c;
        if (nVar != null) {
            nVar.a(z10);
        }
        n nVar2 = this.f8587e;
        if (nVar2 != null) {
            nVar2.a(z10);
        }
        n nVar3 = this.f8586d;
        if (nVar3 != null) {
            nVar3.a(z10);
        }
    }

    public String b() {
        try {
            return a(false, -1).a();
        } catch (Throwable unused) {
            return null;
        }
    }

    public void b(final long j10, final int i10, final r rVar) {
        if (!e()) {
            rVar.a(new com.g.gysdk.b(GyCode.LOGIN_ERROR, GyErrorCode.INVALID_PRELOGIN, "预登录无效").a("eLogin", ""));
            return;
        }
        try {
            a(false, -1).a(i10, new n.a() {
                @Override
                public void a(final u uVar) {
                    final com.g.gysdk.b j11 = uVar.j();
                    if (uVar.b()) {
                        an.a("login_wait_register", s.b(j10, i10)).a("register").a(new an.c() {
                            @Override
                            public void a(Object obj, Throwable th) {
                                if (e.b() != 2) {
                                    com.g.gysdk.b a10 = e.a();
                                    if (a10 == null) {
                                        a10 = new com.g.gysdk.b(GyCode.LOGIN_ERROR, GyErrorCode.UNKNOWN_ERROR, "注册失败或超时");
                                    }
                                    a10.a("eLogin", s.a().f());
                                    rVar.a(a10);
                                    return;
                                }
                                rVar.a(j11);
                                long currentTimeMillis = System.currentTimeMillis();
                                AnonymousClass2 anonymousClass2 = AnonymousClass2.this;
                                if (currentTimeMillis - j10 < i10 - 100) {
                                    aa.a(uVar.f(), uVar.c(), uVar.d(), uVar.e().f8457g, uVar.i());
                                }
                            }
                        });
                    } else {
                        rVar.a(j11);
                    }
                }
            });
        } catch (Throwable th) {
            rVar.a(a(th, GyCode.LOGIN_ERROR, "eLogin"));
        }
    }

    public boolean b(boolean z10) {
        try {
            return a(z10, -1).f();
        } catch (Throwable th) {
            ak.a(th);
            return false;
        }
    }

    public void c() {
        al.a(al.b.Queue, new Runnable() {
            @Override
            public void run() {
                y.b a10 = y.a();
                if (a10 != null) {
                    s.this.a(n.e.a(a10.a(), a10.b()), n.e.a(a10.e(), a10.f()), n.e.a(a10.c(), a10.d()));
                }
            }
        });
    }

    public void d() {
        boolean z10;
        n nVar;
        n.e eVar;
        try {
            String a10 = g.a().a(2);
            if (TextUtils.isEmpty(a10)) {
                z10 = true;
                a(this.f8587e, this.f8590h, true);
                a(this.f8585c, this.f8588f, true);
                nVar = this.f8586d;
                eVar = this.f8589g;
            } else {
                JSONObject jSONObject = new JSONObject(a10);
                if (!TextUtils.equals(jSONObject.getString("0"), d.f8506e)) {
                    throw new IllegalStateException("not to init eLogin, gy appId changed");
                }
                String optString = jSONObject.optString(com.umeng.analytics.pro.am.av);
                String optString2 = jSONObject.optString("b");
                String optString3 = jSONObject.optString(com.umeng.analytics.pro.am.aF);
                String optString4 = jSONObject.optString("d");
                String optString5 = jSONObject.optString(com.loc.h.f14245e);
                String optString6 = jSONObject.optString(com.loc.h.f14246f);
                this.f8591i = n.e.a(optString, optString2);
                this.f8593k = n.e.a(optString3, optString4);
                this.f8592j = n.e.a(optString5, optString6);
                z10 = false;
                a(this.f8587e, this.f8593k, false);
                a(this.f8585c, this.f8591i, false);
                nVar = this.f8586d;
                eVar = this.f8592j;
            }
            a(nVar, eVar, z10);
        } catch (Throwable th) {
            ak.e("ELogin init error", th);
        }
    }

    public boolean e() {
        return b(false);
    }

    public String f() {
        if (d.a(d.a.DEBUG_UI)) {
            return "proc***id";
        }
        try {
            return a(false, -1).e().f();
        } catch (Throwable th) {
            ak.a(th);
            return "";
        }
    }

    public String g() {
        if (d.a(d.a.DEBUG_UI)) {
            return "888***999";
        }
        try {
            return a(false, -1).e().i();
        } catch (Throwable th) {
            ak.a(th);
            return "";
        }
    }

    public String h() {
        if (d.a(d.a.DEBUG_UI)) {
            return "DEBUG_UI服务";
        }
        int i10 = AnonymousClass7.f8628a[ar.a(false, -1).ordinal()];
        return i10 != 1 ? i10 != 2 ? i10 != 3 ? "Unknown服务" : "认证服务由联通统一认证提供" : "中国移动提供认证服务" : "天翼账号提供认证服务";
    }

    public String[] i() {
        String str;
        String str2;
        if (d.a(d.a.DEBUG_UI)) {
            str = "DEBUG_UI条款";
            str2 = "https://www.getui.com/verification";
        } else {
            int i10 = AnonymousClass7.f8628a[ar.a(false, -1).ordinal()];
            if (i10 == 1) {
                str = "天翼账号服务与隐私协议";
                str2 = "https://e.189.cn/sdk/agreement/detail.do?hidetop=true";
            } else if (i10 == 2) {
                str = "中国移动认证服务条款";
                str2 = "https://wap.cmpassport.com/resources/html/contract.html";
            } else if (i10 != 3) {
                str = "Unknown条款";
                str2 = "https://unknown";
            } else {
                str = "联通统一认证服务条款";
                str2 = "https://opencloud.wostore.cn/authz/resource/html/disclaimer.html?fromsdk=true";
            }
        }
        return new String[]{str, str2};
    }
}