WeChat.apk(点击下载) / c0.java


package com.tencent.mm.plugin.lite.jsapi.comms;

import android.os.Bundle;
import com.tencent.mm.plugin.lite.LiteAppCenter;
import com.tencent.mm.plugin.lite.api.c;
import com.tencent.mm.plugin.lite.i;
import com.tencent.mm.plugin.lite.logic.m;
import com.tencent.mm.plugin.lite.storage.d;
import com.tencent.mm.sdk.platformtools.Log;
import ed2.a;
import java.util.Map;
import ku.f;
import org.json.JSONException;
import org.json.JSONObject;
import yz3.j;

public class c0 extends c {

    public class a implements Runnable {

        /* renamed from: d  reason: collision with root package name */
        public final /* synthetic */ boolean[] f129174d;

        public a(boolean[] zArr) {
            this.f129174d = zArr;
        }

        public void run() {
            synchronized (this.f129174d) {
                if (!this.f129174d[0]) {
                    Log.w("LiteAppJsApiLogin", "geta8key timeout");
                    this.f129174d[0] = true;
                    c0.this.f129114f.a("getA8Key timeout");
                }
            }
        }
    }

    public class b implements a.e {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ boolean[] f129176a;

        /* renamed from: b  reason: collision with root package name */
        public final /* synthetic */ String f129177b;

        /* renamed from: c  reason: collision with root package name */
        public final /* synthetic */ boolean f129178c;

        /* renamed from: d  reason: collision with root package name */
        public final /* synthetic */ String[] f129179d;

        public b(boolean[] zArr, String str, boolean z15, String[] strArr) {
            this.f129176a = zArr;
            this.f129177b = str;
            this.f129178c = z15;
            this.f129179d = strArr;
        }

        @Override // ed2.a.e
        public void a() {
            synchronized (this.f129176a) {
                if (!this.f129176a[0]) {
                    Log.w("LiteAppJsApiLogin", "geta8key fail");
                    this.f129176a[0] = true;
                    c0.this.f129114f.a("getA8Key fail");
                }
            }
        }

        @Override // ed2.a.e
        public void b(a.d dVar) {
            Bundle extraData;
            synchronized (this.f129176a) {
                if (!this.f129176a[0]) {
                    Log.i("LiteAppJsApiLogin", "geta8key:" + this.f129177b);
                    this.f129176a[0] = true;
                    String str = this.f129177b;
                    if (str != null && i.f129135b.contains(str)) {
                        dVar.f206905c.put("referer", "https://game.weixin.qq.com/");
                    }
                    LiteAppCenter.ILiteAppUICallback uICallback = LiteAppCenter.getUICallback(Integer.valueOf(c0.this.f129113e.f323867a));
                    if (!(uICallback == null || (extraData = uICallback.getExtraData()) == null)) {
                        extraData.putInt("sessionId", dVar.f206904b);
                    }
                    LiteAppCenter.setAuthInfo(this.f129177b, dVar.f206903a, dVar.f206905c, dVar.f206906d, this.f129178c);
                    d dVar2 = new d();
                    dVar2.field_host = this.f129179d[0];
                    JSONObject jSONObject = new JSONObject();
                    Map<String, String> map = dVar.f206906d;
                    if (map != null) {
                        for (Map.Entry<String, String> entry : map.entrySet()) {
                            try {
                                jSONObject.put(entry.getKey(), entry.getValue());
                            } catch (JSONException unused) {
                            }
                        }
                    }
                    dVar2.field_param = dVar.f206903a;
                    dVar2.field_paramMap = jSONObject.toString();
                    dVar2.field_updateTime = System.currentTimeMillis() / 1000;
                    dVar2.field_headerMap = new JSONObject(dVar.f206905c).toString();
                    m.j().y(dVar2);
                    c0.this.f129114f.d(jSONObject, false);
                    Log.i("LiteAppJsApiLogin", "geta8key success");
                }
            }
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:33:0x0094  */
    /* JADX WARNING: Removed duplicated region for block: B:34:0x00a2  */
    @Override // va.a
    public void a(String str, JSONObject jSONObject, boolean z15) {
        boolean z16;
        boolean z17 = true;
        boolean[] zArr = {false};
        String[] strArr = {null};
        try {
            if (jSONObject.has("url")) {
                strArr[0] = jSONObject.getString("url");
            }
            if (strArr[0] == null) {
                strArr[0] = ((f) j.c(f.class)).pY(str, this.f129113e.f323867a);
            }
            if (jSONObject.has("passAll")) {
                z17 = jSONObject.getBoolean("passAll");
            }
            if (jSONObject.has("usePreAuth")) {
                z16 = jSONObject.getBoolean("usePreAuth");
            } else {
                z16 = false;
            }
            try {
                String str2 = strArr[0];
                if (str2 != null) {
                    if (!str2.isEmpty()) {
                        long j15 = 60000;
                        if (jSONObject.has("timeout")) {
                            j15 = jSONObject.getLong("timeout");
                        }
                        ((xc4.j) xc4.j.f338034d).i(new a(zArr), j15);
                        String str3 = strArr[0];
                        b bVar = new b(zArr, str, z15, strArr);
                        if (z16) {
                            ed2.a aVar = ed2.a.INSTANCE;
                            aVar.getClass();
                            aVar.c(new ed2.b(aVar, str3, z17, bVar));
                            return;
                        }
                        ed2.a.INSTANCE.a(str3, z17, bVar);
                        return;
                    }
                }
                Log.w("LiteAppJsApiLogin", "get authurl fail");
                this.f129114f.a("get authUrl fail, please make sure config authUrl in config file");
            } catch (JSONException unused) {
                this.f129114f.a("json exception");
                String str32 = strArr[0];
                b bVar2 = new b(zArr, str, z15, strArr);
                if (z16) {
                }
            }
        } catch (JSONException unused2) {
            z16 = false;
            this.f129114f.a("json exception");
            String str322 = strArr[0];
            b bVar22 = new b(zArr, str, z15, strArr);
            if (z16) {
            }
        }
    }
}