- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
389 lines
20 KiB
Java
389 lines
20 KiB
Java
package com.facebook;
|
|
|
|
import android.util.Log;
|
|
import com.facebook.AccessToken;
|
|
import com.facebook.internal.Logger;
|
|
import com.facebook.internal.Utility;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.net.HttpURLConnection;
|
|
import java.net.MalformedURLException;
|
|
import java.net.URL;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Locale;
|
|
import kotlin.collections.CollectionsKt__IterablesKt;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.jvm.internal.StringCompanionObject;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONTokener;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class GraphResponse {
|
|
private static final String BODY_KEY = "body";
|
|
private static final String CODE_KEY = "code";
|
|
public static final String NON_JSON_RESPONSE_PROPERTY = "FACEBOOK_NON_JSON_RESULT";
|
|
private static final String RESPONSE_LOG_TAG = "Response";
|
|
public static final String SUCCESS_KEY = "success";
|
|
private final HttpURLConnection connection;
|
|
private final FacebookRequestError error;
|
|
private final JSONObject graphObject;
|
|
private final JSONArray graphObjectArray;
|
|
private final JSONArray jsonArray;
|
|
private final JSONObject jsonObject;
|
|
private final String rawResponse;
|
|
private final GraphRequest request;
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final String TAG = GraphResponse.class.getCanonicalName();
|
|
|
|
public static final List<GraphResponse> constructErrorResponses(List<GraphRequest> list, HttpURLConnection httpURLConnection, FacebookException facebookException) {
|
|
return Companion.constructErrorResponses(list, httpURLConnection, facebookException);
|
|
}
|
|
|
|
public final HttpURLConnection getConnection() {
|
|
return this.connection;
|
|
}
|
|
|
|
public final FacebookRequestError getError() {
|
|
return this.error;
|
|
}
|
|
|
|
public final JSONArray getJSONArray() {
|
|
return this.graphObjectArray;
|
|
}
|
|
|
|
public final JSONObject getJSONObject() {
|
|
return this.graphObject;
|
|
}
|
|
|
|
public final JSONArray getJsonArray() {
|
|
return this.jsonArray;
|
|
}
|
|
|
|
public final JSONObject getJsonObject() {
|
|
return this.jsonObject;
|
|
}
|
|
|
|
public final String getRawResponse() {
|
|
return this.rawResponse;
|
|
}
|
|
|
|
public final GraphRequest getRequest() {
|
|
return this.request;
|
|
}
|
|
|
|
public GraphResponse(GraphRequest request, HttpURLConnection httpURLConnection, String str, JSONObject jSONObject, JSONArray jSONArray, FacebookRequestError facebookRequestError) {
|
|
Intrinsics.checkNotNullParameter(request, "request");
|
|
this.request = request;
|
|
this.connection = httpURLConnection;
|
|
this.rawResponse = str;
|
|
this.graphObject = jSONObject;
|
|
this.graphObjectArray = jSONArray;
|
|
this.error = facebookRequestError;
|
|
this.jsonObject = jSONObject;
|
|
this.jsonArray = jSONArray;
|
|
}
|
|
|
|
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
|
|
public GraphResponse(GraphRequest request, HttpURLConnection httpURLConnection, String rawResponse, JSONObject jSONObject) {
|
|
this(request, httpURLConnection, rawResponse, jSONObject, null, null);
|
|
Intrinsics.checkNotNullParameter(request, "request");
|
|
Intrinsics.checkNotNullParameter(rawResponse, "rawResponse");
|
|
}
|
|
|
|
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
|
|
public GraphResponse(GraphRequest request, HttpURLConnection httpURLConnection, String rawResponse, JSONArray graphObjects) {
|
|
this(request, httpURLConnection, rawResponse, null, graphObjects, null);
|
|
Intrinsics.checkNotNullParameter(request, "request");
|
|
Intrinsics.checkNotNullParameter(rawResponse, "rawResponse");
|
|
Intrinsics.checkNotNullParameter(graphObjects, "graphObjects");
|
|
}
|
|
|
|
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
|
|
public GraphResponse(GraphRequest request, HttpURLConnection httpURLConnection, FacebookRequestError error) {
|
|
this(request, httpURLConnection, null, null, null, error);
|
|
Intrinsics.checkNotNullParameter(request, "request");
|
|
Intrinsics.checkNotNullParameter(error, "error");
|
|
}
|
|
|
|
public enum PagingDirection {
|
|
NEXT,
|
|
PREVIOUS;
|
|
|
|
/* renamed from: values, reason: to resolve conflict with enum method */
|
|
public static PagingDirection[] valuesCustom() {
|
|
PagingDirection[] valuesCustom = values();
|
|
return (PagingDirection[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
|
|
}
|
|
}
|
|
|
|
public final GraphRequest getRequestForPagedResults(PagingDirection direction) {
|
|
String str;
|
|
JSONObject optJSONObject;
|
|
Intrinsics.checkNotNullParameter(direction, "direction");
|
|
JSONObject jSONObject = this.graphObject;
|
|
if (jSONObject == null || (optJSONObject = jSONObject.optJSONObject("paging")) == null) {
|
|
str = null;
|
|
} else if (direction == PagingDirection.NEXT) {
|
|
str = optJSONObject.optString("next");
|
|
} else {
|
|
str = optJSONObject.optString("previous");
|
|
}
|
|
if (Utility.isNullOrEmpty(str)) {
|
|
return null;
|
|
}
|
|
if (str != null && Intrinsics.areEqual(str, this.request.getUrlForSingleRequest())) {
|
|
return null;
|
|
}
|
|
try {
|
|
return new GraphRequest(this.request.getAccessToken(), new URL(str));
|
|
} catch (MalformedURLException unused) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public String toString() {
|
|
String str;
|
|
try {
|
|
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
|
|
Locale locale = Locale.US;
|
|
Object[] objArr = new Object[1];
|
|
HttpURLConnection httpURLConnection = this.connection;
|
|
objArr[0] = Integer.valueOf(httpURLConnection == null ? 200 : httpURLConnection.getResponseCode());
|
|
str = String.format(locale, "%d", Arrays.copyOf(objArr, 1));
|
|
Intrinsics.checkNotNullExpressionValue(str, "java.lang.String.format(locale, format, *args)");
|
|
} catch (IOException unused) {
|
|
str = "unknown";
|
|
}
|
|
String str2 = "{Response: responseCode: " + str + ", graphObject: " + this.graphObject + ", error: " + this.error + "}";
|
|
Intrinsics.checkNotNullExpressionValue(str2, "StringBuilder()\n .append(\"{Response: \")\n .append(\" responseCode: \")\n .append(responseCode)\n .append(\", graphObject: \")\n .append(graphObject)\n .append(\", error: \")\n .append(error)\n .append(\"}\")\n .toString()");
|
|
return str2;
|
|
}
|
|
|
|
public static final class Companion {
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
private Companion() {
|
|
}
|
|
|
|
public final List<GraphResponse> fromHttpConnection$facebook_core_release(HttpURLConnection connection, GraphRequestBatch requests) {
|
|
List<GraphResponse> constructErrorResponses;
|
|
Intrinsics.checkNotNullParameter(connection, "connection");
|
|
Intrinsics.checkNotNullParameter(requests, "requests");
|
|
InputStream inputStream = null;
|
|
try {
|
|
try {
|
|
try {
|
|
} catch (FacebookException e) {
|
|
Logger.Companion.log(LoggingBehavior.REQUESTS, GraphResponse.RESPONSE_LOG_TAG, "Response <Error>: %s", e);
|
|
constructErrorResponses = constructErrorResponses(requests, connection, e);
|
|
}
|
|
} catch (Exception e2) {
|
|
Logger.Companion.log(LoggingBehavior.REQUESTS, GraphResponse.RESPONSE_LOG_TAG, "Response <Error>: %s", e2);
|
|
constructErrorResponses = constructErrorResponses(requests, connection, new FacebookException(e2));
|
|
}
|
|
if (!FacebookSdk.isFullyInitialized()) {
|
|
Log.e(GraphResponse.TAG, "GraphRequest can't be used when Facebook SDK isn't fully initialized");
|
|
throw new FacebookException("GraphRequest can't be used when Facebook SDK isn't fully initialized");
|
|
}
|
|
if (connection.getResponseCode() >= 400) {
|
|
inputStream = connection.getErrorStream();
|
|
} else {
|
|
inputStream = connection.getInputStream();
|
|
}
|
|
constructErrorResponses = createResponsesFromStream$facebook_core_release(inputStream, connection, requests);
|
|
Utility.closeQuietly(inputStream);
|
|
return constructErrorResponses;
|
|
} catch (Throwable th) {
|
|
Utility.closeQuietly(null);
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
public final List<GraphResponse> createResponsesFromStream$facebook_core_release(InputStream inputStream, HttpURLConnection httpURLConnection, GraphRequestBatch requests) throws FacebookException, JSONException, IOException {
|
|
Intrinsics.checkNotNullParameter(requests, "requests");
|
|
String readStreamToString = Utility.readStreamToString(inputStream);
|
|
Logger.Companion.log(LoggingBehavior.INCLUDE_RAW_RESPONSES, GraphResponse.RESPONSE_LOG_TAG, "Response (raw)\n Size: %d\n Response:\n%s\n", Integer.valueOf(readStreamToString.length()), readStreamToString);
|
|
return createResponsesFromString$facebook_core_release(readStreamToString, httpURLConnection, requests);
|
|
}
|
|
|
|
public final List<GraphResponse> createResponsesFromString$facebook_core_release(String responseString, HttpURLConnection httpURLConnection, GraphRequestBatch requests) throws FacebookException, JSONException, IOException {
|
|
Intrinsics.checkNotNullParameter(responseString, "responseString");
|
|
Intrinsics.checkNotNullParameter(requests, "requests");
|
|
Object resultObject = new JSONTokener(responseString).nextValue();
|
|
Intrinsics.checkNotNullExpressionValue(resultObject, "resultObject");
|
|
List<GraphResponse> createResponsesFromObject = createResponsesFromObject(httpURLConnection, requests, resultObject);
|
|
Logger.Companion.log(LoggingBehavior.REQUESTS, GraphResponse.RESPONSE_LOG_TAG, "Response\n Id: %s\n Size: %d\n Responses:\n%s\n", requests.getId(), Integer.valueOf(responseString.length()), createResponsesFromObject);
|
|
return createResponsesFromObject;
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:11:0x0058 */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
private final java.util.List<com.facebook.GraphResponse> createResponsesFromObject(java.net.HttpURLConnection r9, java.util.List<com.facebook.GraphRequest> r10, java.lang.Object r11) throws com.facebook.FacebookException, org.json.JSONException {
|
|
/*
|
|
r8 = this;
|
|
int r0 = r10.size()
|
|
java.util.ArrayList r1 = new java.util.ArrayList
|
|
r1.<init>(r0)
|
|
r2 = 1
|
|
r3 = 0
|
|
if (r0 != r2) goto L53
|
|
java.lang.Object r2 = r10.get(r3)
|
|
com.facebook.GraphRequest r2 = (com.facebook.GraphRequest) r2
|
|
org.json.JSONObject r4 = new org.json.JSONObject // Catch: java.io.IOException -> L34 org.json.JSONException -> L36
|
|
r4.<init>() // Catch: java.io.IOException -> L34 org.json.JSONException -> L36
|
|
java.lang.String r5 = "body"
|
|
r4.put(r5, r11) // Catch: java.io.IOException -> L34 org.json.JSONException -> L36
|
|
if (r9 != 0) goto L22
|
|
r5 = 200(0xc8, float:2.8E-43)
|
|
goto L26
|
|
L22:
|
|
int r5 = r9.getResponseCode() // Catch: java.io.IOException -> L34 org.json.JSONException -> L36
|
|
L26:
|
|
java.lang.String r6 = "code"
|
|
r4.put(r6, r5) // Catch: java.io.IOException -> L34 org.json.JSONException -> L36
|
|
org.json.JSONArray r5 = new org.json.JSONArray // Catch: java.io.IOException -> L34 org.json.JSONException -> L36
|
|
r5.<init>() // Catch: java.io.IOException -> L34 org.json.JSONException -> L36
|
|
r5.put(r4) // Catch: java.io.IOException -> L34 org.json.JSONException -> L36
|
|
goto L54
|
|
L34:
|
|
r4 = move-exception
|
|
goto L38
|
|
L36:
|
|
r4 = move-exception
|
|
goto L46
|
|
L38:
|
|
com.facebook.GraphResponse r5 = new com.facebook.GraphResponse
|
|
com.facebook.FacebookRequestError r6 = new com.facebook.FacebookRequestError
|
|
r6.<init>(r9, r4)
|
|
r5.<init>(r2, r9, r6)
|
|
r1.add(r5)
|
|
goto L53
|
|
L46:
|
|
com.facebook.GraphResponse r5 = new com.facebook.GraphResponse
|
|
com.facebook.FacebookRequestError r6 = new com.facebook.FacebookRequestError
|
|
r6.<init>(r9, r4)
|
|
r5.<init>(r2, r9, r6)
|
|
r1.add(r5)
|
|
L53:
|
|
r5 = r11
|
|
L54:
|
|
boolean r2 = r5 instanceof org.json.JSONArray
|
|
if (r2 == 0) goto La8
|
|
r2 = r5
|
|
org.json.JSONArray r2 = (org.json.JSONArray) r2
|
|
int r4 = r2.length()
|
|
if (r4 != r0) goto La8
|
|
int r0 = r2.length()
|
|
if (r0 <= 0) goto La7
|
|
L67:
|
|
int r2 = r3 + 1
|
|
java.lang.Object r4 = r10.get(r3)
|
|
com.facebook.GraphRequest r4 = (com.facebook.GraphRequest) r4
|
|
r6 = r5
|
|
org.json.JSONArray r6 = (org.json.JSONArray) r6 // Catch: com.facebook.FacebookException -> L83 org.json.JSONException -> L85
|
|
java.lang.Object r3 = r6.get(r3) // Catch: com.facebook.FacebookException -> L83 org.json.JSONException -> L85
|
|
java.lang.String r6 = "obj"
|
|
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r3, r6) // Catch: com.facebook.FacebookException -> L83 org.json.JSONException -> L85
|
|
com.facebook.GraphResponse r3 = r8.createResponseFromObject(r4, r9, r3, r11) // Catch: com.facebook.FacebookException -> L83 org.json.JSONException -> L85
|
|
r1.add(r3) // Catch: com.facebook.FacebookException -> L83 org.json.JSONException -> L85
|
|
goto La2
|
|
L83:
|
|
r3 = move-exception
|
|
goto L87
|
|
L85:
|
|
r3 = move-exception
|
|
goto L95
|
|
L87:
|
|
com.facebook.GraphResponse r6 = new com.facebook.GraphResponse
|
|
com.facebook.FacebookRequestError r7 = new com.facebook.FacebookRequestError
|
|
r7.<init>(r9, r3)
|
|
r6.<init>(r4, r9, r7)
|
|
r1.add(r6)
|
|
goto La2
|
|
L95:
|
|
com.facebook.GraphResponse r6 = new com.facebook.GraphResponse
|
|
com.facebook.FacebookRequestError r7 = new com.facebook.FacebookRequestError
|
|
r7.<init>(r9, r3)
|
|
r6.<init>(r4, r9, r7)
|
|
r1.add(r6)
|
|
La2:
|
|
if (r2 < r0) goto La5
|
|
goto La7
|
|
La5:
|
|
r3 = r2
|
|
goto L67
|
|
La7:
|
|
return r1
|
|
La8:
|
|
com.facebook.FacebookException r9 = new com.facebook.FacebookException
|
|
java.lang.String r10 = "Unexpected number of results"
|
|
r9.<init>(r10)
|
|
throw r9
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.facebook.GraphResponse.Companion.createResponsesFromObject(java.net.HttpURLConnection, java.util.List, java.lang.Object):java.util.List");
|
|
}
|
|
|
|
private final GraphResponse createResponseFromObject(GraphRequest graphRequest, HttpURLConnection httpURLConnection, Object NULL, Object obj) throws JSONException {
|
|
if (NULL instanceof JSONObject) {
|
|
JSONObject jSONObject = (JSONObject) NULL;
|
|
FacebookRequestError checkResponseAndCreateError = FacebookRequestError.Companion.checkResponseAndCreateError(jSONObject, obj, httpURLConnection);
|
|
if (checkResponseAndCreateError != null) {
|
|
Log.e(GraphResponse.TAG, checkResponseAndCreateError.toString());
|
|
if (checkResponseAndCreateError.getErrorCode() == 190) {
|
|
Utility utility = Utility.INSTANCE;
|
|
if (Utility.isCurrentAccessToken(graphRequest.getAccessToken())) {
|
|
if (checkResponseAndCreateError.getSubErrorCode() != 493) {
|
|
AccessToken.Companion.setCurrentAccessToken(null);
|
|
} else {
|
|
AccessToken.Companion companion = AccessToken.Companion;
|
|
AccessToken currentAccessToken = companion.getCurrentAccessToken();
|
|
if (Intrinsics.areEqual(currentAccessToken != null ? Boolean.valueOf(currentAccessToken.isExpired()) : null, Boolean.FALSE)) {
|
|
companion.expireCurrentAccessToken();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return new GraphResponse(graphRequest, httpURLConnection, checkResponseAndCreateError);
|
|
}
|
|
Object stringPropertyAsJSON = Utility.getStringPropertyAsJSON(jSONObject, "body", GraphResponse.NON_JSON_RESPONSE_PROPERTY);
|
|
if (stringPropertyAsJSON instanceof JSONObject) {
|
|
JSONObject jSONObject2 = (JSONObject) stringPropertyAsJSON;
|
|
return new GraphResponse(graphRequest, httpURLConnection, jSONObject2.toString(), jSONObject2);
|
|
}
|
|
if (stringPropertyAsJSON instanceof JSONArray) {
|
|
JSONArray jSONArray = (JSONArray) stringPropertyAsJSON;
|
|
return new GraphResponse(graphRequest, httpURLConnection, jSONArray.toString(), jSONArray);
|
|
}
|
|
NULL = JSONObject.NULL;
|
|
Intrinsics.checkNotNullExpressionValue(NULL, "NULL");
|
|
}
|
|
if (NULL == JSONObject.NULL) {
|
|
return new GraphResponse(graphRequest, httpURLConnection, NULL.toString(), (JSONObject) null);
|
|
}
|
|
throw new FacebookException(Intrinsics.stringPlus("Got unexpected object type in response, class: ", NULL.getClass().getSimpleName()));
|
|
}
|
|
|
|
public final List<GraphResponse> constructErrorResponses(List<GraphRequest> requests, HttpURLConnection httpURLConnection, FacebookException facebookException) {
|
|
Intrinsics.checkNotNullParameter(requests, "requests");
|
|
List<GraphRequest> list = requests;
|
|
ArrayList arrayList = new ArrayList(CollectionsKt__IterablesKt.collectionSizeOrDefault(list, 10));
|
|
Iterator<T> it = list.iterator();
|
|
while (it.hasNext()) {
|
|
arrayList.add(new GraphResponse((GraphRequest) it.next(), httpURLConnection, new FacebookRequestError(httpURLConnection, facebookException)));
|
|
}
|
|
return arrayList;
|
|
}
|
|
}
|
|
}
|