ChatOn v1.35.366360版本的 MD5 值为:cde28447b38d5467efa95e48e7076155
以下内容为反编译后的 c.java 源代码,内容仅作参考
package ef;
import af.f;
import android.content.Context;
import android.content.pm.PackageManager;
import android.text.TextUtils;
import android.util.JsonReader;
import android.util.Log;
import bc.y;
import com.google.firebase.FirebaseException;
import com.google.firebase.installations.remote.InstallationResponse$ResponseCode;
import com.google.firebase.installations.remote.TokenResult$ResponseCode;
import com.itextpdf.text.pdf.PdfObject;
import com.itextpdf.text.xml.xmp.XmpWriter;
import com.qonversion.android.sdk.internal.api.ApiHeadersProvider;
import ec.k0;
import h1.t;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.Charset;
import java.util.concurrent.ExecutionException;
import java.util.regex.Pattern;
import java.util.zip.GZIPOutputStream;
import lc.j;
import org.json.JSONException;
import org.json.JSONObject;
public final class c {
public static final Pattern f9903d = Pattern.compile("[0-9]+s");
public static final Charset f9904e = Charset.forName(XmpWriter.UTF8);
public final Context f9905a;
public final bf.c f9906b;
public final d f9907c = new d();
public c(Context context, bf.c cVar) {
this.f9905a = context;
this.f9906b = cVar;
}
public static URL a(String str) {
try {
return new URL(String.format("https://%s/%s/%s", "firebaseinstallations.googleapis.com", "v1", str));
} catch (MalformedURLException e10) {
throw new FirebaseException(e10.getMessage());
}
}
public static void b(HttpURLConnection httpURLConnection, String str, String str2, String str3) {
InputStream errorStream = httpURLConnection.getErrorStream();
String str4 = null;
if (errorStream != null) {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(errorStream, f9904e));
try {
StringBuilder sb2 = new StringBuilder();
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
sb2.append(readLine);
sb2.append('\n');
}
str4 = String.format("Error when communicating with the Firebase Installations server API. HTTP response: [%d %s: %s]", Integer.valueOf(httpURLConnection.getResponseCode()), httpURLConnection.getResponseMessage(), sb2);
} catch (IOException unused) {
} catch (Throwable th2) {
try {
bufferedReader.close();
} catch (IOException unused2) {
}
throw th2;
}
try {
bufferedReader.close();
} catch (IOException unused3) {
}
}
if (TextUtils.isEmpty(str4)) {
return;
}
Log.w("Firebase-Installations", str4);
Object[] objArr = new Object[3];
objArr[0] = str2;
objArr[1] = str3;
objArr[2] = TextUtils.isEmpty(str) ? PdfObject.NOTHING : k0.k(", ", str);
Log.w("Firebase-Installations", String.format("Firebase options used while communicating with Firebase server APIs: %s, %s%s", objArr));
}
public static long d(String str) {
y.c("Invalid Expiration Timestamp.", f9903d.matcher(str).matches());
if (str == null || str.length() == 0) {
return 0L;
}
return Long.parseLong(str.substring(0, str.length() - 1));
}
public static a e(HttpURLConnection httpURLConnection) {
InputStream inputStream = httpURLConnection.getInputStream();
JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, f9904e));
ie.d a10 = b.a();
t tVar = new t(10);
jsonReader.beginObject();
while (jsonReader.hasNext()) {
String nextName = jsonReader.nextName();
if (nextName.equals("name")) {
tVar.f11541d = jsonReader.nextString();
} else if (nextName.equals("fid")) {
tVar.f11542e = jsonReader.nextString();
} else if (nextName.equals("refreshToken")) {
tVar.f11543i = jsonReader.nextString();
} else if (nextName.equals("authToken")) {
jsonReader.beginObject();
while (jsonReader.hasNext()) {
String nextName2 = jsonReader.nextName();
if (nextName2.equals("token")) {
a10.f12809d = jsonReader.nextString();
} else if (nextName2.equals("expiresIn")) {
a10.f12810e = Long.valueOf(d(jsonReader.nextString()));
} else {
jsonReader.skipValue();
}
}
tVar.f11544n = a10.d();
jsonReader.endObject();
} else {
jsonReader.skipValue();
}
}
jsonReader.endObject();
jsonReader.close();
inputStream.close();
InstallationResponse$ResponseCode installationResponse$ResponseCode = InstallationResponse$ResponseCode.f8304d;
tVar.f11545v = installationResponse$ResponseCode;
return new a((String) tVar.f11541d, (String) tVar.f11542e, (String) tVar.f11543i, (b) tVar.f11544n, installationResponse$ResponseCode);
}
public static b f(HttpURLConnection httpURLConnection) {
InputStream inputStream = httpURLConnection.getInputStream();
JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, f9904e));
ie.d a10 = b.a();
jsonReader.beginObject();
while (jsonReader.hasNext()) {
String nextName = jsonReader.nextName();
if (nextName.equals("token")) {
a10.f12809d = jsonReader.nextString();
} else if (nextName.equals("expiresIn")) {
a10.f12810e = Long.valueOf(d(jsonReader.nextString()));
} else {
jsonReader.skipValue();
}
}
jsonReader.endObject();
jsonReader.close();
inputStream.close();
a10.f12811i = TokenResult$ResponseCode.f8307d;
return a10.d();
}
public static void g(HttpURLConnection httpURLConnection, String str, String str2) {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("fid", str);
jSONObject.put("appId", str2);
jSONObject.put("authVersion", "FIS_v2");
jSONObject.put("sdkVersion", "a:17.2.0");
i(httpURLConnection, jSONObject.toString().getBytes(XmpWriter.UTF8));
} catch (JSONException e10) {
throw new IllegalStateException(e10);
}
}
public static void h(HttpURLConnection httpURLConnection) {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("sdkVersion", "a:17.2.0");
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("installation", jSONObject);
i(httpURLConnection, jSONObject2.toString().getBytes(XmpWriter.UTF8));
} catch (JSONException e10) {
throw new IllegalStateException(e10);
}
}
public static void i(URLConnection uRLConnection, byte[] bArr) {
OutputStream outputStream = uRLConnection.getOutputStream();
if (outputStream == null) {
throw new IOException("Cannot send request to FIS servers. No OutputStream available.");
}
GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(outputStream);
try {
gZIPOutputStream.write(bArr);
} finally {
try {
gZIPOutputStream.close();
outputStream.close();
} catch (IOException unused) {
}
}
}
public final HttpURLConnection c(URL url, String str) {
try {
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setConnectTimeout(10000);
httpURLConnection.setUseCaches(false);
httpURLConnection.setReadTimeout(10000);
httpURLConnection.addRequestProperty(ApiHeadersProvider.CONTENT_TYPE, "application/json");
httpURLConnection.addRequestProperty("Accept", "application/json");
httpURLConnection.addRequestProperty("Content-Encoding", "gzip");
httpURLConnection.addRequestProperty("Cache-Control", "no-cache");
Context context = this.f9905a;
httpURLConnection.addRequestProperty("X-Android-Package", context.getPackageName());
f fVar = (f) this.f9906b.get();
if (fVar != null) {
try {
httpURLConnection.addRequestProperty("x-firebase-client", (String) j.a(((af.d) fVar).a()));
} catch (InterruptedException e10) {
Thread.currentThread().interrupt();
Log.w("ContentValues", "Failed to get heartbeats header", e10);
} catch (ExecutionException e11) {
Log.w("ContentValues", "Failed to get heartbeats header", e11);
}
}
String str2 = null;
try {
byte[] c10 = ub.c.c(context, context.getPackageName());
if (c10 == null) {
Log.e("ContentValues", "Could not get fingerprint hash for package: " + context.getPackageName());
} else {
str2 = ub.c.a(c10);
}
} catch (PackageManager.NameNotFoundException e12) {
Log.e("ContentValues", "No such package: " + context.getPackageName(), e12);
}
httpURLConnection.addRequestProperty("X-Android-Cert", str2);
httpURLConnection.addRequestProperty("x-goog-api-key", str);
return httpURLConnection;
} catch (IOException unused) {
throw new FirebaseException("Firebase Installations Service is unavailable. Please try again later.");
}
}
}