Files
rr3-apk/decompiled/sources/com/facebook/GraphRequest.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

1872 lines
89 KiB
Java

package com.facebook;
import android.content.Context;
import android.graphics.Bitmap;
import android.location.Location;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Parcel;
import android.os.ParcelFileDescriptor;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
import androidx.annotation.VisibleForTesting;
import com.facebook.GraphRequest;
import com.facebook.GraphRequestBatch;
import com.facebook.internal.AttributionIdentifiers;
import com.facebook.internal.InternalSettings;
import com.facebook.internal.Logger;
import com.facebook.internal.NativeProtocol;
import com.facebook.internal.ServerProtocol;
import com.facebook.internal.Utility;
import com.facebook.internal.Validate;
import com.google.android.gms.drive.DriveFile;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import com.ironsource.v8;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import java.io.Closeable;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.security.SecureRandom;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import kotlin.collections.ArraysKt___ArraysKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
import kotlin.text.Charsets;
import kotlin.text.StringsKt__StringsJVMKt;
import kotlin.text.StringsKt__StringsKt;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class GraphRequest {
private static final String ACCEPT_LANGUAGE_HEADER = "Accept-Language";
public static final String ACCESS_TOKEN_PARAM = "access_token";
private static final String ATTACHED_FILES_PARAM = "attached_files";
private static final String ATTACHMENT_FILENAME_PREFIX = "file";
private static final String BATCH_APP_ID_PARAM = "batch_app_id";
private static final String BATCH_BODY_PARAM = "body";
private static final String BATCH_ENTRY_DEPENDS_ON_PARAM = "depends_on";
private static final String BATCH_ENTRY_NAME_PARAM = "name";
private static final String BATCH_ENTRY_OMIT_RESPONSE_ON_SUCCESS_PARAM = "omit_response_on_success";
private static final String BATCH_METHOD_PARAM = "method";
private static final String BATCH_PARAM = "batch";
private static final String BATCH_RELATIVE_URL_PARAM = "relative_url";
private static final String CAPTION_PARAM = "caption";
private static final String CONTENT_ENCODING_HEADER = "Content-Encoding";
private static final String CONTENT_TYPE_HEADER = "Content-Type";
private static final String DEBUG_KEY = "__debug__";
private static final String DEBUG_MESSAGES_KEY = "messages";
private static final String DEBUG_MESSAGE_KEY = "message";
private static final String DEBUG_MESSAGE_LINK_KEY = "link";
private static final String DEBUG_MESSAGE_TYPE_KEY = "type";
private static final String DEBUG_PARAM = "debug";
private static final String DEBUG_SEVERITY_INFO = "info";
private static final String DEBUG_SEVERITY_WARNING = "warning";
public static final String FIELDS_PARAM = "fields";
private static final String FORMAT_JSON = "json";
private static final String FORMAT_PARAM = "format";
private static final String ISO_8601_FORMAT_STRING = "yyyy-MM-dd'T'HH:mm:ssZ";
public static final int MAXIMUM_BATCH_SIZE = 50;
private static final String ME = "me";
private static final String MIME_BOUNDARY;
private static final String MY_FRIENDS = "me/friends";
private static final String MY_PHOTOS = "me/photos";
private static final String PICTURE_PARAM = "picture";
private static final String SDK_ANDROID = "android";
private static final String SDK_PARAM = "sdk";
private static final String SEARCH = "search";
private static final String USER_AGENT_BASE = "FBAndroidSDK";
private static final String USER_AGENT_HEADER = "User-Agent";
private static final String VIDEOS_SUFFIX = "/videos";
private static String defaultBatchApplicationId;
private static volatile String userAgent;
private static final Pattern versionPattern;
private AccessToken accessToken;
private String batchEntryDependsOn;
private String batchEntryName;
private boolean batchEntryOmitResultOnSuccess;
private Callback callback;
private boolean forceApplicationRequest;
private JSONObject graphObject;
private String graphPath;
private HttpMethod httpMethod;
private String overriddenURL;
private Bundle parameters;
private Object tag;
private String version;
public static final Companion Companion = new Companion(null);
public static final String TAG = GraphRequest.class.getSimpleName();
public interface Callback {
void onCompleted(GraphResponse graphResponse);
}
public interface GraphJSONArrayCallback {
void onCompleted(JSONArray jSONArray, GraphResponse graphResponse);
}
public interface GraphJSONObjectCallback {
void onCompleted(JSONObject jSONObject, GraphResponse graphResponse);
}
public interface KeyValueSerializer {
void writeString(String str, String str2);
}
public interface OnProgressCallback extends Callback {
void onProgress(long j, long j2);
}
public GraphRequest() {
this(null, null, null, null, null, null, 63, null);
}
public GraphRequest(AccessToken accessToken) {
this(accessToken, null, null, null, null, null, 62, null);
}
public GraphRequest(AccessToken accessToken, String str) {
this(accessToken, str, null, null, null, null, 60, null);
}
public GraphRequest(AccessToken accessToken, String str, Bundle bundle) {
this(accessToken, str, bundle, null, null, null, 56, null);
}
public GraphRequest(AccessToken accessToken, String str, Bundle bundle, HttpMethod httpMethod) {
this(accessToken, str, bundle, httpMethod, null, null, 48, null);
}
public GraphRequest(AccessToken accessToken, String str, Bundle bundle, HttpMethod httpMethod, Callback callback) {
this(accessToken, str, bundle, httpMethod, callback, null, 32, null);
}
public static final GraphResponse executeAndWait(GraphRequest graphRequest) {
return Companion.executeAndWait(graphRequest);
}
public static final List<GraphResponse> executeBatchAndWait(GraphRequestBatch graphRequestBatch) {
return Companion.executeBatchAndWait(graphRequestBatch);
}
public static final List<GraphResponse> executeBatchAndWait(Collection<GraphRequest> collection) {
return Companion.executeBatchAndWait(collection);
}
public static final List<GraphResponse> executeBatchAndWait(GraphRequest... graphRequestArr) {
return Companion.executeBatchAndWait(graphRequestArr);
}
public static final GraphRequestAsyncTask executeBatchAsync(GraphRequestBatch graphRequestBatch) {
return Companion.executeBatchAsync(graphRequestBatch);
}
public static final GraphRequestAsyncTask executeBatchAsync(Collection<GraphRequest> collection) {
return Companion.executeBatchAsync(collection);
}
public static final GraphRequestAsyncTask executeBatchAsync(GraphRequest... graphRequestArr) {
return Companion.executeBatchAsync(graphRequestArr);
}
public static final List<GraphResponse> executeConnectionAndWait(HttpURLConnection httpURLConnection, GraphRequestBatch graphRequestBatch) {
return Companion.executeConnectionAndWait(httpURLConnection, graphRequestBatch);
}
public static final List<GraphResponse> executeConnectionAndWait(HttpURLConnection httpURLConnection, Collection<GraphRequest> collection) {
return Companion.executeConnectionAndWait(httpURLConnection, collection);
}
public static final GraphRequestAsyncTask executeConnectionAsync(Handler handler, HttpURLConnection httpURLConnection, GraphRequestBatch graphRequestBatch) {
return Companion.executeConnectionAsync(handler, httpURLConnection, graphRequestBatch);
}
public static final GraphRequestAsyncTask executeConnectionAsync(HttpURLConnection httpURLConnection, GraphRequestBatch graphRequestBatch) {
return Companion.executeConnectionAsync(httpURLConnection, graphRequestBatch);
}
public static final String getDefaultBatchApplicationId() {
return Companion.getDefaultBatchApplicationId();
}
public static final GraphRequest newCustomAudienceThirdPartyIdRequest(AccessToken accessToken, Context context, Callback callback) {
return Companion.newCustomAudienceThirdPartyIdRequest(accessToken, context, callback);
}
public static final GraphRequest newCustomAudienceThirdPartyIdRequest(AccessToken accessToken, Context context, String str, Callback callback) {
return Companion.newCustomAudienceThirdPartyIdRequest(accessToken, context, str, callback);
}
public static final GraphRequest newDeleteObjectRequest(AccessToken accessToken, String str, Callback callback) {
return Companion.newDeleteObjectRequest(accessToken, str, callback);
}
public static final GraphRequest newGraphPathRequest(AccessToken accessToken, String str, Callback callback) {
return Companion.newGraphPathRequest(accessToken, str, callback);
}
public static final GraphRequest newMeRequest(AccessToken accessToken, GraphJSONObjectCallback graphJSONObjectCallback) {
return Companion.newMeRequest(accessToken, graphJSONObjectCallback);
}
public static final GraphRequest newMyFriendsRequest(AccessToken accessToken, GraphJSONArrayCallback graphJSONArrayCallback) {
return Companion.newMyFriendsRequest(accessToken, graphJSONArrayCallback);
}
public static final GraphRequest newPlacesSearchRequest(AccessToken accessToken, Location location, int i, int i2, String str, GraphJSONArrayCallback graphJSONArrayCallback) {
return Companion.newPlacesSearchRequest(accessToken, location, i, i2, str, graphJSONArrayCallback);
}
public static final GraphRequest newPostRequest(AccessToken accessToken, String str, JSONObject jSONObject, Callback callback) {
return Companion.newPostRequest(accessToken, str, jSONObject, callback);
}
public static final GraphRequest newPostRequestWithBundle(AccessToken accessToken, String str, Bundle bundle, Callback callback) {
return Companion.newPostRequestWithBundle(accessToken, str, bundle, callback);
}
public static final GraphRequest newUploadPhotoRequest(AccessToken accessToken, String str, Bitmap bitmap, String str2, Bundle bundle, Callback callback) {
return Companion.newUploadPhotoRequest(accessToken, str, bitmap, str2, bundle, callback);
}
public static final GraphRequest newUploadPhotoRequest(AccessToken accessToken, String str, Uri uri, String str2, Bundle bundle, Callback callback) throws FileNotFoundException, FacebookException {
return Companion.newUploadPhotoRequest(accessToken, str, uri, str2, bundle, callback);
}
public static final GraphRequest newUploadPhotoRequest(AccessToken accessToken, String str, File file, String str2, Bundle bundle, Callback callback) throws FileNotFoundException {
return Companion.newUploadPhotoRequest(accessToken, str, file, str2, bundle, callback);
}
public static final void setDefaultBatchApplicationId(String str) {
Companion.setDefaultBatchApplicationId(str);
}
public static final HttpURLConnection toHttpConnection(GraphRequestBatch graphRequestBatch) {
return Companion.toHttpConnection(graphRequestBatch);
}
public static final HttpURLConnection toHttpConnection(Collection<GraphRequest> collection) {
return Companion.toHttpConnection(collection);
}
public static final HttpURLConnection toHttpConnection(GraphRequest... graphRequestArr) {
return Companion.toHttpConnection(graphRequestArr);
}
public final AccessToken getAccessToken() {
return this.accessToken;
}
public final String getBatchEntryDependsOn() {
return this.batchEntryDependsOn;
}
public final String getBatchEntryName() {
return this.batchEntryName;
}
public final boolean getBatchEntryOmitResultOnSuccess() {
return this.batchEntryOmitResultOnSuccess;
}
public final Callback getCallback() {
return this.callback;
}
public final JSONObject getGraphObject() {
return this.graphObject;
}
public final String getGraphPath() {
return this.graphPath;
}
public final HttpMethod getHttpMethod() {
return this.httpMethod;
}
public final Bundle getParameters() {
return this.parameters;
}
public final Object getTag() {
return this.tag;
}
public final String getVersion() {
return this.version;
}
public final void setAccessToken(AccessToken accessToken) {
this.accessToken = accessToken;
}
public final void setBatchEntryDependsOn(String str) {
this.batchEntryDependsOn = str;
}
public final void setBatchEntryName(String str) {
this.batchEntryName = str;
}
public final void setBatchEntryOmitResultOnSuccess(boolean z) {
this.batchEntryOmitResultOnSuccess = z;
}
public final void setForceApplicationRequest(boolean z) {
this.forceApplicationRequest = z;
}
public final void setGraphObject(JSONObject jSONObject) {
this.graphObject = jSONObject;
}
public final void setGraphPath(String str) {
this.graphPath = str;
}
public final void setParameters(Bundle bundle) {
Intrinsics.checkNotNullParameter(bundle, "<set-?>");
this.parameters = bundle;
}
public final void setTag(Object obj) {
this.tag = obj;
}
public final void setVersion(String str) {
this.version = str;
}
public final void setCallback(final Callback callback) {
FacebookSdk facebookSdk = FacebookSdk.INSTANCE;
if (FacebookSdk.isLoggingBehaviorEnabled(LoggingBehavior.GRAPH_API_DEBUG_INFO) || FacebookSdk.isLoggingBehaviorEnabled(LoggingBehavior.GRAPH_API_DEBUG_WARNING)) {
this.callback = new Callback() { // from class: com.facebook.GraphRequest$$ExternalSyntheticLambda0
@Override // com.facebook.GraphRequest.Callback
public final void onCompleted(GraphResponse graphResponse) {
GraphRequest.m434_set_callback_$lambda0(GraphRequest.Callback.this, graphResponse);
}
};
} else {
this.callback = callback;
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: _set_callback_$lambda-0, reason: not valid java name */
public static final void m434_set_callback_$lambda0(Callback callback, GraphResponse response) {
int length;
Intrinsics.checkNotNullParameter(response, "response");
JSONObject jSONObject = response.getJSONObject();
JSONObject optJSONObject = jSONObject == null ? null : jSONObject.optJSONObject(DEBUG_KEY);
JSONArray optJSONArray = optJSONObject == null ? null : optJSONObject.optJSONArray(DEBUG_MESSAGES_KEY);
if (optJSONArray != null && (length = optJSONArray.length()) > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
JSONObject optJSONObject2 = optJSONArray.optJSONObject(i);
String optString = optJSONObject2 == null ? null : optJSONObject2.optString("message");
String optString2 = optJSONObject2 == null ? null : optJSONObject2.optString("type");
String optString3 = optJSONObject2 == null ? null : optJSONObject2.optString("link");
if (optString != null && optString2 != null) {
LoggingBehavior loggingBehavior = LoggingBehavior.GRAPH_API_DEBUG_INFO;
if (Intrinsics.areEqual(optString2, DEBUG_SEVERITY_WARNING)) {
loggingBehavior = LoggingBehavior.GRAPH_API_DEBUG_WARNING;
}
if (!Utility.isNullOrEmpty(optString3)) {
optString = ((Object) optString) + " Link: " + ((Object) optString3);
}
Logger.Companion companion = Logger.Companion;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.log(loggingBehavior, TAG2, optString);
}
if (i2 >= length) {
break;
} else {
i = i2;
}
}
}
if (callback == null) {
return;
}
callback.onCompleted(response);
}
public final void setHttpMethod(HttpMethod httpMethod) {
if (this.overriddenURL != null && httpMethod != HttpMethod.GET) {
throw new FacebookException("Can't change HTTP method on request with overridden URL.");
}
if (httpMethod == null) {
httpMethod = HttpMethod.GET;
}
this.httpMethod = httpMethod;
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private final String getDefaultPhotoPathIfNull(String str) {
return str == null ? GraphRequest.MY_PHOTOS : str;
}
@VisibleForTesting(otherwise = 2)
public static /* synthetic */ void getTAG$facebook_core_release$annotations() {
}
private Companion() {
}
public final String getDefaultBatchApplicationId() {
return GraphRequest.defaultBatchApplicationId;
}
public final void setDefaultBatchApplicationId(String str) {
GraphRequest.defaultBatchApplicationId = str;
}
public final GraphRequest newDeleteObjectRequest(AccessToken accessToken, String str, Callback callback) {
return new GraphRequest(accessToken, str, null, HttpMethod.DELETE, callback, null, 32, null);
}
public final GraphRequest newMeRequest(AccessToken accessToken, final GraphJSONObjectCallback graphJSONObjectCallback) {
return new GraphRequest(accessToken, "me", null, null, new Callback() { // from class: com.facebook.GraphRequest$Companion$$ExternalSyntheticLambda1
@Override // com.facebook.GraphRequest.Callback
public final void onCompleted(GraphResponse graphResponse) {
GraphRequest.Companion.m435newMeRequest$lambda0(GraphRequest.GraphJSONObjectCallback.this, graphResponse);
}
}, null, 32, null);
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: newMeRequest$lambda-0, reason: not valid java name */
public static final void m435newMeRequest$lambda0(GraphJSONObjectCallback graphJSONObjectCallback, GraphResponse response) {
Intrinsics.checkNotNullParameter(response, "response");
if (graphJSONObjectCallback == null) {
return;
}
graphJSONObjectCallback.onCompleted(response.getJSONObject(), response);
}
public final GraphRequest newPostRequest(AccessToken accessToken, String str, JSONObject jSONObject, Callback callback) {
GraphRequest graphRequest = new GraphRequest(accessToken, str, null, HttpMethod.POST, callback, null, 32, null);
graphRequest.setGraphObject(jSONObject);
return graphRequest;
}
public final GraphRequest newPostRequestWithBundle(AccessToken accessToken, String str, Bundle bundle, Callback callback) {
return new GraphRequest(accessToken, str, bundle, HttpMethod.POST, callback, null, 32, null);
}
public final GraphRequest newMyFriendsRequest(AccessToken accessToken, final GraphJSONArrayCallback graphJSONArrayCallback) {
return new GraphRequest(accessToken, GraphRequest.MY_FRIENDS, null, null, new Callback() { // from class: com.facebook.GraphRequest$Companion$newMyFriendsRequest$wrapper$1
@Override // com.facebook.GraphRequest.Callback
public void onCompleted(GraphResponse response) {
Intrinsics.checkNotNullParameter(response, "response");
if (GraphRequest.GraphJSONArrayCallback.this != null) {
JSONObject jSONObject = response.getJSONObject();
GraphRequest.GraphJSONArrayCallback.this.onCompleted(jSONObject == null ? null : jSONObject.optJSONArray("data"), response);
}
}
}, null, 32, null);
}
public final GraphRequest newGraphPathRequest(AccessToken accessToken, String str, Callback callback) {
return new GraphRequest(accessToken, str, null, null, callback, null, 32, null);
}
public final GraphRequest newPlacesSearchRequest(AccessToken accessToken, Location location, int i, int i2, String str, final GraphJSONArrayCallback graphJSONArrayCallback) {
if (location == null && Utility.isNullOrEmpty(str)) {
throw new FacebookException("Either location or searchText must be specified.");
}
Bundle bundle = new Bundle(5);
bundle.putString("type", "place");
bundle.putInt("limit", i2);
if (location != null) {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(Locale.US, "%f,%f", Arrays.copyOf(new Object[]{Double.valueOf(location.getLatitude()), Double.valueOf(location.getLongitude())}, 2));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(locale, format, *args)");
bundle.putString("center", format);
bundle.putInt("distance", i);
}
if (!Utility.isNullOrEmpty(str)) {
bundle.putString(CampaignEx.JSON_KEY_AD_Q, str);
}
return new GraphRequest(accessToken, "search", bundle, HttpMethod.GET, new Callback() { // from class: com.facebook.GraphRequest$Companion$$ExternalSyntheticLambda2
@Override // com.facebook.GraphRequest.Callback
public final void onCompleted(GraphResponse graphResponse) {
GraphRequest.Companion.m436newPlacesSearchRequest$lambda1(GraphRequest.GraphJSONArrayCallback.this, graphResponse);
}
}, null, 32, null);
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: newPlacesSearchRequest$lambda-1, reason: not valid java name */
public static final void m436newPlacesSearchRequest$lambda1(GraphJSONArrayCallback graphJSONArrayCallback, GraphResponse response) {
Intrinsics.checkNotNullParameter(response, "response");
if (graphJSONArrayCallback != null) {
JSONObject jSONObject = response.getJSONObject();
graphJSONArrayCallback.onCompleted(jSONObject == null ? null : jSONObject.optJSONArray("data"), response);
}
}
public final GraphRequest newUploadPhotoRequest(AccessToken accessToken, String str, Bitmap image, String str2, Bundle bundle, Callback callback) {
Intrinsics.checkNotNullParameter(image, "image");
Bundle bundle2 = new Bundle();
if (bundle != null) {
bundle2.putAll(bundle);
}
bundle2.putParcelable("picture", image);
if (str2 != null && str2.length() > 0) {
bundle2.putString("caption", str2);
}
return new GraphRequest(accessToken, getDefaultPhotoPathIfNull(str), bundle2, HttpMethod.POST, callback, null, 32, null);
}
public final GraphRequest newUploadPhotoRequest(AccessToken accessToken, String str, File file, String str2, Bundle bundle, Callback callback) throws FileNotFoundException {
Intrinsics.checkNotNullParameter(file, "file");
ParcelFileDescriptor open = ParcelFileDescriptor.open(file, DriveFile.MODE_READ_ONLY);
Bundle bundle2 = new Bundle();
if (bundle != null) {
bundle2.putAll(bundle);
}
bundle2.putParcelable("picture", open);
if (str2 != null && str2.length() > 0) {
bundle2.putString("caption", str2);
}
return new GraphRequest(accessToken, getDefaultPhotoPathIfNull(str), bundle2, HttpMethod.POST, callback, null, 32, null);
}
public final GraphRequest newUploadPhotoRequest(AccessToken accessToken, String str, Uri photoUri, String str2, Bundle bundle, Callback callback) throws FileNotFoundException, FacebookException {
Intrinsics.checkNotNullParameter(photoUri, "photoUri");
if (Utility.isFileUri(photoUri)) {
return newUploadPhotoRequest(accessToken, str, new File(photoUri.getPath()), str2, bundle, callback);
}
if (!Utility.isContentUri(photoUri)) {
throw new FacebookException("The photo Uri must be either a file:// or content:// Uri");
}
Bundle bundle2 = new Bundle();
if (bundle != null) {
bundle2.putAll(bundle);
}
bundle2.putParcelable("picture", photoUri);
if (str2 != null && str2.length() > 0) {
bundle2.putString("caption", str2);
}
return new GraphRequest(accessToken, getDefaultPhotoPathIfNull(str), bundle2, HttpMethod.POST, callback, null, 32, null);
}
public final GraphRequest newCustomAudienceThirdPartyIdRequest(AccessToken accessToken, Context context, String str, Callback callback) {
Intrinsics.checkNotNullParameter(context, "context");
if (str == null && accessToken != null) {
str = accessToken.getApplicationId();
}
if (str == null) {
str = Utility.getMetadataApplicationId(context);
}
if (str == null) {
throw new FacebookException("Facebook App ID cannot be determined");
}
String stringPlus = Intrinsics.stringPlus(str, "/custom_audience_third_party_id");
AttributionIdentifiers attributionIdentifiers = AttributionIdentifiers.Companion.getAttributionIdentifiers(context);
Bundle bundle = new Bundle();
if (accessToken == null) {
if (attributionIdentifiers == null) {
throw new FacebookException("There is no access token and attribution identifiers could not be retrieved");
}
String attributionId = attributionIdentifiers.getAttributionId() != null ? attributionIdentifiers.getAttributionId() : attributionIdentifiers.getAndroidAdvertiserId();
if (attributionId != null) {
bundle.putString("udid", attributionId);
}
}
if (FacebookSdk.getLimitEventAndDataUsage(context) || (attributionIdentifiers != null && attributionIdentifiers.isTrackingLimited())) {
bundle.putString("limit_event_usage", "1");
}
return new GraphRequest(accessToken, stringPlus, bundle, HttpMethod.GET, callback, null, 32, null);
}
public final GraphRequest newCustomAudienceThirdPartyIdRequest(AccessToken accessToken, Context context, Callback callback) {
Intrinsics.checkNotNullParameter(context, "context");
return newCustomAudienceThirdPartyIdRequest(accessToken, context, null, callback);
}
public final HttpURLConnection toHttpConnection(GraphRequest... requests) {
List list;
Intrinsics.checkNotNullParameter(requests, "requests");
list = ArraysKt___ArraysKt.toList(requests);
return toHttpConnection(list);
}
public final HttpURLConnection toHttpConnection(Collection<GraphRequest> requests) {
Intrinsics.checkNotNullParameter(requests, "requests");
Validate.notEmpty(requests, "requests");
return toHttpConnection(new GraphRequestBatch(requests));
}
public final HttpURLConnection toHttpConnection(GraphRequestBatch requests) {
URL url;
Intrinsics.checkNotNullParameter(requests, "requests");
validateFieldsParamForGetRequests$facebook_core_release(requests);
try {
if (requests.size() == 1) {
url = new URL(requests.get(0).getUrlForSingleRequest());
} else {
url = new URL(ServerProtocol.getGraphUrlBase());
}
HttpURLConnection httpURLConnection = null;
try {
httpURLConnection = createConnection(url);
serializeToUrlConnection$facebook_core_release(requests, httpURLConnection);
return httpURLConnection;
} catch (IOException e) {
Utility.disconnectQuietly(httpURLConnection);
throw new FacebookException("could not construct request body", e);
} catch (JSONException e2) {
Utility.disconnectQuietly(httpURLConnection);
throw new FacebookException("could not construct request body", e2);
}
} catch (MalformedURLException e3) {
throw new FacebookException("could not construct URL for request", e3);
}
}
public final GraphResponse executeAndWait(GraphRequest request) {
Intrinsics.checkNotNullParameter(request, "request");
List<GraphResponse> executeBatchAndWait = executeBatchAndWait(request);
if (executeBatchAndWait.size() != 1) {
throw new FacebookException("invalid state: expected a single response");
}
return executeBatchAndWait.get(0);
}
public final List<GraphResponse> executeBatchAndWait(GraphRequest... requests) {
List list;
Intrinsics.checkNotNullParameter(requests, "requests");
list = ArraysKt___ArraysKt.toList(requests);
return executeBatchAndWait(list);
}
public final List<GraphResponse> executeBatchAndWait(Collection<GraphRequest> requests) {
Intrinsics.checkNotNullParameter(requests, "requests");
return executeBatchAndWait(new GraphRequestBatch(requests));
}
public final List<GraphResponse> executeBatchAndWait(GraphRequestBatch requests) {
Exception exc;
HttpURLConnection httpURLConnection;
List<GraphResponse> list;
Intrinsics.checkNotNullParameter(requests, "requests");
Validate.notEmptyAndContainsNoNulls(requests, "requests");
HttpURLConnection httpURLConnection2 = null;
try {
httpURLConnection = toHttpConnection(requests);
exc = null;
} catch (Exception e) {
exc = e;
httpURLConnection = null;
} catch (Throwable th) {
th = th;
Utility.disconnectQuietly(httpURLConnection2);
throw th;
}
try {
if (httpURLConnection != null) {
list = executeConnectionAndWait(httpURLConnection, requests);
} else {
List<GraphResponse> constructErrorResponses = GraphResponse.Companion.constructErrorResponses(requests.getRequests(), null, new FacebookException(exc));
runCallbacks$facebook_core_release(requests, constructErrorResponses);
list = constructErrorResponses;
}
Utility.disconnectQuietly(httpURLConnection);
return list;
} catch (Throwable th2) {
th = th2;
httpURLConnection2 = httpURLConnection;
Utility.disconnectQuietly(httpURLConnection2);
throw th;
}
}
public final GraphRequestAsyncTask executeBatchAsync(GraphRequest... requests) {
List list;
Intrinsics.checkNotNullParameter(requests, "requests");
list = ArraysKt___ArraysKt.toList(requests);
return executeBatchAsync(list);
}
public final GraphRequestAsyncTask executeBatchAsync(Collection<GraphRequest> requests) {
Intrinsics.checkNotNullParameter(requests, "requests");
return executeBatchAsync(new GraphRequestBatch(requests));
}
public final GraphRequestAsyncTask executeBatchAsync(GraphRequestBatch requests) {
Intrinsics.checkNotNullParameter(requests, "requests");
Validate.notEmptyAndContainsNoNulls(requests, "requests");
GraphRequestAsyncTask graphRequestAsyncTask = new GraphRequestAsyncTask(requests);
graphRequestAsyncTask.executeOnExecutor(FacebookSdk.getExecutor(), new Void[0]);
return graphRequestAsyncTask;
}
public final List<GraphResponse> executeConnectionAndWait(HttpURLConnection connection, Collection<GraphRequest> requests) {
Intrinsics.checkNotNullParameter(connection, "connection");
Intrinsics.checkNotNullParameter(requests, "requests");
return executeConnectionAndWait(connection, new GraphRequestBatch(requests));
}
public final List<GraphResponse> executeConnectionAndWait(HttpURLConnection connection, GraphRequestBatch requests) {
Intrinsics.checkNotNullParameter(connection, "connection");
Intrinsics.checkNotNullParameter(requests, "requests");
List<GraphResponse> fromHttpConnection$facebook_core_release = GraphResponse.Companion.fromHttpConnection$facebook_core_release(connection, requests);
Utility.disconnectQuietly(connection);
int size = requests.size();
if (size != fromHttpConnection$facebook_core_release.size()) {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(Locale.US, "Received %d responses while expecting %d", Arrays.copyOf(new Object[]{Integer.valueOf(fromHttpConnection$facebook_core_release.size()), Integer.valueOf(size)}, 2));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(locale, format, *args)");
throw new FacebookException(format);
}
runCallbacks$facebook_core_release(requests, fromHttpConnection$facebook_core_release);
AccessTokenManager.Companion.getInstance().extendAccessTokenIfNeeded();
return fromHttpConnection$facebook_core_release;
}
public final GraphRequestAsyncTask executeConnectionAsync(HttpURLConnection connection, GraphRequestBatch requests) {
Intrinsics.checkNotNullParameter(connection, "connection");
Intrinsics.checkNotNullParameter(requests, "requests");
return executeConnectionAsync(null, connection, requests);
}
public final GraphRequestAsyncTask executeConnectionAsync(Handler handler, HttpURLConnection connection, GraphRequestBatch requests) {
Intrinsics.checkNotNullParameter(connection, "connection");
Intrinsics.checkNotNullParameter(requests, "requests");
GraphRequestAsyncTask graphRequestAsyncTask = new GraphRequestAsyncTask(connection, requests);
requests.setCallbackHandler(handler);
graphRequestAsyncTask.executeOnExecutor(FacebookSdk.getExecutor(), new Void[0]);
return graphRequestAsyncTask;
}
public final void runCallbacks$facebook_core_release(final GraphRequestBatch requests, List<GraphResponse> responses) {
Intrinsics.checkNotNullParameter(requests, "requests");
Intrinsics.checkNotNullParameter(responses, "responses");
int size = requests.size();
final ArrayList arrayList = new ArrayList();
if (size > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
GraphRequest graphRequest = requests.get(i);
if (graphRequest.getCallback() != null) {
arrayList.add(new Pair(graphRequest.getCallback(), responses.get(i)));
}
if (i2 >= size) {
break;
} else {
i = i2;
}
}
}
if (arrayList.size() > 0) {
Runnable runnable = new Runnable() { // from class: com.facebook.GraphRequest$Companion$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
GraphRequest.Companion.m437runCallbacks$lambda2(arrayList, requests);
}
};
Handler callbackHandler = requests.getCallbackHandler();
if ((callbackHandler == null ? null : Boolean.valueOf(callbackHandler.post(runnable))) == null) {
runnable.run();
}
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: runCallbacks$lambda-2, reason: not valid java name */
public static final void m437runCallbacks$lambda2(ArrayList callbacks, GraphRequestBatch requests) {
Intrinsics.checkNotNullParameter(callbacks, "$callbacks");
Intrinsics.checkNotNullParameter(requests, "$requests");
Iterator it = callbacks.iterator();
while (it.hasNext()) {
Pair pair = (Pair) it.next();
Callback callback = (Callback) pair.first;
Object obj = pair.second;
Intrinsics.checkNotNullExpressionValue(obj, "pair.second");
callback.onCompleted((GraphResponse) obj);
}
Iterator<GraphRequestBatch.Callback> it2 = requests.getCallbacks().iterator();
while (it2.hasNext()) {
it2.next().onBatchCompleted(requests);
}
}
private final HttpURLConnection createConnection(URL url) throws IOException {
URLConnection uRLConnection = (URLConnection) FirebasePerfUrlConnection.instrument(url.openConnection());
if (uRLConnection == null) {
throw new NullPointerException("null cannot be cast to non-null type java.net.HttpURLConnection");
}
HttpURLConnection httpURLConnection = (HttpURLConnection) uRLConnection;
httpURLConnection.setRequestProperty("User-Agent", getUserAgent());
httpURLConnection.setRequestProperty(GraphRequest.ACCEPT_LANGUAGE_HEADER, Locale.getDefault().toString());
httpURLConnection.setChunkedStreamingMode(0);
return httpURLConnection;
}
private final boolean hasOnProgressCallbacks(GraphRequestBatch graphRequestBatch) {
Iterator<GraphRequestBatch.Callback> it = graphRequestBatch.getCallbacks().iterator();
while (it.hasNext()) {
if (it.next() instanceof GraphRequestBatch.OnProgressCallback) {
return true;
}
}
Iterator<GraphRequest> it2 = graphRequestBatch.iterator();
while (it2.hasNext()) {
if (it2.next().getCallback() instanceof OnProgressCallback) {
return true;
}
}
return false;
}
private final void setConnectionContentType(HttpURLConnection httpURLConnection, boolean z) {
if (z) {
httpURLConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
httpURLConnection.setRequestProperty("Content-Encoding", "gzip");
} else {
httpURLConnection.setRequestProperty("Content-Type", getMimeContentType());
}
}
private final boolean isGzipCompressible(GraphRequestBatch graphRequestBatch) {
Iterator<GraphRequest> it = graphRequestBatch.iterator();
while (it.hasNext()) {
GraphRequest next = it.next();
Iterator<String> it2 = next.getParameters().keySet().iterator();
while (it2.hasNext()) {
if (isSupportedAttachmentType(next.getParameters().get(it2.next()))) {
return false;
}
}
}
return true;
}
public final void validateFieldsParamForGetRequests$facebook_core_release(GraphRequestBatch requests) {
Intrinsics.checkNotNullParameter(requests, "requests");
Iterator<GraphRequest> it = requests.iterator();
while (it.hasNext()) {
GraphRequest next = it.next();
if (HttpMethod.GET == next.getHttpMethod()) {
Utility utility = Utility.INSTANCE;
if (Utility.isNullOrEmpty(next.getParameters().getString(GraphRequest.FIELDS_PARAM))) {
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.DEVELOPER_ERRORS;
StringBuilder sb = new StringBuilder();
sb.append("GET requests for /");
String graphPath = next.getGraphPath();
if (graphPath == null) {
graphPath = "";
}
sb.append(graphPath);
sb.append(" should contain an explicit \"fields\" parameter.");
companion.log(loggingBehavior, 5, "Request", sb.toString());
}
}
}
}
/* JADX WARN: Removed duplicated region for block: B:26:0x00ed */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void serializeToUrlConnection$facebook_core_release(com.facebook.GraphRequestBatch r14, java.net.HttpURLConnection r15) throws java.io.IOException, org.json.JSONException {
/*
Method dump skipped, instructions count: 245
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.GraphRequest.Companion.serializeToUrlConnection$facebook_core_release(com.facebook.GraphRequestBatch, java.net.HttpURLConnection):void");
}
private final void processRequest(GraphRequestBatch graphRequestBatch, Logger logger, int i, URL url, OutputStream outputStream, boolean z) {
Serializer serializer = new Serializer(outputStream, logger, z);
if (i == 1) {
GraphRequest graphRequest = graphRequestBatch.get(0);
HashMap hashMap = new HashMap();
for (String key : graphRequest.getParameters().keySet()) {
Object obj = graphRequest.getParameters().get(key);
if (isSupportedAttachmentType(obj)) {
Intrinsics.checkNotNullExpressionValue(key, "key");
hashMap.put(key, new Attachment(graphRequest, obj));
}
}
if (logger != null) {
logger.append(" Parameters:\n");
}
serializeParameters(graphRequest.getParameters(), serializer, graphRequest);
if (logger != null) {
logger.append(" Attachments:\n");
}
serializeAttachments(hashMap, serializer);
JSONObject graphObject = graphRequest.getGraphObject();
if (graphObject != null) {
String path = url.getPath();
Intrinsics.checkNotNullExpressionValue(path, "url.path");
processGraphObject(graphObject, path, serializer);
return;
}
return;
}
String batchAppId = getBatchAppId(graphRequestBatch);
if (batchAppId.length() == 0) {
throw new FacebookException("App ID was not specified at the request or Settings.");
}
serializer.writeString(GraphRequest.BATCH_APP_ID_PARAM, batchAppId);
HashMap hashMap2 = new HashMap();
serializeRequestsAsJSON(serializer, graphRequestBatch, hashMap2);
if (logger != null) {
logger.append(" Attachments:\n");
}
serializeAttachments(hashMap2, serializer);
}
private final boolean isMeRequest(String str) {
Matcher matcher = GraphRequest.versionPattern.matcher(str);
if (matcher.matches()) {
str = matcher.group(1);
Intrinsics.checkNotNullExpressionValue(str, "matcher.group(1)");
}
return StringsKt__StringsJVMKt.startsWith$default(str, "me/", false, 2, null) || StringsKt__StringsJVMKt.startsWith$default(str, "/me/", false, 2, null);
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Removed duplicated region for block: B:12:0x002e */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void processGraphObject(org.json.JSONObject r10, java.lang.String r11, com.facebook.GraphRequest.KeyValueSerializer r12) {
/*
r9 = this;
boolean r0 = r9.isMeRequest(r11)
r1 = 1
r2 = 0
if (r0 == 0) goto L23
java.lang.String r4 = ":"
r5 = 0
r6 = 0
r7 = 6
r8 = 0
r3 = r11
int r0 = kotlin.text.StringsKt.indexOf$default(r3, r4, r5, r6, r7, r8)
java.lang.String r4 = "?"
int r11 = kotlin.text.StringsKt.indexOf$default(r3, r4, r5, r6, r7, r8)
r3 = 3
if (r0 <= r3) goto L23
r3 = -1
if (r11 == r3) goto L21
if (r0 >= r11) goto L23
L21:
r11 = r1
goto L24
L23:
r11 = r2
L24:
java.util.Iterator r0 = r10.keys()
L28:
boolean r3 = r0.hasNext()
if (r3 == 0) goto L53
java.lang.Object r3 = r0.next()
java.lang.String r3 = (java.lang.String) r3
java.lang.Object r4 = r10.opt(r3)
if (r11 == 0) goto L44
java.lang.String r5 = "image"
boolean r5 = kotlin.text.StringsKt.equals(r3, r5, r1)
if (r5 == 0) goto L44
r5 = r1
goto L45
L44:
r5 = r2
L45:
java.lang.String r6 = "key"
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r3, r6)
java.lang.String r6 = "value"
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r4, r6)
r9.processGraphObjectProperty(r3, r4, r12, r5)
goto L28
L53:
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.GraphRequest.Companion.processGraphObject(org.json.JSONObject, java.lang.String, com.facebook.GraphRequest$KeyValueSerializer):void");
}
private final void processGraphObjectProperty(String str, Object obj, KeyValueSerializer keyValueSerializer, boolean z) {
Class<?> cls = obj.getClass();
if (JSONObject.class.isAssignableFrom(cls)) {
JSONObject jSONObject = (JSONObject) obj;
if (z) {
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("%s[%s]", Arrays.copyOf(new Object[]{str, next}, 2));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
Object opt = jSONObject.opt(next);
Intrinsics.checkNotNullExpressionValue(opt, "jsonObject.opt(propertyName)");
processGraphObjectProperty(format, opt, keyValueSerializer, z);
}
return;
}
if (jSONObject.has("id")) {
String optString = jSONObject.optString("id");
Intrinsics.checkNotNullExpressionValue(optString, "jsonObject.optString(\"id\")");
processGraphObjectProperty(str, optString, keyValueSerializer, z);
return;
} else if (jSONObject.has("url")) {
String optString2 = jSONObject.optString("url");
Intrinsics.checkNotNullExpressionValue(optString2, "jsonObject.optString(\"url\")");
processGraphObjectProperty(str, optString2, keyValueSerializer, z);
return;
} else {
if (jSONObject.has(NativeProtocol.OPEN_GRAPH_CREATE_OBJECT_KEY)) {
String jSONObject2 = jSONObject.toString();
Intrinsics.checkNotNullExpressionValue(jSONObject2, "jsonObject.toString()");
processGraphObjectProperty(str, jSONObject2, keyValueSerializer, z);
return;
}
return;
}
}
if (JSONArray.class.isAssignableFrom(cls)) {
JSONArray jSONArray = (JSONArray) obj;
int length = jSONArray.length();
if (length <= 0) {
return;
}
int i = 0;
while (true) {
int i2 = i + 1;
StringCompanionObject stringCompanionObject2 = StringCompanionObject.INSTANCE;
String format2 = String.format(Locale.ROOT, "%s[%d]", Arrays.copyOf(new Object[]{str, Integer.valueOf(i)}, 2));
Intrinsics.checkNotNullExpressionValue(format2, "java.lang.String.format(locale, format, *args)");
Object opt2 = jSONArray.opt(i);
Intrinsics.checkNotNullExpressionValue(opt2, "jsonArray.opt(i)");
processGraphObjectProperty(format2, opt2, keyValueSerializer, z);
if (i2 >= length) {
return;
} else {
i = i2;
}
}
} else {
if (String.class.isAssignableFrom(cls) || Number.class.isAssignableFrom(cls) || Boolean.class.isAssignableFrom(cls)) {
keyValueSerializer.writeString(str, obj.toString());
return;
}
if (Date.class.isAssignableFrom(cls)) {
String format3 = new SimpleDateFormat(GraphRequest.ISO_8601_FORMAT_STRING, Locale.US).format((Date) obj);
Intrinsics.checkNotNullExpressionValue(format3, "iso8601DateFormat.format(date)");
keyValueSerializer.writeString(str, format3);
return;
}
Utility utility = Utility.INSTANCE;
Utility.logd(GraphRequest.TAG, "The type of property " + str + " in the graph object is unknown. It won't be sent in the request.");
}
}
private final void serializeParameters(Bundle bundle, Serializer serializer, GraphRequest graphRequest) {
for (String key : bundle.keySet()) {
Object obj = bundle.get(key);
if (isSupportedParameterType(obj)) {
Intrinsics.checkNotNullExpressionValue(key, "key");
serializer.writeObject(key, obj, graphRequest);
}
}
}
private final void serializeRequestsAsJSON(Serializer serializer, Collection<GraphRequest> collection, Map<String, Attachment> map) {
JSONArray jSONArray = new JSONArray();
Iterator<GraphRequest> it = collection.iterator();
while (it.hasNext()) {
it.next().serializeToBatch(jSONArray, map);
}
serializer.writeRequestsAsJson(GraphRequest.BATCH_PARAM, jSONArray, collection);
}
private final String getMimeContentType() {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("multipart/form-data; boundary=%s", Arrays.copyOf(new Object[]{GraphRequest.MIME_BOUNDARY}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
return format;
}
private final String getUserAgent() {
if (GraphRequest.userAgent == null) {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("%s.%s", Arrays.copyOf(new Object[]{GraphRequest.USER_AGENT_BASE, FacebookSdkVersion.BUILD}, 2));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
GraphRequest.userAgent = format;
String customUserAgent = InternalSettings.getCustomUserAgent();
if (!Utility.isNullOrEmpty(customUserAgent)) {
String format2 = String.format(Locale.ROOT, "%s/%s", Arrays.copyOf(new Object[]{GraphRequest.userAgent, customUserAgent}, 2));
Intrinsics.checkNotNullExpressionValue(format2, "java.lang.String.format(locale, format, *args)");
GraphRequest.userAgent = format2;
}
}
return GraphRequest.userAgent;
}
private final String getBatchAppId(GraphRequestBatch graphRequestBatch) {
String batchApplicationId = graphRequestBatch.getBatchApplicationId();
if (batchApplicationId != null && (!graphRequestBatch.isEmpty())) {
return batchApplicationId;
}
Iterator<GraphRequest> it = graphRequestBatch.iterator();
while (it.hasNext()) {
AccessToken accessToken = it.next().getAccessToken();
if (accessToken != null) {
return accessToken.getApplicationId();
}
}
String str = GraphRequest.defaultBatchApplicationId;
return (str == null || str.length() <= 0) ? FacebookSdk.getApplicationId() : str;
}
/* JADX INFO: Access modifiers changed from: private */
public final boolean isSupportedAttachmentType(Object obj) {
return (obj instanceof Bitmap) || (obj instanceof byte[]) || (obj instanceof Uri) || (obj instanceof ParcelFileDescriptor) || (obj instanceof ParcelableResourceWithMimeType);
}
/* JADX INFO: Access modifiers changed from: private */
public final boolean isSupportedParameterType(Object obj) {
return (obj instanceof String) || (obj instanceof Boolean) || (obj instanceof Number) || (obj instanceof Date);
}
/* JADX INFO: Access modifiers changed from: private */
public final String parameterToString(Object obj) {
if (obj instanceof String) {
return (String) obj;
}
if ((obj instanceof Boolean) || (obj instanceof Number)) {
return obj.toString();
}
if (obj instanceof Date) {
String format = new SimpleDateFormat(GraphRequest.ISO_8601_FORMAT_STRING, Locale.US).format((Date) obj);
Intrinsics.checkNotNullExpressionValue(format, "iso8601DateFormat.format(value)");
return format;
}
throw new IllegalArgumentException("Unsupported parameter type.");
}
private final void serializeAttachments(Map<String, Attachment> map, Serializer serializer) {
for (Map.Entry<String, Attachment> entry : map.entrySet()) {
if (GraphRequest.Companion.isSupportedAttachmentType(entry.getValue().getValue())) {
serializer.writeObject(entry.getKey(), entry.getValue().getValue(), entry.getValue().getRequest());
}
}
}
}
static {
char[] charArray = "-_1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray();
Intrinsics.checkNotNullExpressionValue(charArray, "(this as java.lang.String).toCharArray()");
StringBuilder sb = new StringBuilder();
SecureRandom secureRandom = new SecureRandom();
int nextInt = secureRandom.nextInt(11) + 30;
if (nextInt > 0) {
int i = 0;
do {
i++;
sb.append(charArray[secureRandom.nextInt(charArray.length)]);
} while (i < nextInt);
}
String sb2 = sb.toString();
Intrinsics.checkNotNullExpressionValue(sb2, "buffer.toString()");
MIME_BOUNDARY = sb2;
versionPattern = Pattern.compile("^/?v\\d+\\.\\d+/(.*)");
}
public /* synthetic */ GraphRequest(AccessToken accessToken, String str, Bundle bundle, HttpMethod httpMethod, Callback callback, String str2, int i, DefaultConstructorMarker defaultConstructorMarker) {
this((i & 1) != 0 ? null : accessToken, (i & 2) != 0 ? null : str, (i & 4) != 0 ? null : bundle, (i & 8) != 0 ? null : httpMethod, (i & 16) != 0 ? null : callback, (i & 32) != 0 ? null : str2);
}
public GraphRequest(AccessToken accessToken, String str, Bundle bundle, HttpMethod httpMethod, Callback callback, String str2) {
this.batchEntryOmitResultOnSuccess = true;
this.accessToken = accessToken;
this.graphPath = str;
this.version = str2;
setCallback(callback);
setHttpMethod(httpMethod);
if (bundle != null) {
this.parameters = new Bundle(bundle);
} else {
this.parameters = new Bundle();
}
if (this.version == null) {
this.version = FacebookSdk.getGraphApiVersion();
}
}
public GraphRequest(AccessToken accessToken, URL overriddenURL) {
Intrinsics.checkNotNullParameter(overriddenURL, "overriddenURL");
this.batchEntryOmitResultOnSuccess = true;
this.accessToken = accessToken;
this.overriddenURL = overriddenURL.toString();
setHttpMethod(HttpMethod.GET);
this.parameters = new Bundle();
}
public final GraphResponse executeAndWait() {
return Companion.executeAndWait(this);
}
public final GraphRequestAsyncTask executeAsync() {
return Companion.executeBatchAsync(this);
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{Request: ");
sb.append(" accessToken: ");
Object obj = this.accessToken;
if (obj == null) {
obj = "null";
}
sb.append(obj);
sb.append(", graphPath: ");
sb.append(this.graphPath);
sb.append(", graphObject: ");
sb.append(this.graphObject);
sb.append(", httpMethod: ");
sb.append(this.httpMethod);
sb.append(", parameters: ");
sb.append(this.parameters);
sb.append("}");
String sb2 = sb.toString();
Intrinsics.checkNotNullExpressionValue(sb2, "StringBuilder()\n .append(\"{Request: \")\n .append(\" accessToken: \")\n .append(if (accessToken == null) \"null\" else accessToken)\n .append(\", graphPath: \")\n .append(graphPath)\n .append(\", graphObject: \")\n .append(graphObject)\n .append(\", httpMethod: \")\n .append(httpMethod)\n .append(\", parameters: \")\n .append(parameters)\n .append(\"}\")\n .toString()");
return sb2;
}
private final void addCommonParameters() {
Bundle bundle = this.parameters;
if (shouldForceClientTokenForRequest()) {
bundle.putString("access_token", getClientTokenForRequest());
} else {
String accessTokenToUseForRequest = getAccessTokenToUseForRequest();
if (accessTokenToUseForRequest != null) {
bundle.putString("access_token", accessTokenToUseForRequest);
}
}
if (!bundle.containsKey("access_token")) {
Utility utility = Utility.INSTANCE;
if (Utility.isNullOrEmpty(FacebookSdk.getClientToken())) {
Log.w(TAG, "Starting with v13 of the SDK, a client token must be embedded in your client code before making Graph API calls. Visit https://developers.facebook.com/docs/android/getting-started#client-token to learn how to implement this change.");
}
}
bundle.putString("sdk", "android");
bundle.putString(FORMAT_PARAM, FORMAT_JSON);
FacebookSdk facebookSdk = FacebookSdk.INSTANCE;
if (FacebookSdk.isLoggingBehaviorEnabled(LoggingBehavior.GRAPH_API_DEBUG_INFO)) {
bundle.putString("debug", DEBUG_SEVERITY_INFO);
} else if (FacebookSdk.isLoggingBehaviorEnabled(LoggingBehavior.GRAPH_API_DEBUG_WARNING)) {
bundle.putString("debug", DEBUG_SEVERITY_WARNING);
}
}
private final String getAccessTokenToUseForRequest() {
AccessToken accessToken = this.accessToken;
if (accessToken != null) {
if (!this.parameters.containsKey("access_token")) {
String token = accessToken.getToken();
Logger.Companion.registerAccessToken(token);
return token;
}
} else if (!this.parameters.containsKey("access_token")) {
return getClientTokenForRequest();
}
return this.parameters.getString("access_token");
}
private final String getClientTokenForRequest() {
String applicationId = FacebookSdk.getApplicationId();
String clientToken = FacebookSdk.getClientToken();
if (applicationId.length() > 0 && clientToken.length() > 0) {
return applicationId + '|' + clientToken;
}
Utility utility = Utility.INSTANCE;
Utility.logd(TAG, "Warning: Request without access token missing application ID or client token.");
return null;
}
private final String appendParametersToBaseUrl(String str, boolean z) {
if (!z && this.httpMethod == HttpMethod.POST) {
return str;
}
Uri.Builder buildUpon = Uri.parse(str).buildUpon();
for (String str2 : this.parameters.keySet()) {
Object obj = this.parameters.get(str2);
if (obj == null) {
obj = "";
}
Companion companion = Companion;
if (!companion.isSupportedParameterType(obj)) {
if (this.httpMethod != HttpMethod.GET) {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(Locale.US, "Unsupported parameter type for GET request: %s", Arrays.copyOf(new Object[]{obj.getClass().getSimpleName()}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(locale, format, *args)");
throw new IllegalArgumentException(format);
}
} else {
buildUpon.appendQueryParameter(str2, companion.parameterToString(obj).toString());
}
}
String builder = buildUpon.toString();
Intrinsics.checkNotNullExpressionValue(builder, "uriBuilder.toString()");
return builder;
}
public final String getRelativeUrlForBatchedRequest() {
if (this.overriddenURL != null) {
throw new FacebookException("Can't override URL for a batch request");
}
String urlWithGraphPath = getUrlWithGraphPath(ServerProtocol.getGraphUrlBase());
addCommonParameters();
Uri parse = Uri.parse(appendParametersToBaseUrl(urlWithGraphPath, true));
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("%s?%s", Arrays.copyOf(new Object[]{parse.getPath(), parse.getQuery()}, 2));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
return format;
}
public final String getUrlForSingleRequest() {
String graphUrlBaseForSubdomain;
String str = this.overriddenURL;
if (str != null) {
return String.valueOf(str);
}
String str2 = this.graphPath;
if (this.httpMethod == HttpMethod.POST && str2 != null && StringsKt__StringsJVMKt.endsWith$default(str2, VIDEOS_SUFFIX, false, 2, null)) {
graphUrlBaseForSubdomain = ServerProtocol.getGraphVideoUrlBase();
} else {
ServerProtocol serverProtocol = ServerProtocol.INSTANCE;
graphUrlBaseForSubdomain = ServerProtocol.getGraphUrlBaseForSubdomain(FacebookSdk.getGraphDomain());
}
String urlWithGraphPath = getUrlWithGraphPath(graphUrlBaseForSubdomain);
addCommonParameters();
return appendParametersToBaseUrl(urlWithGraphPath, false);
}
private final String getGraphPathWithVersion() {
if (versionPattern.matcher(this.graphPath).matches()) {
return this.graphPath;
}
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("%s/%s", Arrays.copyOf(new Object[]{this.version, this.graphPath}, 2));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
return format;
}
private final String getUrlWithGraphPath(String str) {
if (!isValidGraphRequestForDomain()) {
str = ServerProtocol.getFacebookGraphUrlBase();
}
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("%s/%s", Arrays.copyOf(new Object[]{str, getGraphPathWithVersion()}, 2));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
return format;
}
private final boolean shouldForceClientTokenForRequest() {
String accessTokenToUseForRequest = getAccessTokenToUseForRequest();
boolean contains$default = accessTokenToUseForRequest == null ? false : StringsKt__StringsKt.contains$default(accessTokenToUseForRequest, "|", false, 2, null);
if (accessTokenToUseForRequest == null || !StringsKt__StringsJVMKt.startsWith$default(accessTokenToUseForRequest, "IG", false, 2, null) || contains$default || !isApplicationRequest()) {
return (isValidGraphRequestForDomain() || contains$default) ? false : true;
}
return true;
}
private final boolean isValidGraphRequestForDomain() {
if (Intrinsics.areEqual(FacebookSdk.getGraphDomain(), FacebookSdk.INSTAGRAM_COM)) {
return !isApplicationRequest();
}
return true;
}
private final boolean isApplicationRequest() {
if (this.graphPath == null) {
return false;
}
StringBuilder sb = new StringBuilder();
sb.append("^/?");
sb.append(FacebookSdk.getApplicationId());
sb.append("/?.*");
return this.forceApplicationRequest || Pattern.matches(sb.toString(), this.graphPath) || Pattern.matches("^/?app/?.*", this.graphPath);
}
public static final class Attachment {
private final GraphRequest request;
private final Object value;
public final GraphRequest getRequest() {
return this.request;
}
public final Object getValue() {
return this.value;
}
public Attachment(GraphRequest request, Object obj) {
Intrinsics.checkNotNullParameter(request, "request");
this.request = request;
this.value = obj;
}
}
/* JADX INFO: Access modifiers changed from: private */
public final void serializeToBatch(JSONArray jSONArray, Map<String, Attachment> map) throws JSONException, IOException {
JSONObject jSONObject = new JSONObject();
String str = this.batchEntryName;
if (str != null) {
jSONObject.put("name", str);
jSONObject.put(BATCH_ENTRY_OMIT_RESPONSE_ON_SUCCESS_PARAM, this.batchEntryOmitResultOnSuccess);
}
String str2 = this.batchEntryDependsOn;
if (str2 != null) {
jSONObject.put(BATCH_ENTRY_DEPENDS_ON_PARAM, str2);
}
String relativeUrlForBatchedRequest = getRelativeUrlForBatchedRequest();
jSONObject.put(BATCH_RELATIVE_URL_PARAM, relativeUrlForBatchedRequest);
jSONObject.put("method", this.httpMethod);
AccessToken accessToken = this.accessToken;
if (accessToken != null) {
Logger.Companion.registerAccessToken(accessToken.getToken());
}
ArrayList arrayList = new ArrayList();
Iterator<String> it = this.parameters.keySet().iterator();
while (it.hasNext()) {
Object obj = this.parameters.get(it.next());
if (Companion.isSupportedAttachmentType(obj)) {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(Locale.ROOT, "%s%d", Arrays.copyOf(new Object[]{"file", Integer.valueOf(map.size())}, 2));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(locale, format, *args)");
arrayList.add(format);
map.put(format, new Attachment(this, obj));
}
}
if (!arrayList.isEmpty()) {
jSONObject.put(ATTACHED_FILES_PARAM, TextUtils.join(",", arrayList));
}
JSONObject jSONObject2 = this.graphObject;
if (jSONObject2 != null) {
final ArrayList arrayList2 = new ArrayList();
Companion.processGraphObject(jSONObject2, relativeUrlForBatchedRequest, new KeyValueSerializer() { // from class: com.facebook.GraphRequest$serializeToBatch$1
@Override // com.facebook.GraphRequest.KeyValueSerializer
public void writeString(String key, String value) throws IOException {
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(value, "value");
ArrayList<String> arrayList3 = arrayList2;
StringCompanionObject stringCompanionObject2 = StringCompanionObject.INSTANCE;
String format2 = String.format(Locale.US, "%s=%s", Arrays.copyOf(new Object[]{key, URLEncoder.encode(value, "UTF-8")}, 2));
Intrinsics.checkNotNullExpressionValue(format2, "java.lang.String.format(locale, format, *args)");
arrayList3.add(format2);
}
});
jSONObject.put("body", TextUtils.join(v8.i.c, arrayList2));
}
jSONArray.put(jSONObject);
}
public static final class Serializer implements KeyValueSerializer {
private boolean firstWrite;
private final Logger logger;
private final OutputStream outputStream;
private final boolean useUrlEncode;
public Serializer(OutputStream outputStream, Logger logger, boolean z) {
Intrinsics.checkNotNullParameter(outputStream, "outputStream");
this.outputStream = outputStream;
this.logger = logger;
this.firstWrite = true;
this.useUrlEncode = z;
}
public final void writeObject(String key, Object obj, GraphRequest graphRequest) {
Intrinsics.checkNotNullParameter(key, "key");
Closeable closeable = this.outputStream;
if (closeable instanceof RequestOutputStream) {
((RequestOutputStream) closeable).setCurrentRequest(graphRequest);
}
Companion companion = GraphRequest.Companion;
if (companion.isSupportedParameterType(obj)) {
writeString(key, companion.parameterToString(obj));
return;
}
if (obj instanceof Bitmap) {
writeBitmap(key, (Bitmap) obj);
return;
}
if (obj instanceof byte[]) {
writeBytes(key, (byte[]) obj);
return;
}
if (obj instanceof Uri) {
writeContentUri(key, (Uri) obj, null);
return;
}
if (obj instanceof ParcelFileDescriptor) {
writeFile(key, (ParcelFileDescriptor) obj, null);
return;
}
if (obj instanceof ParcelableResourceWithMimeType) {
ParcelableResourceWithMimeType parcelableResourceWithMimeType = (ParcelableResourceWithMimeType) obj;
Parcelable resource = parcelableResourceWithMimeType.getResource();
String mimeType = parcelableResourceWithMimeType.getMimeType();
if (resource instanceof ParcelFileDescriptor) {
writeFile(key, (ParcelFileDescriptor) resource, mimeType);
return;
} else {
if (resource instanceof Uri) {
writeContentUri(key, (Uri) resource, mimeType);
return;
}
throw getInvalidTypeError();
}
}
throw getInvalidTypeError();
}
private final RuntimeException getInvalidTypeError() {
return new IllegalArgumentException("value is not a supported type.");
}
public final void writeRequestsAsJson(String key, JSONArray requestJsonArray, Collection<GraphRequest> requests) {
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(requestJsonArray, "requestJsonArray");
Intrinsics.checkNotNullParameter(requests, "requests");
Closeable closeable = this.outputStream;
if (!(closeable instanceof RequestOutputStream)) {
String jSONArray = requestJsonArray.toString();
Intrinsics.checkNotNullExpressionValue(jSONArray, "requestJsonArray.toString()");
writeString(key, jSONArray);
return;
}
RequestOutputStream requestOutputStream = (RequestOutputStream) closeable;
writeContentDisposition(key, null, null);
write(v8.i.d, new Object[0]);
int i = 0;
for (GraphRequest graphRequest : requests) {
int i2 = i + 1;
JSONObject jSONObject = requestJsonArray.getJSONObject(i);
requestOutputStream.setCurrentRequest(graphRequest);
if (i > 0) {
write(",%s", jSONObject.toString());
} else {
write("%s", jSONObject.toString());
}
i = i2;
}
write(v8.i.e, new Object[0]);
Logger logger = this.logger;
if (logger == null) {
return;
}
String stringPlus = Intrinsics.stringPlus(" ", key);
String jSONArray2 = requestJsonArray.toString();
Intrinsics.checkNotNullExpressionValue(jSONArray2, "requestJsonArray.toString()");
logger.appendKeyValue(stringPlus, jSONArray2);
}
@Override // com.facebook.GraphRequest.KeyValueSerializer
public void writeString(String key, String value) {
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(value, "value");
writeContentDisposition(key, null, null);
writeLine("%s", value);
writeRecordBoundary();
Logger logger = this.logger;
if (logger == null) {
return;
}
logger.appendKeyValue(Intrinsics.stringPlus(" ", key), value);
}
public final void writeBitmap(String key, Bitmap bitmap) {
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(bitmap, "bitmap");
writeContentDisposition(key, key, "image/png");
bitmap.compress(Bitmap.CompressFormat.PNG, 100, this.outputStream);
writeLine("", new Object[0]);
writeRecordBoundary();
Logger logger = this.logger;
if (logger == null) {
return;
}
logger.appendKeyValue(Intrinsics.stringPlus(" ", key), "<Image>");
}
public final void writeBytes(String key, byte[] bytes) {
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(bytes, "bytes");
writeContentDisposition(key, key, "content/unknown");
this.outputStream.write(bytes);
writeLine("", new Object[0]);
writeRecordBoundary();
Logger logger = this.logger;
if (logger == null) {
return;
}
String stringPlus = Intrinsics.stringPlus(" ", key);
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(Locale.ROOT, "<Data: %d>", Arrays.copyOf(new Object[]{Integer.valueOf(bytes.length)}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(locale, format, *args)");
logger.appendKeyValue(stringPlus, format);
}
public final void writeContentUri(String key, Uri contentUri, String str) {
int copyAndCloseInputStream;
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(contentUri, "contentUri");
if (str == null) {
str = "content/unknown";
}
writeContentDisposition(key, key, str);
if (this.outputStream instanceof ProgressNoopOutputStream) {
((ProgressNoopOutputStream) this.outputStream).addProgress(Utility.getContentSize(contentUri));
copyAndCloseInputStream = 0;
} else {
InputStream openInputStream = FacebookSdk.getApplicationContext().getContentResolver().openInputStream(contentUri);
Utility utility = Utility.INSTANCE;
copyAndCloseInputStream = Utility.copyAndCloseInputStream(openInputStream, this.outputStream);
}
writeLine("", new Object[0]);
writeRecordBoundary();
Logger logger = this.logger;
if (logger == null) {
return;
}
String stringPlus = Intrinsics.stringPlus(" ", key);
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(Locale.ROOT, "<Data: %d>", Arrays.copyOf(new Object[]{Integer.valueOf(copyAndCloseInputStream)}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(locale, format, *args)");
logger.appendKeyValue(stringPlus, format);
}
public final void writeFile(String key, ParcelFileDescriptor descriptor, String str) {
int copyAndCloseInputStream;
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(descriptor, "descriptor");
if (str == null) {
str = "content/unknown";
}
writeContentDisposition(key, key, str);
OutputStream outputStream = this.outputStream;
if (outputStream instanceof ProgressNoopOutputStream) {
((ProgressNoopOutputStream) outputStream).addProgress(descriptor.getStatSize());
copyAndCloseInputStream = 0;
} else {
ParcelFileDescriptor.AutoCloseInputStream autoCloseInputStream = new ParcelFileDescriptor.AutoCloseInputStream(descriptor);
Utility utility = Utility.INSTANCE;
copyAndCloseInputStream = Utility.copyAndCloseInputStream(autoCloseInputStream, this.outputStream);
}
writeLine("", new Object[0]);
writeRecordBoundary();
Logger logger = this.logger;
if (logger == null) {
return;
}
String stringPlus = Intrinsics.stringPlus(" ", key);
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(Locale.ROOT, "<Data: %d>", Arrays.copyOf(new Object[]{Integer.valueOf(copyAndCloseInputStream)}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(locale, format, *args)");
logger.appendKeyValue(stringPlus, format);
}
public final void writeRecordBoundary() {
if (!this.useUrlEncode) {
writeLine("--%s", GraphRequest.MIME_BOUNDARY);
return;
}
OutputStream outputStream = this.outputStream;
byte[] bytes = v8.i.c.getBytes(Charsets.UTF_8);
Intrinsics.checkNotNullExpressionValue(bytes, "(this as java.lang.String).getBytes(charset)");
outputStream.write(bytes);
}
public final void writeContentDisposition(String str, String str2, String str3) {
if (!this.useUrlEncode) {
write("Content-Disposition: form-data; name=\"%s\"", str);
if (str2 != null) {
write("; filename=\"%s\"", str2);
}
writeLine("", new Object[0]);
if (str3 != null) {
writeLine("%s: %s", "Content-Type", str3);
}
writeLine("", new Object[0]);
return;
}
OutputStream outputStream = this.outputStream;
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("%s=", Arrays.copyOf(new Object[]{str}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
Charset charset = Charsets.UTF_8;
if (format == null) {
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
}
byte[] bytes = format.getBytes(charset);
Intrinsics.checkNotNullExpressionValue(bytes, "(this as java.lang.String).getBytes(charset)");
outputStream.write(bytes);
}
public final void write(String format, Object... args) {
Intrinsics.checkNotNullParameter(format, "format");
Intrinsics.checkNotNullParameter(args, "args");
if (!this.useUrlEncode) {
if (this.firstWrite) {
OutputStream outputStream = this.outputStream;
Charset charset = Charsets.UTF_8;
byte[] bytes = "--".getBytes(charset);
Intrinsics.checkNotNullExpressionValue(bytes, "(this as java.lang.String).getBytes(charset)");
outputStream.write(bytes);
OutputStream outputStream2 = this.outputStream;
String str = GraphRequest.MIME_BOUNDARY;
if (str == null) {
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
}
byte[] bytes2 = str.getBytes(charset);
Intrinsics.checkNotNullExpressionValue(bytes2, "(this as java.lang.String).getBytes(charset)");
outputStream2.write(bytes2);
OutputStream outputStream3 = this.outputStream;
byte[] bytes3 = "\r\n".getBytes(charset);
Intrinsics.checkNotNullExpressionValue(bytes3, "(this as java.lang.String).getBytes(charset)");
outputStream3.write(bytes3);
this.firstWrite = false;
}
OutputStream outputStream4 = this.outputStream;
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
Object[] copyOf = Arrays.copyOf(args, args.length);
String format2 = String.format(format, Arrays.copyOf(copyOf, copyOf.length));
Intrinsics.checkNotNullExpressionValue(format2, "java.lang.String.format(format, *args)");
Charset charset2 = Charsets.UTF_8;
if (format2 == null) {
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
}
byte[] bytes4 = format2.getBytes(charset2);
Intrinsics.checkNotNullExpressionValue(bytes4, "(this as java.lang.String).getBytes(charset)");
outputStream4.write(bytes4);
return;
}
OutputStream outputStream5 = this.outputStream;
StringCompanionObject stringCompanionObject2 = StringCompanionObject.INSTANCE;
Locale locale = Locale.US;
Object[] copyOf2 = Arrays.copyOf(args, args.length);
String format3 = String.format(locale, format, Arrays.copyOf(copyOf2, copyOf2.length));
Intrinsics.checkNotNullExpressionValue(format3, "java.lang.String.format(locale, format, *args)");
String encode = URLEncoder.encode(format3, "UTF-8");
Intrinsics.checkNotNullExpressionValue(encode, "encode(String.format(Locale.US, format, *args), \"UTF-8\")");
byte[] bytes5 = encode.getBytes(Charsets.UTF_8);
Intrinsics.checkNotNullExpressionValue(bytes5, "(this as java.lang.String).getBytes(charset)");
outputStream5.write(bytes5);
}
public final void writeLine(String format, Object... args) {
Intrinsics.checkNotNullParameter(format, "format");
Intrinsics.checkNotNullParameter(args, "args");
write(format, Arrays.copyOf(args, args.length));
if (this.useUrlEncode) {
return;
}
write("\r\n", new Object[0]);
}
}
public static final class ParcelableResourceWithMimeType<RESOURCE extends Parcelable> implements Parcelable {
private final String mimeType;
private final RESOURCE resource;
public static final Companion Companion = new Companion(null);
public static final Parcelable.Creator<ParcelableResourceWithMimeType<?>> CREATOR = new Parcelable.Creator<ParcelableResourceWithMimeType<?>>() { // from class: com.facebook.GraphRequest$ParcelableResourceWithMimeType$Companion$CREATOR$1
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public GraphRequest.ParcelableResourceWithMimeType<?> createFromParcel(Parcel source) {
Intrinsics.checkNotNullParameter(source, "source");
return new GraphRequest.ParcelableResourceWithMimeType<>(source, (DefaultConstructorMarker) null);
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public GraphRequest.ParcelableResourceWithMimeType<?>[] newArray(int i) {
return new GraphRequest.ParcelableResourceWithMimeType[i];
}
};
public /* synthetic */ ParcelableResourceWithMimeType(Parcel parcel, DefaultConstructorMarker defaultConstructorMarker) {
this(parcel);
}
@Override // android.os.Parcelable
public int describeContents() {
return 1;
}
public final String getMimeType() {
return this.mimeType;
}
public final RESOURCE getResource() {
return this.resource;
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel out, int i) {
Intrinsics.checkNotNullParameter(out, "out");
out.writeString(this.mimeType);
out.writeParcelable(this.resource, i);
}
public ParcelableResourceWithMimeType(RESOURCE resource, String str) {
this.mimeType = str;
this.resource = resource;
}
private ParcelableResourceWithMimeType(Parcel parcel) {
this.mimeType = parcel.readString();
this.resource = (RESOURCE) parcel.readParcelable(FacebookSdk.getApplicationContext().getClassLoader());
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}
}