ChatOn v1.35.366360版本的 MD5 值为:cde28447b38d5467efa95e48e7076155

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


package cf;

import android.net.TrafficStats;
import android.text.TextUtils;
import android.util.Log;
import bc.y;
import com.google.firebase.FirebaseException;
import com.google.firebase.installations.local.PersistedInstallation$RegistrationStatus;
import com.google.firebase.installations.remote.InstallationResponse$ResponseCode;
import com.google.firebase.installations.remote.TokenResult$ResponseCode;
import com.itextpdf.text.pdf.codec.TIFFConstants;
import com.qonversion.android.sdk.internal.api.ApiHeadersProvider;
import fe.m;
import h1.t;
import j.v3;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern;
import lc.j;
import lc.s;
import org.json.JSONException;
import org.json.JSONObject;
public final class c implements d {
    public static final Object f2355m = new Object();
    public final yd.h f2356a;
    public final ef.c f2357b;
    public final he.c f2358c;
    public final i f2359d;
    public final m f2360e;
    public final g f2361f;
    public final Object f2362g;
    public final ExecutorService f2363h;
    public final Executor f2364i;
    public String f2365j;
    public final HashSet f2366k;
    public final ArrayList f2367l;

    static {
        new AtomicInteger(1);
    }

    public c(yd.h hVar, bf.c cVar, ExecutorService executorService, com.google.firebase.concurrent.c cVar2) {
        hVar.a();
        ef.c cVar3 = new ef.c(hVar.f21597a, cVar);
        he.c cVar4 = new he.c(hVar);
        if (fb.f.f10142d == null) {
            fb.f.f10142d = new Object();
        }
        fb.f fVar = fb.f.f10142d;
        if (i.f2375d == null) {
            i.f2375d = new i(fVar);
        }
        i iVar = i.f2375d;
        m mVar = new m(new fe.c(2, hVar));
        ?? obj = new Object();
        this.f2362g = new Object();
        this.f2366k = new HashSet();
        this.f2367l = new ArrayList();
        this.f2356a = hVar;
        this.f2357b = cVar3;
        this.f2358c = cVar4;
        this.f2359d = iVar;
        this.f2360e = mVar;
        this.f2361f = obj;
        this.f2363h = executorService;
        this.f2364i = cVar2;
    }

    public static c d() {
        return (c) yd.h.c().b(d.class);
    }

    public final void a(boolean z8) {
        df.a i10;
        synchronized (f2355m) {
            try {
                yd.h hVar = this.f2356a;
                hVar.a();
                he.c a10 = he.c.a(hVar.f21597a);
                i10 = this.f2358c.i();
                PersistedInstallation$RegistrationStatus persistedInstallation$RegistrationStatus = PersistedInstallation$RegistrationStatus.f8299e;
                PersistedInstallation$RegistrationStatus persistedInstallation$RegistrationStatus2 = i10.f9130b;
                if (persistedInstallation$RegistrationStatus2 == persistedInstallation$RegistrationStatus || persistedInstallation$RegistrationStatus2 == PersistedInstallation$RegistrationStatus.f8298d) {
                    String g10 = g(i10);
                    he.c cVar = this.f2358c;
                    v3 a11 = i10.a();
                    a11.f13225a = g10;
                    a11.m(PersistedInstallation$RegistrationStatus.f8300i);
                    i10 = a11.h();
                    cVar.g(i10);
                }
                if (a10 != null) {
                    a10.j();
                }
            } catch (Throwable th2) {
                throw th2;
            }
        }
        if (z8) {
            v3 a12 = i10.a();
            a12.f13227c = null;
            i10 = a12.h();
        }
        j(i10);
        this.f2364i.execute(new b(0, this, z8));
    }

    public final df.a b(df.a aVar) {
        int responseCode;
        ef.b f10;
        yd.h hVar = this.f2356a;
        hVar.a();
        String str = hVar.f21599c.f21612a;
        String str2 = aVar.f9129a;
        yd.h hVar2 = this.f2356a;
        hVar2.a();
        String str3 = hVar2.f21599c.f21618g;
        String str4 = aVar.f9132d;
        ef.c cVar = this.f2357b;
        ef.d dVar = cVar.f9907c;
        if (dVar.a()) {
            URL a10 = ef.c.a(String.format("projects/%s/installations/%s/authTokens:generate", str3, str2));
            for (int i10 = 0; i10 <= 1; i10++) {
                TrafficStats.setThreadStatsTag(TIFFConstants.COMPRESSION_CCITTRLEW);
                HttpURLConnection c10 = cVar.c(a10, str);
                try {
                    c10.setRequestMethod("POST");
                    c10.addRequestProperty(ApiHeadersProvider.AUTHORIZATION, "FIS_v2 " + str4);
                    c10.setDoOutput(true);
                    ef.c.h(c10);
                    responseCode = c10.getResponseCode();
                    dVar.b(responseCode);
                } catch (IOException | AssertionError unused) {
                } catch (Throwable th2) {
                    c10.disconnect();
                    TrafficStats.clearThreadStatsTag();
                    throw th2;
                }
                if (responseCode >= 200 && responseCode < 300) {
                    f10 = ef.c.f(c10);
                } else {
                    ef.c.b(c10, null, str, str3);
                    if (responseCode == 401 || responseCode == 404) {
                        ie.d a11 = ef.b.a();
                        a11.f12811i = TokenResult$ResponseCode.f8309i;
                        f10 = a11.d();
                    } else if (responseCode == 429) {
                        throw new FirebaseException("Firebase servers have received too many requests from this client in a short period of time. Please try again later.");
                    } else {
                        if (responseCode < 500 || responseCode >= 600) {
                            Log.e("Firebase-Installations", "Firebase Installations can not communicate with Firebase server APIs due to invalid configuration. Please update your Firebase initialization process and set valid Firebase options (API key, Project ID, Application ID) when initializing Firebase.");
                            ie.d a12 = ef.b.a();
                            a12.f12811i = TokenResult$ResponseCode.f8308e;
                            f10 = a12.d();
                        }
                        c10.disconnect();
                        TrafficStats.clearThreadStatsTag();
                    }
                }
                c10.disconnect();
                TrafficStats.clearThreadStatsTag();
                int ordinal = f10.f9902c.ordinal();
                if (ordinal == 0) {
                    i iVar = this.f2359d;
                    iVar.getClass();
                    TimeUnit timeUnit = TimeUnit.MILLISECONDS;
                    iVar.f2376a.getClass();
                    long seconds = timeUnit.toSeconds(System.currentTimeMillis());
                    v3 a13 = aVar.a();
                    a13.f13227c = f10.f9900a;
                    a13.f13229e = Long.valueOf(f10.f9901b);
                    a13.f13230f = Long.valueOf(seconds);
                    return a13.h();
                } else if (ordinal == 1) {
                    v3 a14 = aVar.a();
                    a14.f13231g = "BAD CONFIG";
                    a14.m(PersistedInstallation$RegistrationStatus.f8302v);
                    return a14.h();
                } else if (ordinal == 2) {
                    synchronized (this) {
                        this.f2365j = null;
                    }
                    v3 a15 = aVar.a();
                    a15.m(PersistedInstallation$RegistrationStatus.f8299e);
                    return a15.h();
                } else {
                    throw new FirebaseException("Firebase Installations Service is unavailable. Please try again later.");
                }
            }
            throw new FirebaseException("Firebase Installations Service is unavailable. Please try again later.");
        }
        throw new FirebaseException("Firebase Installations Service is unavailable. Please try again later.");
    }

    public final s c() {
        String str;
        f();
        synchronized (this) {
            str = this.f2365j;
        }
        if (str != null) {
            return j.e(str);
        }
        lc.h hVar = new lc.h();
        f fVar = new f(hVar);
        synchronized (this.f2362g) {
            this.f2367l.add(fVar);
        }
        s sVar = hVar.f16244a;
        this.f2363h.execute(new androidx.activity.d(19, this));
        return sVar;
    }

    public final s e() {
        f();
        lc.h hVar = new lc.h();
        e eVar = new e(this.f2359d, hVar);
        synchronized (this.f2362g) {
            this.f2367l.add(eVar);
        }
        this.f2363h.execute(new b(1, this, false));
        return hVar.f16244a;
    }

    public final void f() {
        yd.h hVar = this.f2356a;
        hVar.a();
        y.h("Please set your Application ID. A valid Firebase App ID is required to communicate with Firebase server APIs: It identifies your application with Firebase.Please refer to https://firebase.google.com/support/privacy/init-options.", hVar.f21599c.f21613b);
        hVar.a();
        y.h("Please set your Project ID. A valid Firebase Project ID is required to communicate with Firebase server APIs: It identifies your application with Firebase.Please refer to https://firebase.google.com/support/privacy/init-options.", hVar.f21599c.f21618g);
        hVar.a();
        y.h("Please set a valid API key. A Firebase API key is required to communicate with Firebase server APIs: It authenticates your project with Google.Please refer to https://firebase.google.com/support/privacy/init-options.", hVar.f21599c.f21612a);
        hVar.a();
        String str = hVar.f21599c.f21613b;
        Pattern pattern = i.f2374c;
        y.c("Please set your Application ID. A valid Firebase App ID is required to communicate with Firebase server APIs: It identifies your application with Firebase.Please refer to https://firebase.google.com/support/privacy/init-options.", str.contains(":"));
        hVar.a();
        y.c("Please set a valid API key. A Firebase API key is required to communicate with Firebase server APIs: It authenticates your project with Google.Please refer to https://firebase.google.com/support/privacy/init-options.", i.f2374c.matcher(hVar.f21599c.f21612a).matches());
    }

    public final String g(df.a aVar) {
        String string;
        yd.h hVar = this.f2356a;
        hVar.a();
        if (!hVar.f21598b.equals("CHIME_ANDROID_SDK")) {
            yd.h hVar2 = this.f2356a;
            hVar2.a();
        }
        if (aVar.f9130b == PersistedInstallation$RegistrationStatus.f8298d) {
            df.b bVar = (df.b) this.f2360e.get();
            synchronized (bVar.f9137a) {
                try {
                    synchronized (bVar.f9137a) {
                        string = bVar.f9137a.getString("|S|id", null);
                    }
                    if (string == null) {
                        string = bVar.a();
                    }
                } finally {
                }
            }
            if (TextUtils.isEmpty(string)) {
                this.f2361f.getClass();
                return g.a();
            }
            return string;
        }
        this.f2361f.getClass();
        return g.a();
    }

    public final df.a h(df.a aVar) {
        int responseCode;
        ef.a aVar2;
        String str = aVar.f9129a;
        String str2 = null;
        if (str != null && str.length() == 11) {
            df.b bVar = (df.b) this.f2360e.get();
            synchronized (bVar.f9137a) {
                try {
                    String[] strArr = df.b.f9136c;
                    int i10 = 0;
                    while (true) {
                        if (i10 < 4) {
                            String str3 = strArr[i10];
                            String string = bVar.f9137a.getString("|T|" + bVar.f9138b + "|" + str3, null);
                            if (string == null || string.isEmpty()) {
                                i10++;
                            } else if (string.startsWith("{")) {
                                try {
                                    str2 = new JSONObject(string).getString("token");
                                } catch (JSONException unused) {
                                }
                            } else {
                                str2 = string;
                            }
                        }
                    }
                } finally {
                }
            }
        }
        ef.c cVar = this.f2357b;
        yd.h hVar = this.f2356a;
        hVar.a();
        String str4 = hVar.f21599c.f21612a;
        String str5 = aVar.f9129a;
        yd.h hVar2 = this.f2356a;
        hVar2.a();
        String str6 = hVar2.f21599c.f21618g;
        yd.h hVar3 = this.f2356a;
        hVar3.a();
        String str7 = hVar3.f21599c.f21613b;
        ef.d dVar = cVar.f9907c;
        if (dVar.a()) {
            URL a10 = ef.c.a(String.format("projects/%s/installations", str6));
            for (int i11 = 0; i11 <= 1; i11++) {
                TrafficStats.setThreadStatsTag(32769);
                HttpURLConnection c10 = cVar.c(a10, str4);
                try {
                    c10.setRequestMethod("POST");
                    c10.setDoOutput(true);
                    if (str2 != null) {
                        c10.addRequestProperty("x-goog-fis-android-iid-migration-auth", str2);
                    }
                    ef.c.g(c10, str5, str7);
                    responseCode = c10.getResponseCode();
                    dVar.b(responseCode);
                } catch (IOException | AssertionError unused2) {
                } catch (Throwable th2) {
                    c10.disconnect();
                    TrafficStats.clearThreadStatsTag();
                    throw th2;
                }
                if (responseCode < 200 || responseCode >= 300) {
                    ef.c.b(c10, str7, str4, str6);
                    if (responseCode == 429) {
                        throw new FirebaseException("Firebase servers have received too many requests from this client in a short period of time. Please try again later.");
                    }
                    if (responseCode < 500 || responseCode >= 600) {
                        Log.e("Firebase-Installations", "Firebase Installations can not communicate with Firebase server APIs due to invalid configuration. Please update your Firebase initialization process and set valid Firebase options (API key, Project ID, Application ID) when initializing Firebase.");
                        t tVar = new t(10);
                        InstallationResponse$ResponseCode installationResponse$ResponseCode = InstallationResponse$ResponseCode.f8305e;
                        tVar.f11545v = installationResponse$ResponseCode;
                        ef.a aVar3 = new ef.a((String) tVar.f11541d, (String) tVar.f11542e, (String) tVar.f11543i, (ef.b) tVar.f11544n, installationResponse$ResponseCode);
                        c10.disconnect();
                        TrafficStats.clearThreadStatsTag();
                        aVar2 = aVar3;
                    }
                    c10.disconnect();
                    TrafficStats.clearThreadStatsTag();
                } else {
                    aVar2 = ef.c.e(c10);
                    c10.disconnect();
                    TrafficStats.clearThreadStatsTag();
                }
                int ordinal = aVar2.f9899e.ordinal();
                if (ordinal != 0) {
                    if (ordinal == 1) {
                        v3 a11 = aVar.a();
                        a11.f13231g = "BAD CONFIG";
                        a11.m(PersistedInstallation$RegistrationStatus.f8302v);
                        return a11.h();
                    }
                    throw new FirebaseException("Firebase Installations Service is unavailable. Please try again later.");
                }
                String str8 = aVar2.f9896b;
                String str9 = aVar2.f9897c;
                i iVar = this.f2359d;
                iVar.getClass();
                TimeUnit timeUnit = TimeUnit.MILLISECONDS;
                iVar.f2376a.getClass();
                long seconds = timeUnit.toSeconds(System.currentTimeMillis());
                ef.b bVar2 = aVar2.f9898d;
                String str10 = bVar2.f9900a;
                long j10 = bVar2.f9901b;
                v3 a12 = aVar.a();
                a12.f13225a = str8;
                a12.m(PersistedInstallation$RegistrationStatus.f8301n);
                a12.f13227c = str10;
                a12.f13228d = str9;
                a12.f13229e = Long.valueOf(j10);
                a12.f13230f = Long.valueOf(seconds);
                return a12.h();
            }
            throw new FirebaseException("Firebase Installations Service is unavailable. Please try again later.");
        }
        throw new FirebaseException("Firebase Installations Service is unavailable. Please try again later.");
    }

    public final void i(Exception exc) {
        synchronized (this.f2362g) {
            try {
                Iterator it = this.f2367l.iterator();
                while (it.hasNext()) {
                    if (((h) it.next()).b(exc)) {
                        it.remove();
                    }
                }
            } catch (Throwable th2) {
                throw th2;
            }
        }
    }

    public final void j(df.a aVar) {
        synchronized (this.f2362g) {
            try {
                Iterator it = this.f2367l.iterator();
                while (it.hasNext()) {
                    if (((h) it.next()).a(aVar)) {
                        it.remove();
                    }
                }
            } catch (Throwable th2) {
                throw th2;
            }
        }
    }
}