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>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
package com.facebook.gamingservices;
/* loaded from: classes2.dex */
public final class BuildConfig {
public static final String BUILD_TYPE = "release";
public static final boolean DEBUG = false;
public static final String LIBRARY_PACKAGE_NAME = "com.facebook.gamingservices";
}

View File

@@ -0,0 +1,344 @@
package com.facebook.gamingservices;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import com.facebook.AccessToken;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.FacebookRequestError;
import com.facebook.FacebookSdk;
import com.facebook.GraphResponse;
import com.facebook.gamingservices.ContextChooseDialog;
import com.facebook.gamingservices.cloudgaming.CloudGameLoginHandler;
import com.facebook.gamingservices.cloudgaming.DaemonRequest;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.gamingservices.cloudgaming.internal.SDKMessageEnum;
import com.facebook.gamingservices.model.ContextChooseContent;
import com.facebook.internal.AppCall;
import com.facebook.internal.CallbackManagerImpl;
import com.facebook.internal.CustomTabUtils;
import com.facebook.internal.DialogPresenter;
import com.facebook.internal.FacebookDialogBase;
import com.facebook.internal.FragmentWrapper;
import com.facebook.internal.NativeProtocol;
import com.facebook.internal.ServerProtocol;
import com.facebook.share.internal.ResultProcessor;
import com.facebook.share.internal.ShareInternalUtility;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import kotlin.Unit;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class ContextChooseDialog extends FacebookDialogBase<ContextChooseContent, Result> {
private static final String CONTEXT_CHOOSE_DIALOG = "context_choose";
public static final Companion Companion = new Companion(null);
private static final int DEFAULT_REQUEST_CODE = CallbackManagerImpl.RequestCodeOffset.GamingContextChoose.toRequestCode();
private FacebookCallback<Result> callback;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public ContextChooseDialog(Activity activity) {
super(activity, DEFAULT_REQUEST_CODE);
Intrinsics.checkNotNullParameter(activity, "activity");
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public ContextChooseDialog(Fragment fragment) {
this(new FragmentWrapper(fragment));
Intrinsics.checkNotNullParameter(fragment, "fragment");
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public ContextChooseDialog(android.app.Fragment fragment) {
this(new FragmentWrapper(fragment));
Intrinsics.checkNotNullParameter(fragment, "fragment");
}
private ContextChooseDialog(FragmentWrapper fragmentWrapper) {
super(fragmentWrapper, DEFAULT_REQUEST_CODE);
}
@Override // com.facebook.internal.FacebookDialogBase, com.facebook.FacebookDialog
public boolean canShow(ContextChooseContent content) {
Intrinsics.checkNotNullParameter(content, "content");
return CloudGameLoginHandler.isRunningInCloud() || new FacebookAppHandler(this).canShow(content, true) || new ChromeCustomTabHandler(this).canShow(content, true);
}
@Override // com.facebook.internal.FacebookDialogBase
public void showImpl(ContextChooseContent content, Object mode) {
Intrinsics.checkNotNullParameter(content, "content");
Intrinsics.checkNotNullParameter(mode, "mode");
if (CloudGameLoginHandler.isRunningInCloud()) {
showForCloud(content);
} else {
super.showImpl((ContextChooseDialog) content, mode);
}
}
private final void showForCloud(ContextChooseContent contextChooseContent) {
AccessToken currentAccessToken = AccessToken.Companion.getCurrentAccessToken();
if (currentAccessToken == null || currentAccessToken.isExpired()) {
throw new FacebookException("Attempted to open ContextChooseContent with an invalid access token");
}
DaemonRequest.Callback callback = new DaemonRequest.Callback() { // from class: com.facebook.gamingservices.ContextChooseDialog$$ExternalSyntheticLambda0
@Override // com.facebook.gamingservices.cloudgaming.DaemonRequest.Callback
public final void onCompleted(GraphResponse graphResponse) {
ContextChooseDialog.m544showForCloud$lambda2(ContextChooseDialog.this, graphResponse);
}
};
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("filters", contextChooseContent.getFilters());
jSONObject.put(SDKConstants.PARAM_CONTEXT_MIN_SIZE, contextChooseContent.getMinSize());
List<String> filters = contextChooseContent.getFilters();
if (filters != null) {
JSONArray jSONArray = new JSONArray();
Iterator<String> it = filters.iterator();
while (it.hasNext()) {
jSONArray.put(it.next());
}
jSONObject.put("filters", jSONArray);
}
DaemonRequest.executeAsync(getActivityContext(), jSONObject, callback, SDKMessageEnum.CONTEXT_CHOOSE);
} catch (JSONException unused) {
FacebookCallback<Result> facebookCallback = this.callback;
if (facebookCallback == null) {
return;
}
facebookCallback.onError(new FacebookException("Couldn't prepare Context Choose Dialog"));
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: showForCloud$lambda-2, reason: not valid java name */
public static final void m544showForCloud$lambda2(ContextChooseDialog this$0, GraphResponse response) {
Unit unit;
Intrinsics.checkNotNullParameter(this$0, "this$0");
FacebookCallback<Result> facebookCallback = this$0.callback;
if (facebookCallback == null) {
return;
}
FacebookRequestError error = response.getError();
if (error == null) {
unit = null;
} else {
facebookCallback.onError(new FacebookException(error.getErrorMessage()));
unit = Unit.INSTANCE;
}
if (unit == null) {
Intrinsics.checkNotNullExpressionValue(response, "response");
facebookCallback.onSuccess(new Result(response));
}
}
/* JADX WARN: Type inference failed for: r0v2, types: [com.facebook.gamingservices.ContextChooseDialog$registerCallbackImpl$resultProcessor$1] */
@Override // com.facebook.internal.FacebookDialogBase
public void registerCallbackImpl(CallbackManagerImpl callbackManager, final FacebookCallback<Result> callback) {
Intrinsics.checkNotNullParameter(callbackManager, "callbackManager");
Intrinsics.checkNotNullParameter(callback, "callback");
this.callback = callback;
final ?? r0 = new ResultProcessor(callback) { // from class: com.facebook.gamingservices.ContextChooseDialog$registerCallbackImpl$resultProcessor$1
final /* synthetic */ FacebookCallback<ContextChooseDialog.Result> $callback;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(callback);
this.$callback = callback;
}
@Override // com.facebook.share.internal.ResultProcessor
public void onSuccess(AppCall appCall, Bundle bundle) {
Intrinsics.checkNotNullParameter(appCall, "appCall");
if (bundle != null) {
if (bundle.getString("error_message") != null) {
this.$callback.onError(new FacebookException(bundle.getString("error_message")));
return;
}
String string = bundle.getString("id");
if (string != null) {
GamingContext.Companion.setCurrentGamingContext(new GamingContext(string));
this.$callback.onSuccess(new ContextChooseDialog.Result(bundle));
}
this.$callback.onError(new FacebookException(bundle.getString("Invalid response received from server.")));
return;
}
onCancel(appCall);
}
};
callbackManager.registerCallback(getRequestCode(), new CallbackManagerImpl.Callback() { // from class: com.facebook.gamingservices.ContextChooseDialog$$ExternalSyntheticLambda1
@Override // com.facebook.internal.CallbackManagerImpl.Callback
public final boolean onActivityResult(int i, Intent intent) {
boolean m543registerCallbackImpl$lambda4;
m543registerCallbackImpl$lambda4 = ContextChooseDialog.m543registerCallbackImpl$lambda4(ContextChooseDialog.this, r0, i, intent);
return m543registerCallbackImpl$lambda4;
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: registerCallbackImpl$lambda-4, reason: not valid java name */
public static final boolean m543registerCallbackImpl$lambda4(ContextChooseDialog this$0, ContextChooseDialog$registerCallbackImpl$resultProcessor$1 resultProcessor, int i, Intent intent) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(resultProcessor, "$resultProcessor");
ShareInternalUtility shareInternalUtility = ShareInternalUtility.INSTANCE;
return ShareInternalUtility.handleActivityResult(this$0.getRequestCode(), i, intent, resultProcessor);
}
@Override // com.facebook.internal.FacebookDialogBase
public List<FacebookDialogBase<ContextChooseContent, Result>.ModeHandler> getOrderedModeHandlers() {
List<FacebookDialogBase<ContextChooseContent, Result>.ModeHandler> listOf;
listOf = CollectionsKt__CollectionsKt.listOf((Object[]) new FacebookDialogBase.ModeHandler[]{new FacebookAppHandler(this), new ChromeCustomTabHandler(this)});
return listOf;
}
@Override // com.facebook.internal.FacebookDialogBase
public AppCall createBaseAppCall() {
return new AppCall(getRequestCode(), null, 2, null);
}
public static final class Result {
private String contextID;
public final String getContextID() {
return this.contextID;
}
public final void setContextID(String str) {
this.contextID = str;
}
public Result(Bundle results) {
Intrinsics.checkNotNullParameter(results, "results");
this.contextID = results.getString("id");
}
public Result(GraphResponse response) {
JSONObject optJSONObject;
Intrinsics.checkNotNullParameter(response, "response");
try {
JSONObject jSONObject = response.getJSONObject();
if (jSONObject != null && (optJSONObject = jSONObject.optJSONObject("data")) != null) {
setContextID(optJSONObject.getString("id"));
}
} catch (JSONException unused) {
this.contextID = null;
}
}
}
public final class FacebookAppHandler extends FacebookDialogBase<ContextChooseContent, Result>.ModeHandler {
final /* synthetic */ ContextChooseDialog this$0;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public FacebookAppHandler(ContextChooseDialog this$0) {
super(this$0);
Intrinsics.checkNotNullParameter(this$0, "this$0");
this.this$0 = this$0;
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public boolean canShow(ContextChooseContent content, boolean z) {
Intrinsics.checkNotNullParameter(content, "content");
Activity activityContext = this.this$0.getActivityContext();
PackageManager packageManager = activityContext == null ? null : activityContext.getPackageManager();
Intent intent = new Intent("com.facebook.games.gaming_services.DEEPLINK");
intent.setType("text/plain");
boolean z2 = (packageManager == null ? null : intent.resolveActivity(packageManager)) != null;
AccessToken currentAccessToken = AccessToken.Companion.getCurrentAccessToken();
return z2 && ((currentAccessToken != null ? currentAccessToken.getGraphDomain() : null) != null && Intrinsics.areEqual(FacebookSdk.GAMING, currentAccessToken.getGraphDomain()));
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public AppCall createAppCall(ContextChooseContent content) {
Intrinsics.checkNotNullParameter(content, "content");
AppCall createBaseAppCall = this.this$0.createBaseAppCall();
Intent intent = new Intent("com.facebook.games.gaming_services.DEEPLINK");
intent.setType("text/plain");
AccessToken currentAccessToken = AccessToken.Companion.getCurrentAccessToken();
Bundle bundle = new Bundle();
bundle.putString(SDKConstants.PARAM_TOURNAMENTS_DEEPLINK, "CONTEXT_CHOOSE");
if (currentAccessToken != null) {
bundle.putString("game_id", currentAccessToken.getApplicationId());
} else {
bundle.putString("game_id", FacebookSdk.getApplicationId());
}
if (content.getMinSize() != null) {
bundle.putString("min_thread_size", content.getMinSize().toString());
}
if (content.getMaxSize() != null) {
bundle.putString("max_thread_size", content.getMaxSize().toString());
}
if (content.getFilters() != null) {
bundle.putString("filters", new JSONArray((Collection) content.getFilters()).toString());
}
NativeProtocol nativeProtocol = NativeProtocol.INSTANCE;
NativeProtocol.setupProtocolRequestIntent(intent, createBaseAppCall.getCallId().toString(), "", NativeProtocol.getLatestKnownVersion(), bundle);
createBaseAppCall.setRequestIntent(intent);
return createBaseAppCall;
}
}
public final class ChromeCustomTabHandler extends FacebookDialogBase<ContextChooseContent, Result>.ModeHandler {
final /* synthetic */ ContextChooseDialog this$0;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public ChromeCustomTabHandler(ContextChooseDialog this$0) {
super(this$0);
Intrinsics.checkNotNullParameter(this$0, "this$0");
this.this$0 = this$0;
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public boolean canShow(ContextChooseContent content, boolean z) {
Intrinsics.checkNotNullParameter(content, "content");
return CustomTabUtils.getChromePackage() != null;
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public AppCall createAppCall(ContextChooseContent content) {
Intrinsics.checkNotNullParameter(content, "content");
AppCall createBaseAppCall = this.this$0.createBaseAppCall();
AccessToken currentAccessToken = AccessToken.Companion.getCurrentAccessToken();
Bundle bundle = new Bundle();
Bundle bundle2 = new Bundle();
Bundle bundle3 = new Bundle();
String applicationId = currentAccessToken == null ? null : currentAccessToken.getApplicationId();
if (applicationId == null) {
applicationId = FacebookSdk.getApplicationId();
}
bundle.putString("app_id", applicationId);
if (content.getMinSize() != null) {
bundle3.putString("min_size", content.getMinSize().toString());
}
if (content.getMaxSize() != null) {
bundle3.putString("max_size", content.getMaxSize().toString());
}
if (content.getFilters() != null) {
bundle3.putString("filters", new JSONArray((Collection) content.getFilters()).toString());
}
bundle2.putString("filters", bundle3.toString());
bundle.putString("payload", bundle2.toString());
bundle.putString(ServerProtocol.DIALOG_PARAM_REDIRECT_URI, CustomTabUtils.getDefaultRedirectURI());
DialogPresenter.setupAppCallForCustomTabDialog(createBaseAppCall, ContextChooseDialog.CONTEXT_CHOOSE_DIALOG, bundle);
return createBaseAppCall;
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}

View File

@@ -0,0 +1,312 @@
package com.facebook.gamingservices;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import com.facebook.AccessToken;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.FacebookRequestError;
import com.facebook.FacebookSdk;
import com.facebook.GraphResponse;
import com.facebook.gamingservices.ContextCreateDialog;
import com.facebook.gamingservices.cloudgaming.CloudGameLoginHandler;
import com.facebook.gamingservices.cloudgaming.DaemonRequest;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.gamingservices.cloudgaming.internal.SDKMessageEnum;
import com.facebook.gamingservices.model.ContextCreateContent;
import com.facebook.internal.AppCall;
import com.facebook.internal.CallbackManagerImpl;
import com.facebook.internal.DialogPresenter;
import com.facebook.internal.FacebookDialogBase;
import com.facebook.internal.FragmentWrapper;
import com.facebook.internal.NativeProtocol;
import com.facebook.share.internal.ResultProcessor;
import com.facebook.share.internal.ShareInternalUtility;
import java.util.List;
import kotlin.Unit;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class ContextCreateDialog extends FacebookDialogBase<ContextCreateContent, Result> {
public static final Companion Companion = new Companion(null);
private static final int DEFAULT_REQUEST_CODE = CallbackManagerImpl.RequestCodeOffset.GamingContextCreate.toRequestCode();
private FacebookCallback<Result> callback;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public ContextCreateDialog(Activity activity) {
super(activity, DEFAULT_REQUEST_CODE);
Intrinsics.checkNotNullParameter(activity, "activity");
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public ContextCreateDialog(Fragment fragment) {
this(new FragmentWrapper(fragment));
Intrinsics.checkNotNullParameter(fragment, "fragment");
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public ContextCreateDialog(android.app.Fragment fragment) {
this(new FragmentWrapper(fragment));
Intrinsics.checkNotNullParameter(fragment, "fragment");
}
private ContextCreateDialog(FragmentWrapper fragmentWrapper) {
super(fragmentWrapper, DEFAULT_REQUEST_CODE);
}
@Override // com.facebook.internal.FacebookDialogBase, com.facebook.FacebookDialog
public boolean canShow(ContextCreateContent content) {
Intrinsics.checkNotNullParameter(content, "content");
return CloudGameLoginHandler.isRunningInCloud() || new FacebookAppHandler(this).canShow(content, true) || new WebHandler(this).canShow(content, true);
}
@Override // com.facebook.internal.FacebookDialogBase
public void showImpl(ContextCreateContent content, Object mode) {
Intrinsics.checkNotNullParameter(content, "content");
Intrinsics.checkNotNullParameter(mode, "mode");
if (CloudGameLoginHandler.isRunningInCloud()) {
showForCloud(content);
} else {
super.showImpl((ContextCreateDialog) content, mode);
}
}
private final void showForCloud(ContextCreateContent contextCreateContent) {
AccessToken currentAccessToken = AccessToken.Companion.getCurrentAccessToken();
if (currentAccessToken == null || currentAccessToken.isExpired()) {
throw new FacebookException("Attempted to open ContextCreateContent with an invalid access token");
}
DaemonRequest.Callback callback = new DaemonRequest.Callback() { // from class: com.facebook.gamingservices.ContextCreateDialog$$ExternalSyntheticLambda1
@Override // com.facebook.gamingservices.cloudgaming.DaemonRequest.Callback
public final void onCompleted(GraphResponse graphResponse) {
ContextCreateDialog.m547showForCloud$lambda2(ContextCreateDialog.this, graphResponse);
}
};
JSONObject jSONObject = new JSONObject();
try {
if (contextCreateContent.getSuggestedPlayerID() != null) {
jSONObject.put("id", contextCreateContent.getSuggestedPlayerID());
}
DaemonRequest.executeAsync(getActivityContext(), jSONObject, callback, SDKMessageEnum.CONTEXT_CREATE);
} catch (JSONException unused) {
FacebookCallback<Result> facebookCallback = this.callback;
if (facebookCallback == null) {
return;
}
facebookCallback.onError(new FacebookException("Couldn't prepare Context Create Dialog"));
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: showForCloud$lambda-2, reason: not valid java name */
public static final void m547showForCloud$lambda2(ContextCreateDialog this$0, GraphResponse response) {
Unit unit;
Intrinsics.checkNotNullParameter(this$0, "this$0");
FacebookCallback<Result> facebookCallback = this$0.callback;
if (facebookCallback == null) {
return;
}
FacebookRequestError error = response.getError();
if (error == null) {
unit = null;
} else {
facebookCallback.onError(new FacebookException(error.getErrorMessage()));
unit = Unit.INSTANCE;
}
if (unit == null) {
Intrinsics.checkNotNullExpressionValue(response, "response");
facebookCallback.onSuccess(new Result(response));
}
}
@Override // com.facebook.internal.FacebookDialogBase
public void registerCallbackImpl(CallbackManagerImpl callbackManager, final FacebookCallback<Result> callback) {
Intrinsics.checkNotNullParameter(callbackManager, "callbackManager");
Intrinsics.checkNotNullParameter(callback, "callback");
this.callback = callback;
final ResultProcessor resultProcessor = new ResultProcessor(callback) { // from class: com.facebook.gamingservices.ContextCreateDialog$registerCallbackImpl$resultProcessor$1
final /* synthetic */ FacebookCallback<ContextCreateDialog.Result> $callback;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(callback);
this.$callback = callback;
}
@Override // com.facebook.share.internal.ResultProcessor
public void onSuccess(AppCall appCall, Bundle bundle) {
Intrinsics.checkNotNullParameter(appCall, "appCall");
if (bundle != null) {
if (bundle.getString("error_message") != null) {
this.$callback.onError(new FacebookException(bundle.getString("error_message")));
return;
}
String string = bundle.getString("id");
String string2 = bundle.getString(SDKConstants.PARAM_CONTEXT_CONTEXT_ID);
if (string != null) {
GamingContext.Companion.setCurrentGamingContext(new GamingContext(string));
this.$callback.onSuccess(new ContextCreateDialog.Result(string));
} else if (string2 != null) {
GamingContext.Companion.setCurrentGamingContext(new GamingContext(string2));
this.$callback.onSuccess(new ContextCreateDialog.Result(string2));
}
this.$callback.onError(new FacebookException(bundle.getString("Invalid response received from server.")));
return;
}
onCancel(appCall);
}
};
callbackManager.registerCallback(getRequestCode(), new CallbackManagerImpl.Callback() { // from class: com.facebook.gamingservices.ContextCreateDialog$$ExternalSyntheticLambda0
@Override // com.facebook.internal.CallbackManagerImpl.Callback
public final boolean onActivityResult(int i, Intent intent) {
boolean m546registerCallbackImpl$lambda3;
m546registerCallbackImpl$lambda3 = ContextCreateDialog.m546registerCallbackImpl$lambda3(ContextCreateDialog.this, resultProcessor, i, intent);
return m546registerCallbackImpl$lambda3;
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: registerCallbackImpl$lambda-3, reason: not valid java name */
public static final boolean m546registerCallbackImpl$lambda3(ContextCreateDialog this$0, ResultProcessor resultProcessor, int i, Intent intent) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(resultProcessor, "$resultProcessor");
ShareInternalUtility shareInternalUtility = ShareInternalUtility.INSTANCE;
return ShareInternalUtility.handleActivityResult(this$0.getRequestCode(), i, intent, resultProcessor);
}
@Override // com.facebook.internal.FacebookDialogBase
public List<FacebookDialogBase<ContextCreateContent, Result>.ModeHandler> getOrderedModeHandlers() {
List<FacebookDialogBase<ContextCreateContent, Result>.ModeHandler> listOf;
listOf = CollectionsKt__CollectionsKt.listOf((Object[]) new FacebookDialogBase.ModeHandler[]{new FacebookAppHandler(this), new WebHandler(this)});
return listOf;
}
@Override // com.facebook.internal.FacebookDialogBase
public AppCall createBaseAppCall() {
return new AppCall(getRequestCode(), null, 2, null);
}
public static final class Result {
private String contextID;
public final String getContextID() {
return this.contextID;
}
public final void setContextID(String str) {
this.contextID = str;
}
public Result(String contextID) {
Intrinsics.checkNotNullParameter(contextID, "contextID");
this.contextID = contextID;
}
public Result(GraphResponse response) {
JSONObject optJSONObject;
Intrinsics.checkNotNullParameter(response, "response");
try {
JSONObject jSONObject = response.getJSONObject();
if (jSONObject != null && (optJSONObject = jSONObject.optJSONObject("data")) != null) {
setContextID(optJSONObject.getString("id"));
}
} catch (JSONException unused) {
this.contextID = null;
}
}
}
public final class WebHandler extends FacebookDialogBase<ContextCreateContent, Result>.ModeHandler {
final /* synthetic */ ContextCreateDialog this$0;
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public boolean canShow(ContextCreateContent content, boolean z) {
Intrinsics.checkNotNullParameter(content, "content");
return true;
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public WebHandler(ContextCreateDialog this$0) {
super(this$0);
Intrinsics.checkNotNullParameter(this$0, "this$0");
this.this$0 = this$0;
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public AppCall createAppCall(ContextCreateContent content) {
Intrinsics.checkNotNullParameter(content, "content");
AppCall createBaseAppCall = this.this$0.createBaseAppCall();
Bundle bundle = new Bundle();
bundle.putString("player_id", content.getSuggestedPlayerID());
AccessToken currentAccessToken = AccessToken.Companion.getCurrentAccessToken();
if (currentAccessToken != null) {
bundle.putString("dialog_access_token", currentAccessToken.getToken());
}
DialogPresenter.setupAppCallForWebDialog(createBaseAppCall, "context", bundle);
return createBaseAppCall;
}
}
public final class FacebookAppHandler extends FacebookDialogBase<ContextCreateContent, Result>.ModeHandler {
final /* synthetic */ ContextCreateDialog this$0;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public FacebookAppHandler(ContextCreateDialog this$0) {
super(this$0);
Intrinsics.checkNotNullParameter(this$0, "this$0");
this.this$0 = this$0;
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public boolean canShow(ContextCreateContent content, boolean z) {
Intrinsics.checkNotNullParameter(content, "content");
Activity activityContext = this.this$0.getActivityContext();
PackageManager packageManager = activityContext == null ? null : activityContext.getPackageManager();
Intent intent = new Intent("com.facebook.games.gaming_services.DEEPLINK");
intent.setType("text/plain");
boolean z2 = (packageManager == null ? null : intent.resolveActivity(packageManager)) != null;
AccessToken currentAccessToken = AccessToken.Companion.getCurrentAccessToken();
return z2 && ((currentAccessToken != null ? currentAccessToken.getGraphDomain() : null) != null && Intrinsics.areEqual(FacebookSdk.GAMING, currentAccessToken.getGraphDomain()));
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public AppCall createAppCall(ContextCreateContent content) {
Intrinsics.checkNotNullParameter(content, "content");
AppCall createBaseAppCall = this.this$0.createBaseAppCall();
Intent intent = new Intent("com.facebook.games.gaming_services.DEEPLINK");
intent.setType("text/plain");
AccessToken currentAccessToken = AccessToken.Companion.getCurrentAccessToken();
Bundle bundle = new Bundle();
bundle.putString(SDKConstants.PARAM_TOURNAMENTS_DEEPLINK, "CONTEXT_CREATE");
if (currentAccessToken != null) {
bundle.putString("game_id", currentAccessToken.getApplicationId());
} else {
bundle.putString("game_id", FacebookSdk.getApplicationId());
}
if (content.getSuggestedPlayerID() != null) {
bundle.putString("player_id", content.getSuggestedPlayerID());
}
NativeProtocol nativeProtocol = NativeProtocol.INSTANCE;
NativeProtocol.setupProtocolRequestIntent(intent, createBaseAppCall.getCallId().toString(), "", NativeProtocol.getLatestKnownVersion(), bundle);
createBaseAppCall.setRequestIntent(intent);
return createBaseAppCall;
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}

View File

@@ -0,0 +1,319 @@
package com.facebook.gamingservices;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import com.facebook.AccessToken;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.FacebookRequestError;
import com.facebook.FacebookSdk;
import com.facebook.GraphResponse;
import com.facebook.gamingservices.ContextSwitchDialog;
import com.facebook.gamingservices.cloudgaming.CloudGameLoginHandler;
import com.facebook.gamingservices.cloudgaming.DaemonRequest;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.gamingservices.cloudgaming.internal.SDKMessageEnum;
import com.facebook.gamingservices.model.ContextSwitchContent;
import com.facebook.internal.AppCall;
import com.facebook.internal.CallbackManagerImpl;
import com.facebook.internal.DialogPresenter;
import com.facebook.internal.FacebookDialogBase;
import com.facebook.internal.FragmentWrapper;
import com.facebook.internal.NativeProtocol;
import com.facebook.share.internal.ResultProcessor;
import com.facebook.share.internal.ShareInternalUtility;
import java.util.List;
import kotlin.Unit;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class ContextSwitchDialog extends FacebookDialogBase<ContextSwitchContent, Result> {
public static final Companion Companion = new Companion(null);
private static final int DEFAULT_REQUEST_CODE = CallbackManagerImpl.RequestCodeOffset.GamingContextSwitch.toRequestCode();
private FacebookCallback<Result> callback;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public ContextSwitchDialog(Activity activity) {
super(activity, DEFAULT_REQUEST_CODE);
Intrinsics.checkNotNullParameter(activity, "activity");
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public ContextSwitchDialog(Fragment fragment) {
this(new FragmentWrapper(fragment));
Intrinsics.checkNotNullParameter(fragment, "fragment");
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public ContextSwitchDialog(android.app.Fragment fragment) {
this(new FragmentWrapper(fragment));
Intrinsics.checkNotNullParameter(fragment, "fragment");
}
private ContextSwitchDialog(FragmentWrapper fragmentWrapper) {
super(fragmentWrapper, DEFAULT_REQUEST_CODE);
}
@Override // com.facebook.internal.FacebookDialogBase, com.facebook.FacebookDialog
public boolean canShow(ContextSwitchContent content) {
Intrinsics.checkNotNullParameter(content, "content");
return CloudGameLoginHandler.isRunningInCloud() || new FacebookAppHandler(this).canShow(content, true) || new WebHandler(this).canShow(content, true);
}
@Override // com.facebook.internal.FacebookDialogBase
public void showImpl(ContextSwitchContent content, Object mode) {
Intrinsics.checkNotNullParameter(content, "content");
Intrinsics.checkNotNullParameter(mode, "mode");
if (CloudGameLoginHandler.isRunningInCloud()) {
showForCloud(content);
} else {
super.showImpl((ContextSwitchDialog) content, mode);
}
}
private final void showForCloud(ContextSwitchContent contextSwitchContent) {
AccessToken currentAccessToken = AccessToken.Companion.getCurrentAccessToken();
if (currentAccessToken == null || currentAccessToken.isExpired()) {
throw new FacebookException("Attempted to open ContextSwitchContent with an invalid access token");
}
DaemonRequest.Callback callback = new DaemonRequest.Callback() { // from class: com.facebook.gamingservices.ContextSwitchDialog$$ExternalSyntheticLambda1
@Override // com.facebook.gamingservices.cloudgaming.DaemonRequest.Callback
public final void onCompleted(GraphResponse graphResponse) {
ContextSwitchDialog.m549showForCloud$lambda2(ContextSwitchDialog.this, graphResponse);
}
};
String contextID = contextSwitchContent.getContextID();
if (contextID == null) {
FacebookCallback<Result> facebookCallback = this.callback;
if (facebookCallback == null) {
return;
}
facebookCallback.onError(new FacebookException("Required string contextID not provided."));
return;
}
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("id", contextID);
DaemonRequest.executeAsync(getActivityContext(), jSONObject, callback, SDKMessageEnum.CONTEXT_SWITCH);
} catch (JSONException unused) {
FacebookCallback<Result> facebookCallback2 = this.callback;
if (facebookCallback2 == null) {
return;
}
facebookCallback2.onError(new FacebookException("Couldn't prepare Context Switch Dialog"));
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: showForCloud$lambda-2, reason: not valid java name */
public static final void m549showForCloud$lambda2(ContextSwitchDialog this$0, GraphResponse response) {
Unit unit;
Intrinsics.checkNotNullParameter(this$0, "this$0");
FacebookCallback<Result> facebookCallback = this$0.callback;
if (facebookCallback == null) {
return;
}
FacebookRequestError error = response.getError();
if (error == null) {
unit = null;
} else {
facebookCallback.onError(new FacebookException(error.getErrorMessage()));
unit = Unit.INSTANCE;
}
if (unit == null) {
Intrinsics.checkNotNullExpressionValue(response, "response");
facebookCallback.onSuccess(new Result(response));
}
}
@Override // com.facebook.internal.FacebookDialogBase
public void registerCallbackImpl(CallbackManagerImpl callbackManager, final FacebookCallback<Result> callback) {
Intrinsics.checkNotNullParameter(callbackManager, "callbackManager");
Intrinsics.checkNotNullParameter(callback, "callback");
this.callback = callback;
final ResultProcessor resultProcessor = new ResultProcessor(callback) { // from class: com.facebook.gamingservices.ContextSwitchDialog$registerCallbackImpl$resultProcessor$1
final /* synthetic */ FacebookCallback<ContextSwitchDialog.Result> $callback;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(callback);
this.$callback = callback;
}
@Override // com.facebook.share.internal.ResultProcessor
public void onSuccess(AppCall appCall, Bundle bundle) {
Intrinsics.checkNotNullParameter(appCall, "appCall");
if (bundle != null) {
if (bundle.getString("error_message") != null) {
this.$callback.onError(new FacebookException(bundle.getString("error_message")));
return;
}
String string = bundle.getString("id");
String string2 = bundle.getString(SDKConstants.PARAM_CONTEXT_CONTEXT_ID);
if (string != null) {
GamingContext.Companion.setCurrentGamingContext(new GamingContext(string));
this.$callback.onSuccess(new ContextSwitchDialog.Result(string));
} else if (string2 != null) {
GamingContext.Companion.setCurrentGamingContext(new GamingContext(string2));
this.$callback.onSuccess(new ContextSwitchDialog.Result(string2));
}
this.$callback.onError(new FacebookException(bundle.getString("Invalid response received from server.")));
return;
}
onCancel(appCall);
}
};
callbackManager.registerCallback(getRequestCode(), new CallbackManagerImpl.Callback() { // from class: com.facebook.gamingservices.ContextSwitchDialog$$ExternalSyntheticLambda0
@Override // com.facebook.internal.CallbackManagerImpl.Callback
public final boolean onActivityResult(int i, Intent intent) {
boolean m548registerCallbackImpl$lambda3;
m548registerCallbackImpl$lambda3 = ContextSwitchDialog.m548registerCallbackImpl$lambda3(ContextSwitchDialog.this, resultProcessor, i, intent);
return m548registerCallbackImpl$lambda3;
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: registerCallbackImpl$lambda-3, reason: not valid java name */
public static final boolean m548registerCallbackImpl$lambda3(ContextSwitchDialog this$0, ResultProcessor resultProcessor, int i, Intent intent) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(resultProcessor, "$resultProcessor");
ShareInternalUtility shareInternalUtility = ShareInternalUtility.INSTANCE;
return ShareInternalUtility.handleActivityResult(this$0.getRequestCode(), i, intent, resultProcessor);
}
@Override // com.facebook.internal.FacebookDialogBase
public List<FacebookDialogBase<ContextSwitchContent, Result>.ModeHandler> getOrderedModeHandlers() {
List<FacebookDialogBase<ContextSwitchContent, Result>.ModeHandler> listOf;
listOf = CollectionsKt__CollectionsKt.listOf((Object[]) new FacebookDialogBase.ModeHandler[]{new FacebookAppHandler(this), new WebHandler(this)});
return listOf;
}
@Override // com.facebook.internal.FacebookDialogBase
public AppCall createBaseAppCall() {
return new AppCall(getRequestCode(), null, 2, null);
}
public static final class Result {
private String contextID;
public final String getContextID() {
return this.contextID;
}
public final void setContextID(String str) {
this.contextID = str;
}
public Result(String contextID) {
Intrinsics.checkNotNullParameter(contextID, "contextID");
this.contextID = contextID;
}
public Result(GraphResponse response) {
JSONObject optJSONObject;
Intrinsics.checkNotNullParameter(response, "response");
try {
JSONObject jSONObject = response.getJSONObject();
if (jSONObject != null && (optJSONObject = jSONObject.optJSONObject("data")) != null) {
setContextID(optJSONObject.getString("id"));
}
} catch (JSONException unused) {
this.contextID = null;
}
}
}
public final class WebHandler extends FacebookDialogBase<ContextSwitchContent, Result>.ModeHandler {
final /* synthetic */ ContextSwitchDialog this$0;
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public boolean canShow(ContextSwitchContent content, boolean z) {
Intrinsics.checkNotNullParameter(content, "content");
return true;
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public WebHandler(ContextSwitchDialog this$0) {
super(this$0);
Intrinsics.checkNotNullParameter(this$0, "this$0");
this.this$0 = this$0;
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public AppCall createAppCall(ContextSwitchContent content) {
Intrinsics.checkNotNullParameter(content, "content");
AppCall createBaseAppCall = this.this$0.createBaseAppCall();
Bundle bundle = new Bundle();
bundle.putString(SDKConstants.PARAM_CONTEXT_CONTEXT_ID, content.getContextID());
AccessToken currentAccessToken = AccessToken.Companion.getCurrentAccessToken();
if (currentAccessToken != null) {
bundle.putString("dialog_access_token", currentAccessToken.getToken());
}
DialogPresenter.setupAppCallForWebDialog(createBaseAppCall, "context", bundle);
return createBaseAppCall;
}
}
public final class FacebookAppHandler extends FacebookDialogBase<ContextSwitchContent, Result>.ModeHandler {
final /* synthetic */ ContextSwitchDialog this$0;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public FacebookAppHandler(ContextSwitchDialog this$0) {
super(this$0);
Intrinsics.checkNotNullParameter(this$0, "this$0");
this.this$0 = this$0;
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public boolean canShow(ContextSwitchContent content, boolean z) {
Intrinsics.checkNotNullParameter(content, "content");
Activity activityContext = this.this$0.getActivityContext();
PackageManager packageManager = activityContext == null ? null : activityContext.getPackageManager();
Intent intent = new Intent("com.facebook.games.gaming_services.DEEPLINK");
intent.setType("text/plain");
boolean z2 = (packageManager == null ? null : intent.resolveActivity(packageManager)) != null;
AccessToken currentAccessToken = AccessToken.Companion.getCurrentAccessToken();
return z2 && ((currentAccessToken != null ? currentAccessToken.getGraphDomain() : null) != null && Intrinsics.areEqual(FacebookSdk.GAMING, currentAccessToken.getGraphDomain()));
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public AppCall createAppCall(ContextSwitchContent content) {
Intrinsics.checkNotNullParameter(content, "content");
AppCall createBaseAppCall = this.this$0.createBaseAppCall();
Intent intent = new Intent("com.facebook.games.gaming_services.DEEPLINK");
intent.setType("text/plain");
AccessToken currentAccessToken = AccessToken.Companion.getCurrentAccessToken();
Bundle bundle = new Bundle();
bundle.putString(SDKConstants.PARAM_TOURNAMENTS_DEEPLINK, "CONTEXT_SWITCH");
if (currentAccessToken != null) {
bundle.putString("game_id", currentAccessToken.getApplicationId());
} else {
bundle.putString("game_id", FacebookSdk.getApplicationId());
}
if (content.getContextID() != null) {
bundle.putString("context_token_id", content.getContextID());
}
NativeProtocol nativeProtocol = NativeProtocol.INSTANCE;
NativeProtocol.setupProtocolRequestIntent(intent, createBaseAppCall.getCallId().toString(), "", NativeProtocol.getLatestKnownVersion(), bundle);
createBaseAppCall.setRequestIntent(intent);
return createBaseAppCall;
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}

View File

@@ -0,0 +1,19 @@
package com.facebook.gamingservices;
import com.facebook.AccessToken;
import com.facebook.GraphRequest;
import com.facebook.gamingservices.model.CustomUpdateContent;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class CustomUpdate {
public static final CustomUpdate INSTANCE = new CustomUpdate();
private CustomUpdate() {
}
public static final GraphRequest newCustomUpdateRequest(CustomUpdateContent content, GraphRequest.Callback callback) {
Intrinsics.checkNotNullParameter(content, "content");
return GraphRequest.Companion.newPostRequest(AccessToken.Companion.getCurrentAccessToken(), "me/custom_update", content.toGraphRequestContent(), callback);
}
}

View File

@@ -0,0 +1,118 @@
package com.facebook.gamingservices;
import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
import android.net.Uri;
import com.facebook.AccessToken;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.FacebookRequestError;
import com.facebook.GraphResponse;
import com.facebook.gamingservices.cloudgaming.CloudGameLoginHandler;
import com.facebook.gamingservices.cloudgaming.DaemonRequest;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.gamingservices.cloudgaming.internal.SDKMessageEnum;
import com.facebook.internal.AppCall;
import com.facebook.internal.CallbackManagerImpl;
import com.facebook.internal.FacebookDialogBase;
import com.facebook.internal.FragmentWrapper;
import com.facebook.internal.instrument.crashshield.AutoHandleExceptions;
import java.util.List;
import org.json.JSONException;
import org.json.JSONObject;
@AutoHandleExceptions
/* loaded from: classes2.dex */
public class FriendFinderDialog extends FacebookDialogBase<Void, Result> {
private static final int DEFAULT_REQUEST_CODE = CallbackManagerImpl.RequestCodeOffset.GamingFriendFinder.toRequestCode();
private FacebookCallback mCallback;
public static class Result {
}
@Override // com.facebook.internal.FacebookDialogBase
public AppCall createBaseAppCall() {
return null;
}
@Override // com.facebook.internal.FacebookDialogBase
public List<FacebookDialogBase<Void, Result>.ModeHandler> getOrderedModeHandlers() {
return null;
}
public FriendFinderDialog(Activity activity) {
super(activity, DEFAULT_REQUEST_CODE);
}
public FriendFinderDialog(Fragment fragment) {
super(new FragmentWrapper(fragment), DEFAULT_REQUEST_CODE);
}
public FriendFinderDialog(androidx.fragment.app.Fragment fragment) {
super(new FragmentWrapper(fragment), DEFAULT_REQUEST_CODE);
}
public void show() {
showImpl();
}
@Override // com.facebook.internal.FacebookDialogBase, com.facebook.FacebookDialog
public void show(Void r1) {
showImpl();
}
public void showImpl() {
AccessToken currentAccessToken = AccessToken.getCurrentAccessToken();
if (currentAccessToken == null || currentAccessToken.isExpired()) {
throw new FacebookException("Attempted to open GamingServices FriendFinder with an invalid access token");
}
String applicationId = currentAccessToken.getApplicationId();
if (CloudGameLoginHandler.isRunningInCloud()) {
Activity activityContext = getActivityContext();
DaemonRequest.Callback callback = new DaemonRequest.Callback() { // from class: com.facebook.gamingservices.FriendFinderDialog.1
@Override // com.facebook.gamingservices.cloudgaming.DaemonRequest.Callback
public void onCompleted(GraphResponse graphResponse) {
if (FriendFinderDialog.this.mCallback != null) {
if (graphResponse.getError() != null) {
FriendFinderDialog.this.mCallback.onError(new FacebookException(graphResponse.getError().getErrorMessage()));
} else {
FriendFinderDialog.this.mCallback.onSuccess(new Result());
}
}
}
};
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("id", applicationId);
jSONObject.put(SDKConstants.PARAM_DEEP_LINK, "FRIEND_FINDER");
DaemonRequest.executeAsync(activityContext, jSONObject, callback, SDKMessageEnum.OPEN_GAMING_SERVICES_DEEP_LINK);
return;
} catch (JSONException unused) {
FacebookCallback facebookCallback = this.mCallback;
if (facebookCallback != null) {
facebookCallback.onError(new FacebookException("Couldn't prepare Friend Finder Dialog"));
return;
}
return;
}
}
startActivityForResult(new Intent("android.intent.action.VIEW", Uri.parse("https://fb.gg/me/friendfinder/" + applicationId)), getRequestCode());
}
@Override // com.facebook.internal.FacebookDialogBase
public void registerCallbackImpl(CallbackManagerImpl callbackManagerImpl, final FacebookCallback<Result> facebookCallback) {
this.mCallback = facebookCallback;
callbackManagerImpl.registerCallback(getRequestCode(), new CallbackManagerImpl.Callback() { // from class: com.facebook.gamingservices.FriendFinderDialog.2
@Override // com.facebook.internal.CallbackManagerImpl.Callback
public boolean onActivityResult(int i, Intent intent) {
if (intent != null && intent.hasExtra("error")) {
facebookCallback.onError(((FacebookRequestError) intent.getParcelableExtra("error")).getException());
return true;
}
facebookCallback.onSuccess(new Result());
return true;
}
});
}
}

View File

@@ -0,0 +1,303 @@
package com.facebook.gamingservices;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import com.facebook.AccessToken;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.GraphResponse;
import com.facebook.gamingservices.cloudgaming.CloudGameLoginHandler;
import com.facebook.gamingservices.cloudgaming.DaemonRequest;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.gamingservices.cloudgaming.internal.SDKMessageEnum;
import com.facebook.internal.AppCall;
import com.facebook.internal.CallbackManagerImpl;
import com.facebook.internal.CustomTabUtils;
import com.facebook.internal.DialogPresenter;
import com.facebook.internal.FacebookDialogBase;
import com.facebook.internal.FragmentWrapper;
import com.facebook.internal.NativeProtocol;
import com.facebook.internal.ServerProtocol;
import com.facebook.internal.Validate;
import com.facebook.share.internal.GameRequestValidation;
import com.facebook.share.internal.ResultProcessor;
import com.facebook.share.internal.ShareConstants;
import com.facebook.share.internal.ShareInternalUtility;
import com.facebook.share.internal.WebDialogParameters;
import com.facebook.share.model.GameRequestContent;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class GameRequestDialog extends FacebookDialogBase<GameRequestContent, Result> {
private static final int DEFAULT_REQUEST_CODE = CallbackManagerImpl.RequestCodeOffset.GameRequest.toRequestCode();
private static final String GAME_REQUEST_DIALOG = "apprequests";
private FacebookCallback mCallback;
public static boolean canShow() {
return true;
}
public static final class Result {
String requestId;
List<String> to;
public String getRequestId() {
return this.requestId;
}
public List<String> getRequestRecipients() {
return this.to;
}
private Result(Bundle bundle) {
this.requestId = bundle.getString("request");
this.to = new ArrayList();
while (bundle.containsKey(String.format(ShareConstants.WEB_DIALOG_RESULT_PARAM_TO_ARRAY_MEMBER, Integer.valueOf(this.to.size())))) {
List<String> list = this.to;
list.add(bundle.getString(String.format(ShareConstants.WEB_DIALOG_RESULT_PARAM_TO_ARRAY_MEMBER, Integer.valueOf(list.size()))));
}
}
private Result(GraphResponse graphResponse) {
try {
JSONObject jSONObject = graphResponse.getJSONObject();
JSONObject optJSONObject = jSONObject.optJSONObject("data");
jSONObject = optJSONObject != null ? optJSONObject : jSONObject;
this.requestId = jSONObject.getString("request_id");
this.to = new ArrayList();
JSONArray jSONArray = jSONObject.getJSONArray("to");
for (int i = 0; i < jSONArray.length(); i++) {
this.to.add(jSONArray.getString(i));
}
} catch (JSONException unused) {
this.requestId = null;
this.to = new ArrayList();
}
}
}
public static void show(Activity activity, GameRequestContent gameRequestContent) {
new GameRequestDialog(activity).show(gameRequestContent);
}
public static void show(Fragment fragment, GameRequestContent gameRequestContent) {
show(new FragmentWrapper(fragment), gameRequestContent);
}
public static void show(android.app.Fragment fragment, GameRequestContent gameRequestContent) {
show(new FragmentWrapper(fragment), gameRequestContent);
}
private static void show(FragmentWrapper fragmentWrapper, GameRequestContent gameRequestContent) {
new GameRequestDialog(fragmentWrapper).show(gameRequestContent);
}
public GameRequestDialog(Activity activity) {
super(activity, DEFAULT_REQUEST_CODE);
}
public GameRequestDialog(Fragment fragment) {
this(new FragmentWrapper(fragment));
}
public GameRequestDialog(android.app.Fragment fragment) {
this(new FragmentWrapper(fragment));
}
private GameRequestDialog(FragmentWrapper fragmentWrapper) {
super(fragmentWrapper, DEFAULT_REQUEST_CODE);
}
@Override // com.facebook.internal.FacebookDialogBase
public void registerCallbackImpl(CallbackManagerImpl callbackManagerImpl, final FacebookCallback<Result> facebookCallback) {
this.mCallback = facebookCallback;
final ResultProcessor resultProcessor = facebookCallback == null ? null : new ResultProcessor(facebookCallback) { // from class: com.facebook.gamingservices.GameRequestDialog.1
@Override // com.facebook.share.internal.ResultProcessor
public void onSuccess(AppCall appCall, Bundle bundle) {
if (bundle != null) {
facebookCallback.onSuccess(new Result(bundle));
} else {
onCancel(appCall);
}
}
};
callbackManagerImpl.registerCallback(getRequestCode(), new CallbackManagerImpl.Callback() { // from class: com.facebook.gamingservices.GameRequestDialog.2
@Override // com.facebook.internal.CallbackManagerImpl.Callback
public boolean onActivityResult(int i, Intent intent) {
return ShareInternalUtility.handleActivityResult(GameRequestDialog.this.getRequestCode(), i, intent, resultProcessor);
}
});
}
@Override // com.facebook.internal.FacebookDialogBase
public AppCall createBaseAppCall() {
return new AppCall(getRequestCode());
}
@Override // com.facebook.internal.FacebookDialogBase
public List<FacebookDialogBase<GameRequestContent, Result>.ModeHandler> getOrderedModeHandlers() {
ArrayList arrayList = new ArrayList();
arrayList.add(new FacebookAppHandler());
arrayList.add(new ChromeCustomTabHandler());
arrayList.add(new WebHandler());
return arrayList;
}
@Override // com.facebook.internal.FacebookDialogBase
public void showImpl(GameRequestContent gameRequestContent, Object obj) {
if (CloudGameLoginHandler.isRunningInCloud()) {
showForCloud(gameRequestContent, obj);
} else {
super.showImpl((GameRequestDialog) gameRequestContent, obj);
}
}
private void showForCloud(GameRequestContent gameRequestContent, Object obj) {
Activity activityContext = getActivityContext();
AccessToken currentAccessToken = AccessToken.getCurrentAccessToken();
if (currentAccessToken == null || currentAccessToken.isExpired()) {
throw new FacebookException("Attempted to open GameRequestDialog with an invalid access token");
}
DaemonRequest.Callback callback = new DaemonRequest.Callback() { // from class: com.facebook.gamingservices.GameRequestDialog.3
@Override // com.facebook.gamingservices.cloudgaming.DaemonRequest.Callback
public void onCompleted(GraphResponse graphResponse) {
if (GameRequestDialog.this.mCallback != null) {
if (graphResponse.getError() != null) {
GameRequestDialog.this.mCallback.onError(new FacebookException(graphResponse.getError().getErrorMessage()));
} else {
GameRequestDialog.this.mCallback.onSuccess(new Result(graphResponse));
}
}
}
};
String applicationId = currentAccessToken.getApplicationId();
String name = gameRequestContent.getActionType() != null ? gameRequestContent.getActionType().name() : null;
JSONObject jSONObject = new JSONObject();
JSONArray jSONArray = new JSONArray();
try {
jSONObject.put("appID", applicationId);
jSONObject.put(SDKConstants.PARAM_GAME_REQUESTS_ACTION_TYPE, name);
jSONObject.put("message", gameRequestContent.getMessage());
jSONObject.put("cta", gameRequestContent.getCta());
jSONObject.put("title", gameRequestContent.getTitle());
jSONObject.put("data", gameRequestContent.getData());
jSONObject.put(SDKConstants.PARAM_GAME_REQUESTS_OPTIONS, gameRequestContent.getFilters());
if (gameRequestContent.getRecipients() != null) {
Iterator<String> it = gameRequestContent.getRecipients().iterator();
while (it.hasNext()) {
jSONArray.put(it.next());
}
}
jSONObject.put("to", jSONArray);
DaemonRequest.executeAsync(activityContext, jSONObject, callback, SDKMessageEnum.OPEN_GAME_REQUESTS_DIALOG);
} catch (JSONException unused) {
FacebookCallback facebookCallback = this.mCallback;
if (facebookCallback != null) {
facebookCallback.onError(new FacebookException("Couldn't prepare Game Request Dialog"));
}
}
}
public class ChromeCustomTabHandler extends FacebookDialogBase<GameRequestContent, Result>.ModeHandler {
private ChromeCustomTabHandler() {
super(GameRequestDialog.this);
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public boolean canShow(GameRequestContent gameRequestContent, boolean z) {
return CustomTabUtils.getChromePackage() != null && Validate.hasCustomTabRedirectActivity(GameRequestDialog.this.getActivityContext(), CustomTabUtils.getDefaultRedirectURI());
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public AppCall createAppCall(GameRequestContent gameRequestContent) {
GameRequestValidation.validate(gameRequestContent);
AppCall createBaseAppCall = GameRequestDialog.this.createBaseAppCall();
Bundle create = WebDialogParameters.create(gameRequestContent);
AccessToken currentAccessToken = AccessToken.getCurrentAccessToken();
if (currentAccessToken != null) {
create.putString("app_id", currentAccessToken.getApplicationId());
} else {
create.putString("app_id", FacebookSdk.getApplicationId());
}
create.putString(ServerProtocol.DIALOG_PARAM_REDIRECT_URI, CustomTabUtils.getDefaultRedirectURI());
DialogPresenter.setupAppCallForCustomTabDialog(createBaseAppCall, GameRequestDialog.GAME_REQUEST_DIALOG, create);
return createBaseAppCall;
}
}
public class WebHandler extends FacebookDialogBase<GameRequestContent, Result>.ModeHandler {
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public boolean canShow(GameRequestContent gameRequestContent, boolean z) {
return true;
}
private WebHandler() {
super(GameRequestDialog.this);
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public AppCall createAppCall(GameRequestContent gameRequestContent) {
GameRequestValidation.validate(gameRequestContent);
AppCall createBaseAppCall = GameRequestDialog.this.createBaseAppCall();
DialogPresenter.setupAppCallForWebDialog(createBaseAppCall, GameRequestDialog.GAME_REQUEST_DIALOG, WebDialogParameters.create(gameRequestContent));
return createBaseAppCall;
}
}
public class FacebookAppHandler extends FacebookDialogBase<GameRequestContent, Result>.ModeHandler {
private FacebookAppHandler() {
super(GameRequestDialog.this);
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public boolean canShow(GameRequestContent gameRequestContent, boolean z) {
PackageManager packageManager = GameRequestDialog.this.getActivityContext().getPackageManager();
Intent intent = new Intent("com.facebook.games.gaming_services.DEEPLINK");
intent.setType("text/plain");
boolean z2 = intent.resolveActivity(packageManager) != null;
AccessToken currentAccessToken = AccessToken.getCurrentAccessToken();
return z2 && (currentAccessToken != null && currentAccessToken.getGraphDomain() != null && FacebookSdk.GAMING.equals(currentAccessToken.getGraphDomain()));
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public AppCall createAppCall(GameRequestContent gameRequestContent) {
AppCall createBaseAppCall = GameRequestDialog.this.createBaseAppCall();
Intent intent = new Intent("com.facebook.games.gaming_services.DEEPLINK");
intent.setType("text/plain");
AccessToken currentAccessToken = AccessToken.getCurrentAccessToken();
Bundle bundle = new Bundle();
bundle.putString(SDKConstants.PARAM_TOURNAMENTS_DEEPLINK, "GAME_REQUESTS");
if (currentAccessToken != null) {
bundle.putString("app_id", currentAccessToken.getApplicationId());
} else {
bundle.putString("app_id", FacebookSdk.getApplicationId());
}
bundle.putString(SDKConstants.PARAM_GAME_REQUESTS_ACTION_TYPE, gameRequestContent.getActionType() != null ? gameRequestContent.getActionType().name() : null);
bundle.putString("message", gameRequestContent.getMessage());
bundle.putString("title", gameRequestContent.getTitle());
bundle.putString("data", gameRequestContent.getData());
bundle.putString("cta", gameRequestContent.getCta());
gameRequestContent.getRecipients();
JSONArray jSONArray = new JSONArray();
if (gameRequestContent.getRecipients() != null) {
Iterator<String> it = gameRequestContent.getRecipients().iterator();
while (it.hasNext()) {
jSONArray.put(it.next());
}
}
bundle.putString("to", jSONArray.toString());
NativeProtocol.setupProtocolRequestIntent(intent, createBaseAppCall.getCallId().toString(), "", NativeProtocol.getLatestKnownVersion(), bundle);
createBaseAppCall.setRequestIntent(intent);
return createBaseAppCall;
}
}
}

View File

@@ -0,0 +1,96 @@
package com.facebook.gamingservices;
import com.facebook.FacebookSdk;
import com.facebook.GraphResponse;
import com.facebook.gamingservices.cloudgaming.CloudGameLoginHandler;
import com.facebook.gamingservices.cloudgaming.DaemonRequest;
import com.facebook.gamingservices.cloudgaming.internal.SDKMessageEnum;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class GamingContext {
public static final Companion Companion = new Companion(null);
private static final int DEFAULT_TIMEOUT = 5;
private static GamingContext currentContext;
private final String contextID;
public static /* synthetic */ GamingContext copy$default(GamingContext gamingContext, String str, int i, Object obj) {
if ((i & 1) != 0) {
str = gamingContext.contextID;
}
return gamingContext.copy(str);
}
public static final GamingContext getCurrentGamingContext() {
return Companion.getCurrentGamingContext();
}
public static final void setCurrentGamingContext(GamingContext gamingContext) {
Companion.setCurrentGamingContext(gamingContext);
}
public final String component1() {
return this.contextID;
}
public final GamingContext copy(String contextID) {
Intrinsics.checkNotNullParameter(contextID, "contextID");
return new GamingContext(contextID);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
return (obj instanceof GamingContext) && Intrinsics.areEqual(this.contextID, ((GamingContext) obj).contextID);
}
public final String getContextID() {
return this.contextID;
}
public int hashCode() {
return this.contextID.hashCode();
}
public String toString() {
return "GamingContext(contextID=" + this.contextID + ')';
}
public GamingContext(String contextID) {
Intrinsics.checkNotNullParameter(contextID, "contextID");
this.contextID = contextID;
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final GamingContext getCurrentGamingContext() {
JSONObject jSONObject;
if (CloudGameLoginHandler.isRunningInCloud()) {
GraphResponse executeAndWait = DaemonRequest.executeAndWait(FacebookSdk.getApplicationContext(), null, SDKMessageEnum.CONTEXT_GET_ID, 5);
String string = (executeAndWait == null || (jSONObject = executeAndWait.getJSONObject()) == null) ? null : jSONObject.getString("id");
if (string == null) {
return null;
}
return new GamingContext(string);
}
return GamingContext.currentContext;
}
public final void setCurrentGamingContext(GamingContext ctx) {
Intrinsics.checkNotNullParameter(ctx, "ctx");
if (CloudGameLoginHandler.isRunningInCloud()) {
return;
}
GamingContext.currentContext = ctx;
}
}
}

View File

@@ -0,0 +1,75 @@
package com.facebook.gamingservices;
import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
import android.net.Uri;
import com.facebook.FacebookCallback;
import com.facebook.FacebookRequestError;
import com.facebook.FacebookSdk;
import com.facebook.internal.AppCall;
import com.facebook.internal.CallbackManagerImpl;
import com.facebook.internal.FacebookDialogBase;
import com.facebook.internal.FragmentWrapper;
import com.facebook.internal.instrument.crashshield.AutoHandleExceptions;
import java.util.List;
@AutoHandleExceptions
/* loaded from: classes2.dex */
public class GamingGroupIntegration extends FacebookDialogBase<Void, Result> {
private static final int DEFAULT_REQUEST_CODE = CallbackManagerImpl.RequestCodeOffset.GamingGroupIntegration.toRequestCode();
private static final String ERROR_KEY = "error";
public static class Result {
}
@Override // com.facebook.internal.FacebookDialogBase
public AppCall createBaseAppCall() {
return null;
}
@Override // com.facebook.internal.FacebookDialogBase
public List<FacebookDialogBase<Void, Result>.ModeHandler> getOrderedModeHandlers() {
return null;
}
public GamingGroupIntegration(Activity activity) {
super(activity, DEFAULT_REQUEST_CODE);
}
public GamingGroupIntegration(Fragment fragment) {
super(new FragmentWrapper(fragment), DEFAULT_REQUEST_CODE);
}
public GamingGroupIntegration(androidx.fragment.app.Fragment fragment) {
super(new FragmentWrapper(fragment), DEFAULT_REQUEST_CODE);
}
public void show() {
showImpl();
}
@Override // com.facebook.internal.FacebookDialogBase, com.facebook.FacebookDialog
public void show(Void r1) {
showImpl();
}
public void showImpl() {
startActivityForResult(new Intent("android.intent.action.VIEW", Uri.parse("https://fb.gg/me/community/" + FacebookSdk.getApplicationId())), getRequestCode());
}
@Override // com.facebook.internal.FacebookDialogBase
public void registerCallbackImpl(CallbackManagerImpl callbackManagerImpl, final FacebookCallback<Result> facebookCallback) {
callbackManagerImpl.registerCallback(getRequestCode(), new CallbackManagerImpl.Callback() { // from class: com.facebook.gamingservices.GamingGroupIntegration.1
@Override // com.facebook.internal.CallbackManagerImpl.Callback
public boolean onActivityResult(int i, Intent intent) {
if (intent != null && intent.hasExtra("error")) {
facebookCallback.onError(((FacebookRequestError) intent.getParcelableExtra("error")).getException());
return true;
}
facebookCallback.onSuccess(new Result());
return true;
}
});
}
}

View File

@@ -0,0 +1,44 @@
package com.facebook.gamingservices;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import com.facebook.AccessToken;
import com.facebook.GraphRequest;
import java.io.File;
import java.io.FileNotFoundException;
/* loaded from: classes2.dex */
public class GamingImageUploader {
private static final String photoUploadEdge = "me/photos";
private Context context;
public GamingImageUploader(Context context) {
this.context = context;
}
public void uploadToMediaLibrary(String str, Bitmap bitmap, boolean z) {
uploadToMediaLibrary(str, bitmap, z, (GraphRequest.Callback) null);
}
public void uploadToMediaLibrary(String str, Bitmap bitmap, boolean z, GraphRequest.Callback callback) {
GraphRequest.newUploadPhotoRequest(AccessToken.getCurrentAccessToken(), photoUploadEdge, bitmap, str, (Bundle) null, z ? new OpenGamingMediaDialog(this.context, callback) : callback).executeAsync();
}
public void uploadToMediaLibrary(String str, File file, boolean z) throws FileNotFoundException {
uploadToMediaLibrary(str, file, z, (GraphRequest.Callback) null);
}
public void uploadToMediaLibrary(String str, File file, boolean z, GraphRequest.Callback callback) throws FileNotFoundException {
GraphRequest.newUploadPhotoRequest(AccessToken.getCurrentAccessToken(), photoUploadEdge, file, str, (Bundle) null, z ? new OpenGamingMediaDialog(this.context, callback) : callback).executeAsync();
}
public void uploadToMediaLibrary(String str, Uri uri, boolean z) throws FileNotFoundException {
uploadToMediaLibrary(str, uri, z, (GraphRequest.Callback) null);
}
public void uploadToMediaLibrary(String str, Uri uri, boolean z, GraphRequest.Callback callback) throws FileNotFoundException {
GraphRequest.newUploadPhotoRequest(AccessToken.getCurrentAccessToken(), photoUploadEdge, uri, str, (Bundle) null, z ? new OpenGamingMediaDialog(this.context, callback) : callback).executeAsync();
}
}

View File

@@ -0,0 +1,85 @@
package com.facebook.gamingservices;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import androidx.annotation.Nullable;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class GamingPayload {
private static final String KEY_APPLINK_DATA = "al_applink_data";
private static final String KEY_CONTEXT_TOKEN_ID = "context_token_id";
private static final String KEY_EXTRAS = "extras";
private static final String KEY_GAME_REQUEST_ID = "game_request_id";
private static final String KEY_PAYLOAD = "payload";
private static final String KEY_TOURNAMENT_ID = "tournament_id";
private static final String TAG = "GamingPayload";
private static Map<String, String> payloadData;
private GamingPayload() {
}
@Nullable
public static String getGameRequestID() {
Map<String, String> map = payloadData;
if (map != null && map.containsKey(KEY_GAME_REQUEST_ID)) {
return payloadData.get(KEY_GAME_REQUEST_ID);
}
return null;
}
@Nullable
public static String getPayload() {
Map<String, String> map = payloadData;
if (map != null && map.containsKey("payload")) {
return payloadData.get("payload");
}
return null;
}
@Nullable
public static String getTournamentId() {
Map<String, String> map = payloadData;
if (map != null && map.containsKey("tournament_id")) {
return payloadData.get("tournament_id");
}
return null;
}
public static void loadPayloadFromCloudGame(String str) {
HashMap hashMap = new HashMap();
try {
JSONObject jSONObject = new JSONObject(str);
hashMap.put(KEY_GAME_REQUEST_ID, jSONObject.optString(KEY_GAME_REQUEST_ID));
hashMap.put("payload", jSONObject.optString("payload"));
hashMap.put("tournament_id", jSONObject.optString("tournament_id"));
payloadData = hashMap;
} catch (JSONException e) {
Log.e(TAG, e.toString(), e);
}
}
public static void loadPayloadFromIntent(Intent intent) {
Bundle extras;
Bundle bundle;
HashMap hashMap = new HashMap();
if (intent == null || (extras = intent.getExtras()) == null || !extras.containsKey("al_applink_data") || (bundle = extras.getBundle("al_applink_data").getBundle("extras")) == null) {
return;
}
String string = bundle.getString(KEY_GAME_REQUEST_ID);
String string2 = bundle.getString("payload");
String string3 = bundle.getString(KEY_CONTEXT_TOKEN_ID);
String string4 = bundle.getString("tournament_id");
if (string3 != null) {
GamingContext.setCurrentGamingContext(new GamingContext(string3));
}
hashMap.put(KEY_GAME_REQUEST_ID, string);
hashMap.put("payload", string2);
hashMap.put("tournament_id", string4);
payloadData = hashMap;
}
}

View File

@@ -0,0 +1,5 @@
package com.facebook.gamingservices;
/* loaded from: classes2.dex */
public final class GamingServices {
}

View File

@@ -0,0 +1,34 @@
package com.facebook.gamingservices;
import android.content.Context;
import android.net.Uri;
import com.facebook.GraphRequest;
import com.facebook.share.internal.VideoUploader;
import com.facebook.share.model.ShareVideo;
import com.facebook.share.model.ShareVideoContent;
import java.io.FileNotFoundException;
/* loaded from: classes2.dex */
public class GamingVideoUploader {
private Context context;
public GamingVideoUploader(Context context) {
this.context = context;
}
public void uploadToMediaLibrary(String str, Uri uri) throws FileNotFoundException {
uploadToMediaLibrary(str, uri, null);
}
public void uploadToMediaLibrary(String str, Uri uri, GraphRequest.OnProgressCallback onProgressCallback) throws FileNotFoundException {
uploadToMediaLibrary(str, uri, false, onProgressCallback);
}
public void uploadToMediaLibrary(String str, Uri uri, boolean z, GraphRequest.OnProgressCallback onProgressCallback) throws FileNotFoundException {
ShareVideoContent build = new ShareVideoContent.Builder().setVideo(new ShareVideo.Builder().setLocalUrl(uri).build()).setContentDescription(str).build();
if (z) {
onProgressCallback = new OpenGamingMediaDialog(this.context, onProgressCallback);
}
VideoUploader.uploadAsyncWithProgressCallback(build, onProgressCallback);
}
}

View File

@@ -0,0 +1,12 @@
package com.facebook.gamingservices;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class GraphAPIException extends Exception {
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public GraphAPIException(String message) {
super(message);
Intrinsics.checkNotNullParameter(message, "message");
}
}

View File

@@ -0,0 +1,5 @@
package com.facebook.gamingservices;
/* loaded from: classes2.dex */
public final class InvalidExpirationDateException extends IllegalArgumentException {
}

View File

@@ -0,0 +1,5 @@
package com.facebook.gamingservices;
/* loaded from: classes2.dex */
public final class InvalidScoreTypeException extends IllegalArgumentException {
}

View File

@@ -0,0 +1,68 @@
package com.facebook.gamingservices;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.gamingservices.cloudgaming.CloudGameLoginHandler;
import com.facebook.gamingservices.cloudgaming.DaemonRequest;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.gamingservices.cloudgaming.internal.SDKMessageEnum;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class OpenGamingMediaDialog implements GraphRequest.OnProgressCallback {
private Context context;
private GraphRequest.Callback nestedCallback;
public OpenGamingMediaDialog(Context context) {
this(context, null);
}
public OpenGamingMediaDialog(Context context, GraphRequest.Callback callback) {
this.context = context;
this.nestedCallback = callback;
}
@Override // com.facebook.GraphRequest.Callback
public void onCompleted(GraphResponse graphResponse) {
GraphRequest.Callback callback = this.nestedCallback;
if (callback != null) {
callback.onCompleted(graphResponse);
}
if (graphResponse == null || graphResponse.getError() != null) {
return;
}
String optString = graphResponse.getJSONObject().optString("id", null);
String optString2 = graphResponse.getJSONObject().optString("video_id", null);
if (optString == null && optString2 == null) {
return;
}
if (optString == null) {
optString = optString2;
}
if (CloudGameLoginHandler.isRunningInCloud()) {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("id", optString);
jSONObject.put(SDKConstants.PARAM_DEEP_LINK, "MEDIA_ASSET");
DaemonRequest.executeAsync(this.context, jSONObject, (DaemonRequest.Callback) null, SDKMessageEnum.OPEN_GAMING_SERVICES_DEEP_LINK);
return;
} catch (JSONException unused) {
return;
}
}
this.context.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://fb.gg/me/media_asset/" + optString)));
}
@Override // com.facebook.GraphRequest.OnProgressCallback
public void onProgress(long j, long j2) {
GraphRequest.Callback callback = this.nestedCallback;
if (callback == null || !(callback instanceof GraphRequest.OnProgressCallback)) {
return;
}
((GraphRequest.OnProgressCallback) callback).onProgress(j, j2);
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,254 @@
package com.facebook.gamingservices;
import android.os.Parcel;
import android.os.Parcelable;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.gamingservices.internal.DateFormatter;
import com.facebook.share.model.ShareModel;
import com.facebook.share.model.ShareModelBuilder;
import com.google.gson.annotations.SerializedName;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class Tournament implements ShareModel {
public static final CREATOR CREATOR = new CREATOR(null);
@SerializedName("tournament_end_time")
public String endTime;
@SerializedName("id")
public final String identifier;
@SerializedName(SDKConstants.PARAM_TOURNAMENTS_PAYLOAD)
public final String payload;
@SerializedName(SDKConstants.PARAM_TOURNAMENTS_TITLE)
public final String title;
@Override // android.os.Parcelable
public int describeContents() {
return 0;
}
public final ZonedDateTime getExpiration() {
String str = this.endTime;
if (str == null) {
return null;
}
return DateFormatter.INSTANCE.format$facebook_gamingservices_release(str);
}
private final void setExpiration(ZonedDateTime zonedDateTime) {
if (zonedDateTime != null) {
this.endTime = zonedDateTime.format(DateTimeFormatter.ISO_DATE_TIME);
setExpiration(zonedDateTime);
}
}
public Tournament(String identifier, String str, String str2, String str3) {
Intrinsics.checkNotNullParameter(identifier, "identifier");
this.identifier = identifier;
this.endTime = str;
this.title = str2;
this.payload = str3;
setExpiration(str == null ? null : DateFormatter.INSTANCE.format$facebook_gamingservices_release(str));
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public Tournament(Parcel parcel) {
this(parcel.toString(), parcel.toString(), parcel.toString(), parcel.toString());
Intrinsics.checkNotNullParameter(parcel, "parcel");
}
public static final class Builder implements ShareModelBuilder<Tournament, Builder> {
private String endTime;
private ZonedDateTime expiration;
private String identifier;
private String payload;
private String title;
public static /* synthetic */ Builder copy$default(Builder builder, String str, ZonedDateTime zonedDateTime, String str2, String str3, int i, Object obj) {
if ((i & 1) != 0) {
str = builder.identifier;
}
if ((i & 2) != 0) {
zonedDateTime = builder.expiration;
}
if ((i & 4) != 0) {
str2 = builder.title;
}
if ((i & 8) != 0) {
str3 = builder.payload;
}
return builder.copy(str, zonedDateTime, str2, str3);
}
public final String component1() {
return this.identifier;
}
public final ZonedDateTime component2() {
return this.expiration;
}
public final String component3() {
return this.title;
}
public final String component4() {
return this.payload;
}
public final Builder copy(String identifier, ZonedDateTime zonedDateTime, String str, String str2) {
Intrinsics.checkNotNullParameter(identifier, "identifier");
return new Builder(identifier, zonedDateTime, str, str2);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Builder)) {
return false;
}
Builder builder = (Builder) obj;
return Intrinsics.areEqual(this.identifier, builder.identifier) && Intrinsics.areEqual(this.expiration, builder.expiration) && Intrinsics.areEqual(this.title, builder.title) && Intrinsics.areEqual(this.payload, builder.payload);
}
public final String getEndTime() {
return this.endTime;
}
public final ZonedDateTime getExpiration() {
return this.expiration;
}
public final String getIdentifier() {
return this.identifier;
}
public final String getPayload() {
return this.payload;
}
public final String getTitle() {
return this.title;
}
public int hashCode() {
int hashCode = this.identifier.hashCode() * 31;
ZonedDateTime zonedDateTime = this.expiration;
int hashCode2 = (hashCode + (zonedDateTime == null ? 0 : zonedDateTime.hashCode())) * 31;
String str = this.title;
int hashCode3 = (hashCode2 + (str == null ? 0 : str.hashCode())) * 31;
String str2 = this.payload;
return hashCode3 + (str2 != null ? str2.hashCode() : 0);
}
public final void setEndTime(String str) {
this.endTime = str;
}
public final void setExpiration(ZonedDateTime zonedDateTime) {
this.expiration = zonedDateTime;
}
public final void setIdentifier(String str) {
Intrinsics.checkNotNullParameter(str, "<set-?>");
this.identifier = str;
}
public final void setPayload(String str) {
this.payload = str;
}
public final void setTitle(String str) {
this.title = str;
}
public String toString() {
return "Builder(identifier=" + this.identifier + ", expiration=" + this.expiration + ", title=" + ((Object) this.title) + ", payload=" + ((Object) this.payload) + ')';
}
public Builder(String identifier, ZonedDateTime zonedDateTime, String str, String str2) {
Intrinsics.checkNotNullParameter(identifier, "identifier");
this.identifier = identifier;
this.expiration = zonedDateTime;
this.title = str;
this.payload = str2;
}
public /* synthetic */ Builder(String str, ZonedDateTime zonedDateTime, String str2, String str3, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(str, (i & 2) != 0 ? null : zonedDateTime, (i & 4) != 0 ? null : str2, (i & 8) != 0 ? null : str3);
}
public final Builder identifier(String identifier) {
Intrinsics.checkNotNullParameter(identifier, "identifier");
setIdentifier(identifier);
return this;
}
public final Builder expiration(ZonedDateTime zonedDateTime) {
setExpiration(zonedDateTime);
if (zonedDateTime != null) {
setEndTime(zonedDateTime.format(DateTimeFormatter.ISO_DATE_TIME));
}
return this;
}
public final Builder title(String str) {
setTitle(str);
return this;
}
public final Builder payload(String str) {
setPayload(str);
return this;
}
@Override // com.facebook.share.ShareBuilder
public Tournament build() {
return new Tournament(this.identifier, this.endTime, this.title, this.payload);
}
@Override // com.facebook.share.model.ShareModelBuilder
public Builder readFrom(Tournament tournament) {
Builder payload = tournament == null ? null : identifier(tournament.identifier).expiration(tournament.getExpiration()).title(tournament.title).payload(tournament.payload);
return payload == null ? this : payload;
}
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel out, int i) {
Intrinsics.checkNotNullParameter(out, "out");
out.writeString(this.identifier);
out.writeString(this.endTime);
out.writeString(this.title);
out.writeString(this.payload);
}
public static final class CREATOR implements Parcelable.Creator<Tournament> {
public /* synthetic */ CREATOR(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private CREATOR() {
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public Tournament createFromParcel(Parcel parcel) {
Intrinsics.checkNotNullParameter(parcel, "parcel");
return new Tournament(parcel);
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public Tournament[] newArray(int i) {
return new Tournament[i];
}
}
}

View File

@@ -0,0 +1,266 @@
package com.facebook.gamingservices;
import android.media.Image;
import android.os.Parcel;
import android.os.Parcelable;
import com.facebook.gamingservices.internal.DateFormatter;
import com.facebook.gamingservices.internal.TournamentScoreType;
import com.facebook.gamingservices.internal.TournamentSortOrder;
import com.facebook.share.model.ShareModel;
import com.facebook.share.model.ShareModelBuilder;
import java.time.Instant;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class TournamentConfig implements ShareModel {
public static final CREATOR CREATOR = new CREATOR(null);
private final Instant endTime;
private final Image image;
private final String payload;
private final TournamentScoreType scoreType;
private final TournamentSortOrder sortOrder;
private final String title;
public /* synthetic */ TournamentConfig(Builder builder, DefaultConstructorMarker defaultConstructorMarker) {
this(builder);
}
@Override // android.os.Parcelable
public int describeContents() {
return 0;
}
public final Instant getEndTime() {
return this.endTime;
}
public final Image getImage() {
return this.image;
}
public final String getPayload() {
return this.payload;
}
public final TournamentScoreType getScoreType() {
return this.scoreType;
}
public final TournamentSortOrder getSortOrder() {
return this.sortOrder;
}
public final String getTitle() {
return this.title;
}
private TournamentConfig(Builder builder) {
this.title = builder.getTitle();
this.sortOrder = builder.getSortOrder();
this.scoreType = builder.getScoreType();
this.endTime = builder.getEndTime();
this.image = builder.getImage();
this.payload = builder.getPayload();
}
public TournamentConfig(Parcel parcel) {
TournamentSortOrder tournamentSortOrder;
TournamentScoreType tournamentScoreType;
Intrinsics.checkNotNullParameter(parcel, "parcel");
this.title = parcel.readString();
TournamentSortOrder[] valuesCustom = TournamentSortOrder.valuesCustom();
int length = valuesCustom.length;
int i = 0;
int i2 = 0;
while (true) {
if (i2 >= length) {
tournamentSortOrder = null;
break;
}
tournamentSortOrder = valuesCustom[i2];
if (Intrinsics.areEqual(tournamentSortOrder.name(), parcel.readString())) {
break;
} else {
i2++;
}
}
this.sortOrder = tournamentSortOrder;
TournamentScoreType[] valuesCustom2 = TournamentScoreType.valuesCustom();
int length2 = valuesCustom2.length;
while (true) {
if (i >= length2) {
tournamentScoreType = null;
break;
}
tournamentScoreType = valuesCustom2[i];
if (Intrinsics.areEqual(tournamentScoreType.name(), parcel.readString())) {
break;
} else {
i++;
}
}
this.scoreType = tournamentScoreType;
String readString = parcel.readString();
this.endTime = readString == null ? null : Instant.from(DateFormatter.INSTANCE.format$facebook_gamingservices_release(readString));
this.payload = parcel.readString();
this.image = null;
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel out, int i) {
Intrinsics.checkNotNullParameter(out, "out");
out.writeString(String.valueOf(this.sortOrder));
out.writeString(String.valueOf(this.scoreType));
out.writeString(String.valueOf(this.endTime));
out.writeString(this.title);
out.writeString(this.payload);
}
public static final class Builder implements ShareModelBuilder<TournamentConfig, Builder> {
private Instant endTime;
private Image image;
private String payload;
private TournamentScoreType scoreType;
private TournamentSortOrder sortOrder;
private String title;
public final Instant getEndTime() {
return this.endTime;
}
public final Image getImage() {
return this.image;
}
public final String getPayload() {
return this.payload;
}
public final TournamentScoreType getScoreType() {
return this.scoreType;
}
public final TournamentSortOrder getSortOrder() {
return this.sortOrder;
}
public final String getTitle() {
return this.title;
}
public final void setEndTime(Instant instant) {
this.endTime = instant;
}
public final void setImage(Image image) {
this.image = image;
}
public final void setPayload(String str) {
this.payload = str;
}
public final void setScoreType(TournamentScoreType tournamentScoreType) {
this.scoreType = tournamentScoreType;
}
public final void setSortOrder(TournamentSortOrder tournamentSortOrder) {
this.sortOrder = tournamentSortOrder;
}
public final void setTitle(String str) {
this.title = str;
}
public final Builder setTournamentEndTime(Instant endTime) {
Intrinsics.checkNotNullParameter(endTime, "endTime");
this.endTime = endTime;
return this;
}
public final Builder setTournamentImage(Image image) {
this.image = image;
return this;
}
public final Builder setTournamentPayload(String str) {
this.payload = str;
return this;
}
public final Builder setTournamentScoreType(TournamentScoreType scoreType) {
Intrinsics.checkNotNullParameter(scoreType, "scoreType");
this.scoreType = scoreType;
return this;
}
public final Builder setTournamentSortOrder(TournamentSortOrder sortOrder) {
Intrinsics.checkNotNullParameter(sortOrder, "sortOrder");
this.sortOrder = sortOrder;
return this;
}
public final Builder setTournamentTitle(String str) {
this.title = str;
return this;
}
@Override // com.facebook.share.ShareBuilder
public TournamentConfig build() {
return new TournamentConfig(this, null);
}
public final Builder readFrom$facebook_gamingservices_release(Parcel parcel) {
Intrinsics.checkNotNullParameter(parcel, "parcel");
return readFrom((TournamentConfig) parcel.readParcelable(TournamentConfig.class.getClassLoader()));
}
@Override // com.facebook.share.model.ShareModelBuilder
public Builder readFrom(TournamentConfig tournamentConfig) {
if (tournamentConfig == null) {
return this;
}
TournamentSortOrder sortOrder = tournamentConfig.getSortOrder();
if (sortOrder != null) {
setTournamentSortOrder(sortOrder);
}
TournamentScoreType scoreType = tournamentConfig.getScoreType();
if (scoreType != null) {
setTournamentScoreType(scoreType);
}
Instant endTime = tournamentConfig.getEndTime();
if (endTime != null) {
setTournamentEndTime(endTime);
}
String title = tournamentConfig.getTitle();
if (title != null) {
setTournamentTitle(title);
}
setTournamentPayload(tournamentConfig.getPayload());
return this;
}
}
public static final class CREATOR implements Parcelable.Creator<TournamentConfig> {
public /* synthetic */ CREATOR(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private CREATOR() {
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public TournamentConfig createFromParcel(Parcel parcel) {
Intrinsics.checkNotNullParameter(parcel, "parcel");
return new TournamentConfig(parcel);
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public TournamentConfig[] newArray(int i) {
return new TournamentConfig[i];
}
}
}

View File

@@ -0,0 +1,90 @@
package com.facebook.gamingservices;
import android.os.Bundle;
import com.facebook.AccessToken;
import com.facebook.FacebookException;
import com.facebook.FacebookRequestError;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.HttpMethod;
import com.facebook.bolts.TaskCompletionSource;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import kotlin.collections.ArraysKt___ArraysKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class TournamentFetcher {
public final TaskCompletionSource<List<Tournament>> fetchTournaments() {
final TaskCompletionSource<List<Tournament>> taskCompletionSource = new TaskCompletionSource<>();
Bundle bundle = new Bundle();
AccessToken.Companion companion = AccessToken.Companion;
AccessToken currentAccessToken = companion.getCurrentAccessToken();
if (currentAccessToken == null || currentAccessToken.isExpired()) {
throw new FacebookException("Attempted to fetch tournament with an invalid access token");
}
if (currentAccessToken.getGraphDomain() == null || !Intrinsics.areEqual(FacebookSdk.GAMING, currentAccessToken.getGraphDomain())) {
throw new FacebookException("User is not using gaming login");
}
GraphRequest graphRequest = new GraphRequest(companion.getCurrentAccessToken(), "me/tournaments", bundle, HttpMethod.GET, new GraphRequest.Callback() { // from class: com.facebook.gamingservices.TournamentFetcher$$ExternalSyntheticLambda0
@Override // com.facebook.GraphRequest.Callback
public final void onCompleted(GraphResponse graphResponse) {
TournamentFetcher.m550fetchTournaments$lambda1(TaskCompletionSource.this, graphResponse);
}
}, null, 32, null);
graphRequest.setParameters(bundle);
graphRequest.executeAsync();
return taskCompletionSource;
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: fetchTournaments$lambda-1, reason: not valid java name */
public static final void m550fetchTournaments$lambda1(TaskCompletionSource task, GraphResponse response) {
List list;
Intrinsics.checkNotNullParameter(task, "$task");
Intrinsics.checkNotNullParameter(response, "response");
if (response.getError() != null) {
FacebookRequestError error = response.getError();
if ((error == null ? null : error.getException()) != null) {
FacebookRequestError error2 = response.getError();
task.setError(error2 != null ? error2.getException() : null);
return;
} else {
task.setError(new GraphAPIException("Graph API Error"));
return;
}
}
try {
JSONObject jSONObject = response.getJSONObject();
if (jSONObject == null) {
task.setError(new GraphAPIException("Failed to get response"));
return;
}
JSONArray jSONArray = jSONObject.getJSONArray("data");
if (jSONArray != null && jSONArray.length() >= 1) {
Gson create = new GsonBuilder().create();
String jSONArray2 = jSONArray.toString();
Intrinsics.checkNotNullExpressionValue(jSONArray2, "data.toString()");
Object fromJson = create.fromJson(jSONArray2, (Class<Object>) Tournament[].class);
Intrinsics.checkNotNullExpressionValue(fromJson, "gson.fromJson(dataString, Array<Tournament>::class.java)");
list = ArraysKt___ArraysKt.toList((Object[]) fromJson);
task.setResult(list);
return;
}
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(Locale.ROOT, "No tournament found", Arrays.copyOf(new Object[]{Integer.valueOf(jSONArray.length()), 1}, 2));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(locale, format, *args)");
task.setError(new GraphAPIException(format));
} catch (JSONException e) {
task.setError(e);
}
}
}

View File

@@ -0,0 +1,6 @@
package com.facebook.gamingservices;
/* loaded from: classes2.dex */
public final class TournamentFetcherKt {
private static final String GRAPH_RESPONSE_DATA_KEY = "data";
}

View File

@@ -0,0 +1,276 @@
package com.facebook.gamingservices;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import com.facebook.AccessToken;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.gamingservices.TournamentJoinDialog;
import com.facebook.gamingservices.cloudgaming.CloudGameLoginHandler;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.gamingservices.internal.TournamentJoinDialogURIBuilder;
import com.facebook.internal.AppCall;
import com.facebook.internal.CallbackManagerImpl;
import com.facebook.internal.CustomTabUtils;
import com.facebook.internal.DialogPresenter;
import com.facebook.internal.FacebookDialogBase;
import com.facebook.internal.FragmentWrapper;
import com.facebook.internal.NativeProtocol;
import com.facebook.internal.ServerProtocol;
import com.facebook.internal.instrument.crashshield.AutoHandleExceptions;
import com.facebook.share.internal.ResultProcessor;
import com.facebook.share.internal.ShareInternalUtility;
import java.util.List;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
@AutoHandleExceptions
/* loaded from: classes2.dex */
public final class TournamentJoinDialog extends FacebookDialogBase<String, Result> {
public static final Companion Companion = new Companion(null);
private static final int DEFAULT_REQUEST_CODE = CallbackManagerImpl.RequestCodeOffset.TournamentJoinDialog.toRequestCode();
private static final String JOIN_TOURNAMENT_ACCESS_TOKEN_KEY = "access_token";
private static final String JOIN_TOURNAMENT_ACTION = "com.facebook.games.gaming_services.DEEPLINK";
private static final String JOIN_TOURNAMENT_CONTENT_TYPE = "text/plain";
private static final String JOIN_TOURNAMENT_DIALOG = "join_tournament";
private static final String JOIN_TOURNAMENT_ERROR_MESSAGE_KEY = "error_message";
private String payload;
private Number requestID;
private String tournamentID;
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public TournamentJoinDialog(Activity activity) {
super(activity, DEFAULT_REQUEST_CODE);
Intrinsics.checkNotNullParameter(activity, "activity");
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public TournamentJoinDialog(Fragment fragment) {
this(new FragmentWrapper(fragment));
Intrinsics.checkNotNullParameter(fragment, "fragment");
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public TournamentJoinDialog(android.app.Fragment fragment) {
this(new FragmentWrapper(fragment));
Intrinsics.checkNotNullParameter(fragment, "fragment");
}
private TournamentJoinDialog(FragmentWrapper fragmentWrapper) {
super(fragmentWrapper, DEFAULT_REQUEST_CODE);
}
public final void show(String str, String str2) {
this.tournamentID = str;
this.payload = str2;
super.showImpl((TournamentJoinDialog) str, FacebookDialogBase.BASE_AUTOMATIC_MODE);
}
@Override // com.facebook.internal.FacebookDialogBase
public void showImpl(String str, Object mode) {
Intrinsics.checkNotNullParameter(mode, "mode");
if (CloudGameLoginHandler.isRunningInCloud()) {
return;
}
super.showImpl((TournamentJoinDialog) str, mode);
}
@Override // com.facebook.internal.FacebookDialogBase
public void registerCallbackImpl(CallbackManagerImpl callbackManager, final FacebookCallback<Result> callback) {
Intrinsics.checkNotNullParameter(callbackManager, "callbackManager");
Intrinsics.checkNotNullParameter(callback, "callback");
final ResultProcessor resultProcessor = new ResultProcessor(callback) { // from class: com.facebook.gamingservices.TournamentJoinDialog$registerCallbackImpl$resultProcessor$1
final /* synthetic */ FacebookCallback<TournamentJoinDialog.Result> $callback;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(callback);
this.$callback = callback;
}
@Override // com.facebook.share.internal.ResultProcessor
public void onSuccess(AppCall appCall, Bundle bundle) {
Intrinsics.checkNotNullParameter(appCall, "appCall");
if (bundle != null) {
if (bundle.getString("error_message") != null) {
this.$callback.onError(new FacebookException(bundle.getString("error_message")));
return;
} else if (bundle.getString("payload") != null) {
this.$callback.onSuccess(new TournamentJoinDialog.Result(bundle));
return;
}
}
onCancel(appCall);
}
};
callbackManager.registerCallback(getRequestCode(), new CallbackManagerImpl.Callback() { // from class: com.facebook.gamingservices.TournamentJoinDialog$$ExternalSyntheticLambda0
@Override // com.facebook.internal.CallbackManagerImpl.Callback
public final boolean onActivityResult(int i, Intent intent) {
boolean m552registerCallbackImpl$lambda0;
m552registerCallbackImpl$lambda0 = TournamentJoinDialog.m552registerCallbackImpl$lambda0(TournamentJoinDialog.this, resultProcessor, i, intent);
return m552registerCallbackImpl$lambda0;
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: registerCallbackImpl$lambda-0, reason: not valid java name */
public static final boolean m552registerCallbackImpl$lambda0(TournamentJoinDialog this$0, ResultProcessor resultProcessor, int i, Intent intent) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(resultProcessor, "$resultProcessor");
ShareInternalUtility shareInternalUtility = ShareInternalUtility.INSTANCE;
return ShareInternalUtility.handleActivityResult(this$0.getRequestCode(), i, intent, resultProcessor);
}
@Override // com.facebook.internal.FacebookDialogBase
public List<FacebookDialogBase<String, Result>.ModeHandler> getOrderedModeHandlers() {
List<FacebookDialogBase<String, Result>.ModeHandler> listOf;
listOf = CollectionsKt__CollectionsKt.listOf((Object[]) new FacebookDialogBase.ModeHandler[]{new FacebookAppHandler(this), new ChromeCustomTabHandler(this)});
return listOf;
}
@Override // com.facebook.internal.FacebookDialogBase
public AppCall createBaseAppCall() {
return new AppCall(getRequestCode(), null, 2, null);
}
public static final class Result {
private String payload;
private String requestID;
private String tournamentID;
public final String getPayload() {
return this.payload;
}
public final String getRequestID() {
return this.requestID;
}
public final String getTournamentID() {
return this.tournamentID;
}
public final void setPayload(String str) {
this.payload = str;
}
public final void setRequestID(String str) {
this.requestID = str;
}
public final void setTournamentID(String str) {
this.tournamentID = str;
}
public Result(Bundle results) {
Intrinsics.checkNotNullParameter(results, "results");
if (results.getString("request") != null) {
this.requestID = results.getString("request");
}
this.tournamentID = results.getString(SDKConstants.PARAM_TOURNAMENTS_ID);
this.payload = results.getString("payload");
}
}
@Override // com.facebook.internal.FacebookDialogBase, com.facebook.FacebookDialog
public boolean canShow(String str) {
if (CloudGameLoginHandler.isRunningInCloud()) {
return false;
}
if (new FacebookAppHandler(this).canShow(str, true)) {
return true;
}
return new ChromeCustomTabHandler(this).canShow(str, true);
}
public final class FacebookAppHandler extends FacebookDialogBase<String, Result>.ModeHandler {
final /* synthetic */ TournamentJoinDialog this$0;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public FacebookAppHandler(TournamentJoinDialog this$0) {
super(this$0);
Intrinsics.checkNotNullParameter(this$0, "this$0");
this.this$0 = this$0;
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public boolean canShow(String str, boolean z) {
PackageManager packageManager = FacebookSdk.getApplicationContext().getPackageManager();
Intrinsics.checkNotNullExpressionValue(packageManager, "FacebookSdk.getApplicationContext().packageManager");
Intent intent = new Intent(TournamentJoinDialog.JOIN_TOURNAMENT_ACTION);
intent.setType("text/plain");
return intent.resolveActivity(packageManager) != null;
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public AppCall createAppCall(String str) {
AccessToken currentAccessToken = AccessToken.Companion.getCurrentAccessToken();
AppCall createBaseAppCall = this.this$0.createBaseAppCall();
Intent intent = new Intent(TournamentJoinDialog.JOIN_TOURNAMENT_ACTION);
intent.setType("text/plain");
if (currentAccessToken == null || currentAccessToken.isExpired()) {
throw new FacebookException("Attempted to present TournamentJoinDialog with an invalid access token");
}
if (currentAccessToken.getGraphDomain() != null && !Intrinsics.areEqual(FacebookSdk.GAMING, currentAccessToken.getGraphDomain())) {
throw new FacebookException("Attempted to present TournamentJoinDialog while user is not gaming logged in");
}
Bundle bundle$facebook_gamingservices_release = TournamentJoinDialogURIBuilder.INSTANCE.bundle$facebook_gamingservices_release(currentAccessToken.getApplicationId(), this.this$0.tournamentID, this.this$0.payload);
NativeProtocol nativeProtocol = NativeProtocol.INSTANCE;
NativeProtocol.setupProtocolRequestIntent(intent, createBaseAppCall.getCallId().toString(), "", NativeProtocol.PROTOCOL_VERSION_20210906, bundle$facebook_gamingservices_release);
createBaseAppCall.setRequestIntent(intent);
return createBaseAppCall;
}
}
public final class ChromeCustomTabHandler extends FacebookDialogBase<String, Result>.ModeHandler {
final /* synthetic */ TournamentJoinDialog this$0;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public ChromeCustomTabHandler(TournamentJoinDialog this$0) {
super(this$0);
Intrinsics.checkNotNullParameter(this$0, "this$0");
this.this$0 = this$0;
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public boolean canShow(String str, boolean z) {
return CustomTabUtils.getChromePackage() != null;
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public AppCall createAppCall(String str) {
AppCall createBaseAppCall = this.this$0.createBaseAppCall();
AccessToken currentAccessToken = AccessToken.Companion.getCurrentAccessToken();
Bundle bundle = new Bundle();
Bundle bundle2 = new Bundle();
String applicationId = currentAccessToken == null ? null : currentAccessToken.getApplicationId();
if (applicationId == null) {
applicationId = FacebookSdk.getApplicationId();
}
bundle.putString("app_id", applicationId);
bundle.putString("payload", bundle2.toString());
if (currentAccessToken != null) {
currentAccessToken.getToken();
}
bundle.putString("access_token", currentAccessToken != null ? currentAccessToken.getToken() : null);
bundle.putString(ServerProtocol.DIALOG_PARAM_REDIRECT_URI, CustomTabUtils.getDefaultRedirectURI());
DialogPresenter.setupAppCallForCustomTabDialog(createBaseAppCall, TournamentJoinDialog.JOIN_TOURNAMENT_DIALOG, bundle);
return createBaseAppCall;
}
}
}

View File

@@ -0,0 +1,289 @@
package com.facebook.gamingservices;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import com.facebook.AccessToken;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.gamingservices.TournamentShareDialog;
import com.facebook.gamingservices.cloudgaming.CloudGameLoginHandler;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.gamingservices.internal.TournamentShareDialogURIBuilder;
import com.facebook.internal.AppCall;
import com.facebook.internal.CallbackManagerImpl;
import com.facebook.internal.FacebookDialogBase;
import com.facebook.internal.FragmentWrapper;
import com.facebook.internal.NativeProtocol;
import com.facebook.internal.instrument.crashshield.AutoHandleExceptions;
import com.facebook.share.internal.ResultProcessor;
import com.facebook.share.internal.ShareInternalUtility;
import java.util.ArrayList;
import java.util.List;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
@AutoHandleExceptions
/* loaded from: classes2.dex */
public final class TournamentShareDialog extends FacebookDialogBase<TournamentConfig, Result> {
public static final Companion Companion = new Companion(null);
private static final int defaultRequestCode = CallbackManagerImpl.RequestCodeOffset.TournamentShareDialog.toRequestCode();
private Number score;
private Tournament tournament;
public final Number getScore() {
return this.score;
}
public final Tournament getTournament() {
return this.tournament;
}
public final void setScore(Number number) {
this.score = number;
}
public final void setTournament(Tournament tournament) {
this.tournament = tournament;
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public TournamentShareDialog(Activity activity) {
super(activity, defaultRequestCode);
Intrinsics.checkNotNullParameter(activity, "activity");
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public TournamentShareDialog(Fragment fragment) {
this(new FragmentWrapper(fragment));
Intrinsics.checkNotNullParameter(fragment, "fragment");
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public TournamentShareDialog(android.app.Fragment fragment) {
this(new FragmentWrapper(fragment));
Intrinsics.checkNotNullParameter(fragment, "fragment");
}
private TournamentShareDialog(FragmentWrapper fragmentWrapper) {
super(fragmentWrapper, defaultRequestCode);
}
public final void show(Number score, TournamentConfig newTournamentConfig) {
Intrinsics.checkNotNullParameter(score, "score");
Intrinsics.checkNotNullParameter(newTournamentConfig, "newTournamentConfig");
this.score = score;
showImpl(newTournamentConfig, FacebookDialogBase.BASE_AUTOMATIC_MODE);
}
public final void show(Number score, Tournament tournament) {
Intrinsics.checkNotNullParameter(score, "score");
Intrinsics.checkNotNullParameter(tournament, "tournament");
this.score = score;
this.tournament = tournament;
showImpl((TournamentConfig) null, FacebookDialogBase.BASE_AUTOMATIC_MODE);
}
@Override // com.facebook.internal.FacebookDialogBase
public void showImpl(TournamentConfig tournamentConfig, Object mode) {
Intrinsics.checkNotNullParameter(mode, "mode");
if (CloudGameLoginHandler.isRunningInCloud()) {
return;
}
super.showImpl((TournamentShareDialog) tournamentConfig, mode);
}
@Override // com.facebook.internal.FacebookDialogBase
public void registerCallbackImpl(CallbackManagerImpl callbackManager, final FacebookCallback<Result> callback) {
Intrinsics.checkNotNullParameter(callbackManager, "callbackManager");
Intrinsics.checkNotNullParameter(callback, "callback");
final ResultProcessor resultProcessor = new ResultProcessor(callback) { // from class: com.facebook.gamingservices.TournamentShareDialog$registerCallbackImpl$resultProcessor$1
final /* synthetic */ FacebookCallback<TournamentShareDialog.Result> $callback;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(callback);
this.$callback = callback;
}
@Override // com.facebook.share.internal.ResultProcessor
public void onSuccess(AppCall appCall, Bundle bundle) {
Intrinsics.checkNotNullParameter(appCall, "appCall");
if (bundle != null) {
if (bundle.getString("error_message") != null) {
this.$callback.onError(new FacebookException(bundle.getString("error_message")));
return;
} else if (bundle.getString(SDKConstants.PARAM_TOURNAMENTS_ID) != null) {
this.$callback.onSuccess(new TournamentShareDialog.Result(bundle));
return;
}
}
onCancel(appCall);
}
};
callbackManager.registerCallback(getRequestCode(), new CallbackManagerImpl.Callback() { // from class: com.facebook.gamingservices.TournamentShareDialog$$ExternalSyntheticLambda0
@Override // com.facebook.internal.CallbackManagerImpl.Callback
public final boolean onActivityResult(int i, Intent intent) {
boolean m554registerCallbackImpl$lambda0;
m554registerCallbackImpl$lambda0 = TournamentShareDialog.m554registerCallbackImpl$lambda0(TournamentShareDialog.this, resultProcessor, i, intent);
return m554registerCallbackImpl$lambda0;
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: registerCallbackImpl$lambda-0, reason: not valid java name */
public static final boolean m554registerCallbackImpl$lambda0(TournamentShareDialog this$0, ResultProcessor resultProcessor, int i, Intent intent) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
ShareInternalUtility shareInternalUtility = ShareInternalUtility.INSTANCE;
return ShareInternalUtility.handleActivityResult(this$0.getRequestCode(), i, intent, resultProcessor);
}
@Override // com.facebook.internal.FacebookDialogBase
public List<FacebookDialogBase<TournamentConfig, Result>.ModeHandler> getOrderedModeHandlers() {
ArrayList arrayList = new ArrayList();
arrayList.add(new FacebookAppHandler(this));
arrayList.add(new AppSwitchHandler(this));
return arrayList;
}
@Override // com.facebook.internal.FacebookDialogBase
public AppCall createBaseAppCall() {
return new AppCall(getRequestCode(), null, 2, null);
}
public static final class Result {
private String requestID;
private String tournamentID;
public final String getRequestID() {
return this.requestID;
}
public final String getTournamentID() {
return this.tournamentID;
}
public final void setRequestID(String str) {
this.requestID = str;
}
public final void setTournamentID(String str) {
this.tournamentID = str;
}
public Result(Bundle results) {
Intrinsics.checkNotNullParameter(results, "results");
if (results.getString("request") != null) {
this.requestID = results.getString("request");
}
this.tournamentID = results.getString(SDKConstants.PARAM_TOURNAMENTS_ID);
}
}
public final class FacebookAppHandler extends FacebookDialogBase<TournamentConfig, Result>.ModeHandler {
final /* synthetic */ TournamentShareDialog this$0;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public FacebookAppHandler(TournamentShareDialog this$0) {
super(this$0);
Intrinsics.checkNotNullParameter(this$0, "this$0");
this.this$0 = this$0;
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public boolean canShow(TournamentConfig tournamentConfig, boolean z) {
PackageManager packageManager = FacebookSdk.getApplicationContext().getPackageManager();
Intrinsics.checkNotNullExpressionValue(packageManager, "getApplicationContext().packageManager");
Intent intent = new Intent("com.facebook.games.gaming_services.DEEPLINK");
intent.setType("text/plain");
return intent.resolveActivity(packageManager) != null;
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public AppCall createAppCall(TournamentConfig tournamentConfig) {
Bundle bundleForUpdating$facebook_gamingservices_release;
AccessToken currentAccessToken = AccessToken.Companion.getCurrentAccessToken();
AppCall createBaseAppCall = this.this$0.createBaseAppCall();
Intent intent = new Intent("com.facebook.games.gaming_services.DEEPLINK");
intent.setType("text/plain");
if (currentAccessToken == null || currentAccessToken.isExpired()) {
throw new FacebookException("Attempted to share tournament with an invalid access token");
}
if (currentAccessToken.getGraphDomain() != null && !Intrinsics.areEqual(FacebookSdk.GAMING, currentAccessToken.getGraphDomain())) {
throw new FacebookException("Attempted to share tournament while user is not gaming logged in");
}
String applicationId = currentAccessToken.getApplicationId();
Number score = this.this$0.getScore();
if (score == null) {
throw new FacebookException("Attempted to share tournament without a score");
}
if (tournamentConfig != null) {
bundleForUpdating$facebook_gamingservices_release = TournamentShareDialogURIBuilder.INSTANCE.bundleForCreating$facebook_gamingservices_release(tournamentConfig, score, applicationId);
} else {
Tournament tournament = this.this$0.getTournament();
bundleForUpdating$facebook_gamingservices_release = tournament == null ? null : TournamentShareDialogURIBuilder.INSTANCE.bundleForUpdating$facebook_gamingservices_release(tournament.identifier, score, applicationId);
}
NativeProtocol nativeProtocol = NativeProtocol.INSTANCE;
NativeProtocol.setupProtocolRequestIntent(intent, createBaseAppCall.getCallId().toString(), "", NativeProtocol.PROTOCOL_VERSION_20210906, bundleForUpdating$facebook_gamingservices_release);
createBaseAppCall.setRequestIntent(intent);
return createBaseAppCall;
}
}
public final class AppSwitchHandler extends FacebookDialogBase<TournamentConfig, Result>.ModeHandler {
final /* synthetic */ TournamentShareDialog this$0;
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public boolean canShow(TournamentConfig tournamentConfig, boolean z) {
return true;
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public AppSwitchHandler(TournamentShareDialog this$0) {
super(this$0);
Intrinsics.checkNotNullParameter(this$0, "this$0");
this.this$0 = this$0;
}
@Override // com.facebook.internal.FacebookDialogBase.ModeHandler
public AppCall createAppCall(TournamentConfig tournamentConfig) {
Uri uriForUpdating$facebook_gamingservices_release;
AppCall createBaseAppCall = this.this$0.createBaseAppCall();
AccessToken currentAccessToken = AccessToken.Companion.getCurrentAccessToken();
if (currentAccessToken == null || currentAccessToken.isExpired()) {
throw new FacebookException("Attempted to share tournament with an invalid access token");
}
if (currentAccessToken.getGraphDomain() != null && !Intrinsics.areEqual(FacebookSdk.GAMING, currentAccessToken.getGraphDomain())) {
throw new FacebookException("Attempted to share tournament without without gaming login");
}
Number score = this.this$0.getScore();
if (score == null) {
throw new FacebookException("Attempted to share tournament without a score");
}
if (tournamentConfig != null) {
uriForUpdating$facebook_gamingservices_release = TournamentShareDialogURIBuilder.INSTANCE.uriForCreating$facebook_gamingservices_release(tournamentConfig, score, currentAccessToken.getApplicationId());
} else {
Tournament tournament = this.this$0.getTournament();
uriForUpdating$facebook_gamingservices_release = tournament == null ? null : TournamentShareDialogURIBuilder.INSTANCE.uriForUpdating$facebook_gamingservices_release(tournament.identifier, score, currentAccessToken.getApplicationId());
}
Intent intent = new Intent("android.intent.action.VIEW", uriForUpdating$facebook_gamingservices_release);
TournamentShareDialog tournamentShareDialog = this.this$0;
tournamentShareDialog.startActivityForResult(intent, tournamentShareDialog.getRequestCode());
return createBaseAppCall;
}
}
}

View File

@@ -0,0 +1,70 @@
package com.facebook.gamingservices;
import android.os.Bundle;
import com.facebook.AccessToken;
import com.facebook.FacebookException;
import com.facebook.FacebookRequestError;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.HttpMethod;
import com.facebook.bolts.TaskCompletionSource;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class TournamentUpdater {
public final TaskCompletionSource<Boolean> update(Tournament tournament, Number score) {
Intrinsics.checkNotNullParameter(tournament, "tournament");
Intrinsics.checkNotNullParameter(score, "score");
return update(tournament.identifier, score);
}
public final TaskCompletionSource<Boolean> update(String identifier, Number score) {
Intrinsics.checkNotNullParameter(identifier, "identifier");
Intrinsics.checkNotNullParameter(score, "score");
AccessToken currentAccessToken = AccessToken.Companion.getCurrentAccessToken();
if (currentAccessToken == null || currentAccessToken.isExpired()) {
throw new FacebookException("Attempted to fetch tournament with an invalid access token");
}
if (currentAccessToken.getGraphDomain() == null || !Intrinsics.areEqual(FacebookSdk.GAMING, currentAccessToken.getGraphDomain())) {
throw new FacebookException("User is not using gaming login");
}
final TaskCompletionSource<Boolean> taskCompletionSource = new TaskCompletionSource<>();
String stringPlus = Intrinsics.stringPlus(identifier, "/update_score");
Bundle bundle = new Bundle();
bundle.putInt("score", score.intValue());
new GraphRequest(currentAccessToken, stringPlus, bundle, HttpMethod.POST, new GraphRequest.Callback() { // from class: com.facebook.gamingservices.TournamentUpdater$$ExternalSyntheticLambda0
@Override // com.facebook.GraphRequest.Callback
public final void onCompleted(GraphResponse graphResponse) {
TournamentUpdater.m555update$lambda0(TaskCompletionSource.this, graphResponse);
}
}, null, 32, null).executeAsync();
return taskCompletionSource;
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: update$lambda-0, reason: not valid java name */
public static final void m555update$lambda0(TaskCompletionSource task, GraphResponse response) {
Intrinsics.checkNotNullParameter(task, "$task");
Intrinsics.checkNotNullParameter(response, "response");
if (response.getError() != null) {
FacebookRequestError error = response.getError();
if ((error == null ? null : error.getException()) != null) {
FacebookRequestError error2 = response.getError();
task.setError(error2 != null ? error2.getException() : null);
return;
} else {
task.setError(new GraphAPIException("Graph API Error"));
return;
}
}
JSONObject jSONObject = response.getJSONObject();
String optString = jSONObject != null ? jSONObject.optString("success") : null;
if (optString == null || optString.length() == 0) {
task.setError(new GraphAPIException("Graph API Error"));
} else {
task.setResult(Boolean.valueOf(optString.equals("true")));
}
}
}

View File

@@ -0,0 +1,6 @@
package com.facebook.gamingservices;
/* loaded from: classes2.dex */
public final class TournamentUpdaterKt {
private static final String GRAPH_RESPONSE_SUCCESS_KEY = "success";
}

View File

@@ -0,0 +1,32 @@
package com.facebook.gamingservices.cloudgaming;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.Nullable;
import com.facebook.GraphRequest;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.gamingservices.internal.GamingMediaUploader;
import java.io.File;
import java.io.FileNotFoundException;
/* loaded from: classes2.dex */
public abstract class AppToUserNotificationSender {
public static void scheduleAppToUserNotification(String str, String str2, Bitmap bitmap, int i, @Nullable String str3, GraphRequest.Callback callback) throws FileNotFoundException {
GamingMediaUploader.uploadToGamingServices(SDKConstants.PARAM_A2U_CAPTION, bitmap, getParameters(), new MediaUploadCallback(str, str2, i, str3, callback));
}
public static void scheduleAppToUserNotification(String str, String str2, File file, int i, @Nullable String str3, GraphRequest.Callback callback) throws FileNotFoundException {
GamingMediaUploader.uploadToGamingServices(SDKConstants.PARAM_A2U_CAPTION, file, getParameters(), new MediaUploadCallback(str, str2, i, str3, callback));
}
public static void scheduleAppToUserNotification(String str, String str2, Uri uri, int i, @Nullable String str3, GraphRequest.Callback callback) throws FileNotFoundException {
GamingMediaUploader.uploadToGamingServices(SDKConstants.PARAM_A2U_CAPTION, uri, getParameters(), new MediaUploadCallback(str, str2, i, str3, callback));
}
private static Bundle getParameters() {
Bundle bundle = new Bundle();
bundle.putString("upload_source", "A2U");
return bundle;
}
}

View File

@@ -0,0 +1,131 @@
package com.facebook.gamingservices.cloudgaming;
import android.content.Context;
import android.content.SharedPreferences;
import androidx.annotation.Nullable;
import com.facebook.AccessToken;
import com.facebook.AccessTokenSource;
import com.facebook.FacebookException;
import com.facebook.GraphResponse;
import com.facebook.Profile;
import com.facebook.gamingservices.GamingPayload;
import com.facebook.gamingservices.cloudgaming.DaemonRequest;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.gamingservices.cloudgaming.internal.SDKLogger;
import com.facebook.gamingservices.cloudgaming.internal.SDKMessageEnum;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class CloudGameLoginHandler {
private static final int DEFAULT_TIMEOUT_IN_SEC = 5;
private static boolean IS_RUNNING_IN_CLOUD = false;
private static SDKLogger mLogger;
public static boolean isRunningInCloud() {
return IS_RUNNING_IN_CLOUD;
}
@Nullable
public static synchronized AccessToken init(Context context) throws FacebookException {
AccessToken init;
synchronized (CloudGameLoginHandler.class) {
init = init(context, 5);
}
return init;
}
@Nullable
public static synchronized AccessToken init(Context context, int i) throws FacebookException {
AccessToken currentAccessToken;
synchronized (CloudGameLoginHandler.class) {
if (i <= 0) {
i = 5;
}
if (!isCloudEnvReady(context, i)) {
throw new FacebookException("Not running in Cloud environment.");
}
mLogger = SDKLogger.getInstance(context);
GraphResponse executeAndWait = DaemonRequest.executeAndWait(context, null, SDKMessageEnum.GET_ACCESS_TOKEN, i);
if (executeAndWait == null || executeAndWait.getJSONObject() == null) {
throw new FacebookException("Cannot receive response.");
}
if (executeAndWait.getError() != null) {
throw new FacebookException(executeAndWait.getError().getErrorMessage());
}
setPackageName(executeAndWait.getJSONObject(), context);
try {
currentAccessToken = setCurrentAccessToken(executeAndWait.getJSONObject());
GamingPayload.loadPayloadFromCloudGame(executeAndWait.getJSONObject().optString("payload"));
Profile.fetchProfileForCurrentAccessToken();
IS_RUNNING_IN_CLOUD = true;
mLogger.logLoginSuccess();
} catch (JSONException e) {
throw new FacebookException("Cannot properly handle response.", e);
}
}
return currentAccessToken;
}
private static boolean isCloudEnvReady(Context context, int i) {
GraphResponse executeAndWait = DaemonRequest.executeAndWait(context, null, SDKMessageEnum.IS_ENV_READY, i);
return (executeAndWait == null || executeAndWait.getJSONObject() == null || executeAndWait.getError() != null) ? false : true;
}
public static void gameLoadComplete(Context context, DaemonRequest.Callback callback) {
DaemonRequest.executeAsync(context, (JSONObject) null, callback, SDKMessageEnum.MARK_GAME_LOADED);
}
private static void setPackageName(JSONObject jSONObject, Context context) {
String optString = jSONObject.optString(SDKConstants.PARAM_DAEMON_PACKAGE_NAME);
if (optString.isEmpty()) {
throw new FacebookException("Could not establish a secure connection.");
}
SharedPreferences.Editor edit = context.getSharedPreferences(SDKConstants.PREF_DAEMON_PACKAGE_NAME, 0).edit();
edit.putString(SDKConstants.PARAM_DAEMON_PACKAGE_NAME, optString);
edit.commit();
}
@Nullable
private static AccessToken setCurrentAccessToken(JSONObject jSONObject) throws JSONException {
String optString = jSONObject.optString(SDKConstants.PARAM_ACCESS_TOKEN);
String optString2 = jSONObject.optString(SDKConstants.PARAM_ACCESS_TOKEN_SOURCE);
String optString3 = jSONObject.optString("appID");
String optString4 = jSONObject.optString(SDKConstants.PARAM_DECLINED_PERMISSIONS);
String optString5 = jSONObject.optString(SDKConstants.PARAM_EXPIRED_PERMISSIONS);
String optString6 = jSONObject.optString(SDKConstants.PARAM_EXPIRATION_TIME);
String optString7 = jSONObject.optString(SDKConstants.PARAM_DATA_ACCESS_EXPIRATION_TIME);
String optString8 = jSONObject.optString(SDKConstants.PARAM_GRAPH_DOMAIN);
String optString9 = jSONObject.optString(SDKConstants.PARAM_LAST_REFRESH_TIME);
String optString10 = jSONObject.optString("permissions");
String optString11 = jSONObject.optString(SDKConstants.PARAM_USER_ID);
String optString12 = jSONObject.optString(SDKConstants.PARAM_SESSION_ID);
if (optString.isEmpty() || optString3.isEmpty() || optString11.isEmpty()) {
return null;
}
SDKLogger sDKLogger = mLogger;
if (sDKLogger != null) {
sDKLogger.setAppID(optString3);
mLogger.setUserID(optString11);
mLogger.setSessionID(optString12);
}
AccessToken accessToken = new AccessToken(optString, optString3, optString11, convertPermissionsStringIntoPermissionsList(optString10), convertPermissionsStringIntoPermissionsList(optString4), convertPermissionsStringIntoPermissionsList(optString5), !optString2.isEmpty() ? AccessTokenSource.valueOf(optString2) : null, !optString6.isEmpty() ? new Date(Integer.parseInt(optString6) * 1000) : null, !optString9.isEmpty() ? new Date(Integer.parseInt(optString9) * 1000) : null, !optString7.isEmpty() ? new Date(Integer.parseInt(optString7) * 1000) : null, optString8.isEmpty() ? null : optString8);
AccessToken.setCurrentAccessToken(accessToken);
return accessToken;
}
private static List<String> convertPermissionsStringIntoPermissionsList(String str) throws JSONException {
ArrayList arrayList = new ArrayList();
if (!str.isEmpty()) {
JSONArray jSONArray = new JSONArray(str);
for (int i = 0; i < jSONArray.length(); i++) {
arrayList.add(jSONArray.get(i).toString());
}
}
return arrayList;
}
}

View File

@@ -0,0 +1,115 @@
package com.facebook.gamingservices.cloudgaming;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Handler;
import android.os.HandlerThread;
import androidx.annotation.Nullable;
import com.facebook.FacebookRequestError;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.gamingservices.cloudgaming.internal.SDKLogger;
import java.net.HttpURLConnection;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class DaemonReceiver {
private static SDKLogger mLogger;
private static ConcurrentHashMap<String, CompletableFuture<GraphResponse>> requestStore;
@Nullable
private static DaemonReceiver single_instance;
private DaemonReceiver(Context context) {
IntentFilter intentFilter = new IntentFilter(SDKConstants.RECEIVER_INTENT);
HandlerThread handlerThread = new HandlerThread(SDKConstants.RECEIVER_HANDLER);
handlerThread.start();
context.registerReceiver(new DaemonBroadcastReceiver(), intentFilter, null, new Handler(handlerThread.getLooper()));
requestStore = new ConcurrentHashMap<>();
mLogger = SDKLogger.getInstance(context);
}
public synchronized ConcurrentHashMap<String, CompletableFuture<GraphResponse>> getRequestStore() {
return requestStore;
}
public static synchronized DaemonReceiver getInstance(Context context) {
DaemonReceiver daemonReceiver;
synchronized (DaemonReceiver.class) {
try {
if (single_instance == null) {
single_instance = new DaemonReceiver(context);
}
daemonReceiver = single_instance;
} catch (Throwable th) {
throw th;
}
}
return daemonReceiver;
}
/* JADX INFO: Access modifiers changed from: private */
public static GraphResponse processResponse(JSONObject jSONObject, String str) {
if (!jSONObject.isNull("success")) {
return createSuccessResponse(jSONObject, str);
}
if (!jSONObject.isNull("error")) {
return createErrorResponse(jSONObject, str);
}
return createDefaultErrorResponse(str);
}
private static GraphResponse createSuccessResponse(JSONObject jSONObject, String str) {
if (jSONObject.optJSONObject("success") != null) {
mLogger.logSendingSuccessResponse(str);
return new GraphResponse(new GraphRequest(), (HttpURLConnection) null, "", jSONObject.optJSONObject("success"));
}
if (jSONObject.optJSONArray("success") != null) {
mLogger.logSendingSuccessResponse(str);
return new GraphResponse(new GraphRequest(), (HttpURLConnection) null, "", jSONObject.optJSONArray("success"));
}
return createDefaultErrorResponse(str);
}
public static GraphResponse createErrorResponse(FacebookRequestError facebookRequestError, @Nullable String str) {
mLogger.logSendingErrorResponse(facebookRequestError, str);
return new GraphResponse(new GraphRequest(), null, facebookRequestError);
}
private static GraphResponse createErrorResponse(JSONObject jSONObject, String str) {
JSONObject optJSONObject = jSONObject.optJSONObject("error");
if (optJSONObject != null) {
return createErrorResponse(new FacebookRequestError(optJSONObject.optInt("code"), optJSONObject.optString("type"), optJSONObject.optString("message")), str);
}
return createDefaultErrorResponse(str);
}
private static GraphResponse createDefaultErrorResponse(String str) {
return createErrorResponse(new FacebookRequestError(20, "UNSUPPORTED_FORMAT", "The response format is invalid."), str);
}
public static class DaemonBroadcastReceiver extends BroadcastReceiver {
private DaemonBroadcastReceiver() {
}
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
CompletableFuture completableFuture;
try {
JSONObject jSONObject = new JSONObject(intent.getStringExtra(SDKConstants.RECEIVER_PAYLOAD));
String string = jSONObject.getString(SDKConstants.REQUEST_ID);
if (!DaemonReceiver.requestStore.containsKey(string) || (completableFuture = (CompletableFuture) DaemonReceiver.requestStore.remove(string)) == null) {
return;
}
completableFuture.complete(DaemonReceiver.processResponse(jSONObject, string));
} catch (JSONException unused) {
}
}
}
}

View File

@@ -0,0 +1,157 @@
package com.facebook.gamingservices.cloudgaming;
import android.content.Context;
import android.content.Intent;
import androidx.annotation.Nullable;
import com.facebook.FacebookRequestError;
import com.facebook.GraphResponse;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.gamingservices.cloudgaming.internal.SDKLogger;
import com.facebook.gamingservices.cloudgaming.internal.SDKMessageEnum;
import java.util.Iterator;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.function.Consumer;
import java.util.function.Supplier;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class DaemonRequest {
private Callback mCallback;
private Context mContext;
private SDKLogger mLogger;
private JSONObject mParameters;
private ConcurrentHashMap<String, CompletableFuture<GraphResponse>> mRequestStore;
public interface Callback {
void onCompleted(GraphResponse graphResponse);
}
public DaemonRequest(Context context, JSONObject jSONObject, Callback callback) {
this.mContext = context;
this.mParameters = jSONObject;
this.mCallback = callback;
this.mRequestStore = DaemonReceiver.getInstance(context).getRequestStore();
this.mLogger = SDKLogger.getInstance(context);
}
private void executeAsync() throws ExecutionException, InterruptedException {
createRequest().thenAccept((Consumer<? super GraphResponse>) new Consumer<GraphResponse>() { // from class: com.facebook.gamingservices.cloudgaming.DaemonRequest.1
@Override // java.util.function.Consumer
public void accept(GraphResponse graphResponse) {
if (DaemonRequest.this.mCallback != null) {
DaemonRequest.this.mCallback.onCompleted(graphResponse);
}
}
});
}
private GraphResponse executeAndWait() throws ExecutionException, InterruptedException {
return createRequest().get();
}
private GraphResponse executeAndWait(int i) throws ExecutionException, InterruptedException, TimeoutException {
return createRequest().get(i, TimeUnit.SECONDS);
}
private CompletableFuture<GraphResponse> createRequest() {
return CompletableFuture.supplyAsync(new Supplier<GraphResponse>() { // from class: com.facebook.gamingservices.cloudgaming.DaemonRequest.2
/* JADX WARN: Can't rename method to resolve collision */
@Override // java.util.function.Supplier
public GraphResponse get() {
String uuid = UUID.randomUUID().toString();
try {
DaemonRequest.this.mParameters.put(SDKConstants.REQUEST_ID, uuid);
Intent intent = new Intent();
String string = DaemonRequest.this.mParameters.getString("type");
DaemonRequest.this.mLogger.logPreparingRequest(string, uuid, DaemonRequest.this.mParameters);
if (!string.equals(SDKMessageEnum.GET_ACCESS_TOKEN.toString()) && !string.equals(SDKMessageEnum.IS_ENV_READY.toString())) {
String string2 = DaemonRequest.this.mContext.getSharedPreferences(SDKConstants.PREF_DAEMON_PACKAGE_NAME, 0).getString(SDKConstants.PARAM_DAEMON_PACKAGE_NAME, null);
if (string2 == null) {
return DaemonReceiver.createErrorResponse(new FacebookRequestError(-1, "DAEMON_REQUEST_EXECUTE_ASYNC_FAILED", "Unable to correctly create the request with a secure connection"), uuid);
}
intent.setPackage(string2);
}
intent.setAction(SDKConstants.REQUEST_ACTION);
Iterator<String> keys = DaemonRequest.this.mParameters.keys();
while (keys.hasNext()) {
String next = keys.next();
intent.putExtra(next, DaemonRequest.this.mParameters.getString(next));
}
CompletableFuture completableFuture = new CompletableFuture();
DaemonRequest.this.mRequestStore.put(uuid, completableFuture);
DaemonRequest.this.mContext.sendBroadcast(intent);
DaemonRequest.this.mLogger.logSentRequest(string, uuid, DaemonRequest.this.mParameters);
return (GraphResponse) completableFuture.get();
} catch (InterruptedException | ExecutionException | JSONException unused) {
return DaemonReceiver.createErrorResponse(new FacebookRequestError(-1, "DAEMON_REQUEST_EXECUTE_ASYNC_FAILED", "Unable to correctly create the request or obtain response"), uuid);
}
}
});
}
public static void executeAsync(Context context, @Nullable JSONObject jSONObject, Callback callback, SDKMessageEnum sDKMessageEnum) {
JSONObject put;
try {
if (jSONObject == null) {
put = new JSONObject().put("type", sDKMessageEnum.toString());
} else {
put = jSONObject.put("type", sDKMessageEnum.toString());
}
new DaemonRequest(context, put, callback).executeAsync();
} catch (InterruptedException | ExecutionException | JSONException unused) {
if (callback != null) {
callback.onCompleted(DaemonReceiver.createErrorResponse(new FacebookRequestError(-1, "DAEMON_REQUEST_EXECUTE_ASYNC_FAILED", "Unable to correctly create the request or obtain response"), (String) null));
}
}
}
public static GraphResponse executeAndWait(Context context, @Nullable JSONObject jSONObject, SDKMessageEnum sDKMessageEnum) {
JSONObject put;
try {
if (jSONObject == null) {
put = new JSONObject().put("type", sDKMessageEnum.toString());
} else {
put = jSONObject.put("type", sDKMessageEnum.toString());
}
return new DaemonRequest(context, put, null).executeAndWait();
} catch (InterruptedException | ExecutionException | JSONException unused) {
return DaemonReceiver.createErrorResponse(new FacebookRequestError(-1, "DAEMON_REQUEST_EXECUTE_ASYNC_FAILED", "Unable to correctly create the request or obtain response"), (String) null);
}
}
public static GraphResponse executeAndWait(Context context, @Nullable JSONObject jSONObject, SDKMessageEnum sDKMessageEnum, int i) {
JSONObject put;
try {
if (jSONObject == null) {
put = new JSONObject().put("type", sDKMessageEnum.toString());
} else {
put = jSONObject.put("type", sDKMessageEnum.toString());
}
return new DaemonRequest(context, put, null).executeAndWait(i);
} catch (InterruptedException | ExecutionException | TimeoutException | JSONException unused) {
return DaemonReceiver.createErrorResponse(new FacebookRequestError(-1, "DAEMON_REQUEST_EXECUTE_ASYNC_FAILED", "Unable to correctly create the request or obtain response"), (String) null);
}
}
public static void executeAsync(Context context, @Nullable JSONObject jSONObject, Callback callback, String str) {
JSONObject put;
try {
if (jSONObject == null) {
put = new JSONObject().put("type", str);
} else {
put = jSONObject.put("type", str);
}
new DaemonRequest(context, put, callback).executeAsync();
} catch (InterruptedException | ExecutionException | JSONException unused) {
if (callback != null) {
callback.onCompleted(DaemonReceiver.createErrorResponse(new FacebookRequestError(-1, "DAEMON_REQUEST_EXECUTE_ASYNC_FAILED", "Unable to correctly create the request or obtain response"), (String) null));
}
}
}
}

View File

@@ -0,0 +1,82 @@
package com.facebook.gamingservices.cloudgaming;
import android.content.Context;
import androidx.annotation.Nullable;
import com.facebook.GraphResponse;
import com.facebook.gamingservices.cloudgaming.DaemonRequest;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.gamingservices.cloudgaming.internal.SDKLogger;
import com.facebook.gamingservices.cloudgaming.internal.SDKMessageEnum;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class GameFeaturesLibrary {
public static void getPayload(Context context, JSONObject jSONObject, DaemonRequest.Callback callback) {
DaemonRequest.executeAsync(context, jSONObject, callback, SDKMessageEnum.GET_PAYLOAD);
}
public static void canCreateShortcut(Context context, JSONObject jSONObject, DaemonRequest.Callback callback) {
DaemonRequest.executeAsync(context, jSONObject, callback, SDKMessageEnum.CAN_CREATE_SHORTCUT);
}
public static void createShortcut(Context context, JSONObject jSONObject, DaemonRequest.Callback callback) {
DaemonRequest.executeAsync(context, jSONObject, callback, SDKMessageEnum.CREATE_SHORTCUT);
}
public static void postSessionScore(Context context, int i, DaemonRequest.Callback callback) {
try {
DaemonRequest.executeAsync(context, new JSONObject().put("score", i), callback, SDKMessageEnum.POST_SESSION_SCORE);
} catch (JSONException e) {
SDKLogger.logInternalError(context, SDKMessageEnum.POST_SESSION_SCORE, e);
}
}
public static void postSessionScoreAsync(Context context, int i, DaemonRequest.Callback callback) {
try {
DaemonRequest.executeAsync(context, new JSONObject().put("score", i), callback, SDKMessageEnum.POST_SESSION_SCORE_ASYNC);
} catch (JSONException e) {
SDKLogger.logInternalError(context, SDKMessageEnum.POST_SESSION_SCORE_ASYNC, e);
}
}
public static void getTournamentAsync(Context context, DaemonRequest.Callback callback) {
DaemonRequest.executeAsync(context, (JSONObject) null, callback, SDKMessageEnum.GET_TOURNAMENT_ASYNC);
}
public static void createTournamentAsync(Context context, int i, @Nullable String str, @Nullable String str2, @Nullable String str3, @Nullable String str4, @Nullable Integer num, @Nullable JSONObject jSONObject, DaemonRequest.Callback callback) {
try {
DaemonRequest.executeAsync(context, new JSONObject().put(SDKConstants.PARAM_INITIAL_SCORE, i).put("title", str).put("image", str2).put(SDKConstants.PARAM_SORT_ORDER, str3).put(SDKConstants.PARAM_SCORE_FORMAT, str4).put(SDKConstants.PARAM_END_TIME, num).put("data", jSONObject), callback, SDKMessageEnum.TOURNAMENT_CREATE_ASYNC);
} catch (JSONException e) {
SDKLogger.logInternalError(context, SDKMessageEnum.TOURNAMENT_CREATE_ASYNC, e);
}
}
public static void shareTournamentAsync(Context context, @Nullable Integer num, @Nullable JSONObject jSONObject, DaemonRequest.Callback callback) {
try {
DaemonRequest.executeAsync(context, new JSONObject().put("score", num).put("data", jSONObject), callback, SDKMessageEnum.TOURNAMENT_SHARE_ASYNC);
} catch (JSONException e) {
SDKLogger.logInternalError(context, SDKMessageEnum.TOURNAMENT_SHARE_ASYNC, e);
}
}
public static void postTournamentScoreAsync(Context context, int i, DaemonRequest.Callback callback) throws JSONException {
DaemonRequest.executeAsync(context, new JSONObject().put("score", i), callback, SDKMessageEnum.TOURNAMENT_POST_SCORE_ASYNC);
}
public static void getTournamentsAsync(Context context, DaemonRequest.Callback callback) throws JSONException {
DaemonRequest.executeAsync(context, (JSONObject) null, callback, SDKMessageEnum.TOURNAMENT_GET_TOURNAMENTS_ASYNC);
}
public static void joinTournamentAsync(Context context, String str, DaemonRequest.Callback callback) throws JSONException {
DaemonRequest.executeAsync(context, new JSONObject().put(SDKConstants.PARAM_TOURNAMENT_ID, str), callback, SDKMessageEnum.TOURNAMENT_JOIN_ASYNC);
}
public static void performHapticFeedback(Context context) {
DaemonRequest.executeAsync(context, (JSONObject) null, new DaemonRequest.Callback() { // from class: com.facebook.gamingservices.cloudgaming.GameFeaturesLibrary.1
@Override // com.facebook.gamingservices.cloudgaming.DaemonRequest.Callback
public void onCompleted(GraphResponse graphResponse) {
}
}, SDKMessageEnum.PERFORM_HAPTIC_FEEDBACK_ASYNC);
}
}

View File

@@ -0,0 +1,44 @@
package com.facebook.gamingservices.cloudgaming;
import android.content.Context;
import com.facebook.gamingservices.cloudgaming.DaemonRequest;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.gamingservices.cloudgaming.internal.SDKLogger;
import com.facebook.gamingservices.cloudgaming.internal.SDKMessageEnum;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class InAppAdLibrary {
public static void loadRewardedVideo(Context context, String str, DaemonRequest.Callback callback) {
try {
DaemonRequest.executeAsync(context, new JSONObject().put(SDKConstants.PARAM_PLACEMENT_ID, str), callback, SDKMessageEnum.LOAD_REWARDED_VIDEO);
} catch (JSONException e) {
SDKLogger.logInternalError(context, SDKMessageEnum.LOAD_REWARDED_VIDEO, e);
}
}
public static void loadInterstitialAd(Context context, String str, DaemonRequest.Callback callback) {
try {
DaemonRequest.executeAsync(context, new JSONObject().put(SDKConstants.PARAM_PLACEMENT_ID, str), callback, SDKMessageEnum.LOAD_INTERSTITIAL_AD);
} catch (JSONException e) {
SDKLogger.logInternalError(context, SDKMessageEnum.LOAD_INTERSTITIAL_AD, e);
}
}
public static void showRewardedVideo(Context context, String str, DaemonRequest.Callback callback) {
try {
DaemonRequest.executeAsync(context, new JSONObject().put(SDKConstants.PARAM_PLACEMENT_ID, str), callback, SDKMessageEnum.SHOW_REWARDED_VIDEO);
} catch (JSONException e) {
SDKLogger.logInternalError(context, SDKMessageEnum.SHOW_REWARDED_VIDEO, e);
}
}
public static void showInterstitialAd(Context context, String str, DaemonRequest.Callback callback) {
try {
DaemonRequest.executeAsync(context, new JSONObject().put(SDKConstants.PARAM_PLACEMENT_ID, str), callback, SDKMessageEnum.SHOW_INTERSTITIAL_AD);
} catch (JSONException e) {
SDKLogger.logInternalError(context, SDKMessageEnum.SHOW_INTERSTITIAL_AD, e);
}
}
}

View File

@@ -0,0 +1,65 @@
package com.facebook.gamingservices.cloudgaming;
import android.content.Context;
import androidx.annotation.Nullable;
import com.facebook.gamingservices.cloudgaming.DaemonRequest;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.gamingservices.cloudgaming.internal.SDKLogger;
import com.facebook.gamingservices.cloudgaming.internal.SDKMessageEnum;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class InAppPurchaseLibrary {
public static void onReady(Context context, DaemonRequest.Callback callback) {
DaemonRequest.executeAsync(context, (JSONObject) null, callback, SDKMessageEnum.ON_READY);
}
public static void getCatalog(Context context, DaemonRequest.Callback callback) {
DaemonRequest.executeAsync(context, (JSONObject) null, callback, SDKMessageEnum.GET_CATALOG);
}
public static void getPurchases(Context context, DaemonRequest.Callback callback) {
DaemonRequest.executeAsync(context, (JSONObject) null, callback, SDKMessageEnum.GET_PURCHASES);
}
public static void purchase(Context context, String str, @Nullable String str2, DaemonRequest.Callback callback) {
try {
DaemonRequest.executeAsync(context, new JSONObject().put(SDKConstants.PARAM_PRODUCT_ID, str).put(SDKConstants.PARAM_DEVELOPER_PAYLOAD, str2), callback, SDKMessageEnum.PURCHASE);
} catch (JSONException e) {
SDKLogger.logInternalError(context, SDKMessageEnum.PURCHASE, e);
}
}
public static void consumePurchase(Context context, String str, DaemonRequest.Callback callback) {
try {
DaemonRequest.executeAsync(context, new JSONObject().put(SDKConstants.PARAM_PURCHASE_TOKEN, str), callback, SDKMessageEnum.CONSUME_PURCHASE);
} catch (JSONException e) {
SDKLogger.logInternalError(context, SDKMessageEnum.CONSUME_PURCHASE, e);
}
}
public static void getSubscribableCatalog(Context context, DaemonRequest.Callback callback) {
DaemonRequest.executeAsync(context, (JSONObject) null, callback, SDKMessageEnum.GET_SUBSCRIBABLE_CATALOG);
}
public static void purchaseSubscription(Context context, String str, DaemonRequest.Callback callback) {
try {
DaemonRequest.executeAsync(context, new JSONObject().put(SDKConstants.PARAM_PRODUCT_ID, str), callback, SDKMessageEnum.PURCHASE_SUBSCRIPTION);
} catch (JSONException e) {
SDKLogger.logInternalError(context, SDKMessageEnum.PURCHASE_SUBSCRIPTION, e);
}
}
public static void getSubscriptions(Context context, DaemonRequest.Callback callback) {
DaemonRequest.executeAsync(context, (JSONObject) null, callback, SDKMessageEnum.GET_SUBSCRIPTIONS);
}
public static void cancelSubscription(Context context, String str, DaemonRequest.Callback callback) {
try {
DaemonRequest.executeAsync(context, new JSONObject().put(SDKConstants.PARAM_PURCHASE_TOKEN, str), callback, SDKMessageEnum.CANCEL_SUBSCRIPTION);
} catch (JSONException e) {
SDKLogger.logInternalError(context, SDKMessageEnum.CANCEL_SUBSCRIPTION, e);
}
}
}

View File

@@ -0,0 +1,48 @@
package com.facebook.gamingservices.cloudgaming;
import android.os.Bundle;
import androidx.annotation.Nullable;
import com.facebook.AccessToken;
import com.facebook.FacebookException;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.HttpMethod;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
/* loaded from: classes2.dex */
class MediaUploadCallback implements GraphRequest.Callback {
private String body;
GraphRequest.Callback callback;
@Nullable
private String payload;
private int timeInterval;
private String title;
public MediaUploadCallback(String str, String str2, int i, @Nullable String str3, GraphRequest.Callback callback) {
this.title = str;
this.body = str2;
this.timeInterval = i;
this.payload = str3;
this.callback = callback;
}
@Override // com.facebook.GraphRequest.Callback
public void onCompleted(GraphResponse graphResponse) {
if (graphResponse.getError() != null) {
throw new FacebookException(graphResponse.getError().getErrorMessage());
}
String optString = graphResponse.getJSONObject().optString("id");
AccessToken currentAccessToken = AccessToken.getCurrentAccessToken();
Bundle bundle = new Bundle();
bundle.putString("title", this.title);
bundle.putString("body", this.body);
bundle.putInt(SDKConstants.PARAM_A2U_TIME_INTERVAL, this.timeInterval);
String str = this.payload;
if (str != null) {
bundle.putString(SDKConstants.PARAM_A2U_PAYLOAD, str);
}
bundle.putString(SDKConstants.PARAM_A2U_MEDIA_ID, optString);
new GraphRequest(currentAccessToken, SDKConstants.PARAM_A2U_GRAPH_PATH, bundle, HttpMethod.POST, this.callback).executeAsync();
}
}

View File

@@ -0,0 +1,18 @@
package com.facebook.gamingservices.cloudgaming;
import android.content.Context;
import androidx.annotation.Nullable;
import com.facebook.gamingservices.cloudgaming.DaemonRequest;
import com.facebook.gamingservices.cloudgaming.internal.SDKMessageEnum;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class PlayableAdsLibrary {
public static void openAppStore(Context context, @Nullable JSONObject jSONObject, DaemonRequest.Callback callback) {
DaemonRequest.executeAsync(context, jSONObject, callback, SDKMessageEnum.OPEN_APP_STORE);
}
public static void markGameLoaded(Context context, @Nullable JSONObject jSONObject, DaemonRequest.Callback callback) {
DaemonRequest.executeAsync(context, jSONObject, callback, SDKMessageEnum.MARK_GAME_LOADED);
}
}

View File

@@ -0,0 +1,21 @@
package com.facebook.gamingservices.cloudgaming.internal;
/* loaded from: classes2.dex */
public class SDKAnalyticsEvents {
public static final String EVENT_GAME_LOAD_COMPLETE = "cloud_games_load_complete";
public static final String EVENT_INTERNAL_ERROR = "cloud_games_internal_error";
public static final String EVENT_LOGIN_SUCCESS = "cloud_games_login_success";
public static final String EVENT_PREPARING_REQUEST = "cloud_games_preparing_request";
public static final String EVENT_SENDING_ERROR_RESPONSE = "cloud_games_sending_error_response";
public static final String EVENT_SENDING_SUCCESS_RESPONSE = "cloud_games_sending_success_response";
public static final String EVENT_SENT_REQUEST = "cloud_games_sent_request";
public static final String PARAMETER_APP_ID = "app_id";
public static final String PARAMETER_ERROR_CODE = "error_code";
public static final String PARAMETER_ERROR_MESSAGE = "error_message";
public static final String PARAMETER_ERROR_TYPE = "error_type";
public static final String PARAMETER_FUNCTION_TYPE = "function_type";
public static final String PARAMETER_PAYLOAD = "payload";
public static final String PARAMETER_REQUEST_ID = "request_id";
public static final String PARAMETER_SESSION_ID = "session_id";
public static final String PARAMETER_USER_ID = "user_id";
}

View File

@@ -0,0 +1,86 @@
package com.facebook.gamingservices.cloudgaming.internal;
/* loaded from: classes2.dex */
public class SDKConstants {
public static final String PARAM_A2U_BODY = "body";
public static final String PARAM_A2U_CAPTION = "A2U Image";
public static final String PARAM_A2U_GRAPH_PATH = "me/schedule_gaming_app_to_user_update";
public static final String PARAM_A2U_MEDIA_ID = "media_id";
public static final String PARAM_A2U_PAYLOAD = "payload:";
public static final String PARAM_A2U_RESPONSE_ID = "id";
public static final String PARAM_A2U_TIME_INTERVAL = "time_interval";
public static final String PARAM_A2U_TITLE = "title";
public static final String PARAM_ACCESS_TOKEN = "accessToken";
public static final String PARAM_ACCESS_TOKEN_SOURCE = "accessTokenSource";
public static final String PARAM_APP_ID = "appID";
public static final String PARAM_CONTEXT_CONTEXT_ID = "context_id";
public static final String PARAM_CONTEXT_FILTERS = "filters";
public static final String PARAM_CONTEXT_ID = "id";
public static final String PARAM_CONTEXT_MAX_SIZE = "maxSize";
public static final String PARAM_CONTEXT_MIN_SIZE = "minSize";
public static final String PARAM_CONTEXT_TOKEN = "contextToken";
public static final String PARAM_DAEMON_PACKAGE_NAME = "daemonPackageName";
public static final String PARAM_DATA = "data";
public static final String PARAM_DATA_ACCESS_EXPIRATION_TIME = "dataAccessExpirationTime";
public static final String PARAM_DEBUG_MESSAGE = "msg";
public static final String PARAM_DEBUG_MESSAGE_SEVERITY = "severity";
public static final String PARAM_DEBUG_MESSAGE_TAG = "tag";
public static final String PARAM_DEBUG_MESSAGE_TIMESTAMP = "timestamp";
public static final String PARAM_DECLINED_PERMISSIONS = "declinedPermissions";
public static final String PARAM_DEEP_LINK = "deepLink";
public static final String PARAM_DEEP_LINK_ID = "id";
public static final String PARAM_DEVELOPER_PAYLOAD = "developerPayload";
public static final String PARAM_END_TIME = "endTime";
public static final String PARAM_EXPIRATION_TIME = "expirationTime";
public static final String PARAM_EXPIRED_PERMISSIONS = "expiredPermissions";
public static final String PARAM_GAME_PACKAGE_NAME = "gamePackageName";
public static final String PARAM_GAME_REQUESTS_ACTION_TYPE = "actionType";
public static final String PARAM_GAME_REQUESTS_CTA = "cta";
public static final String PARAM_GAME_REQUESTS_DATA = "data";
public static final String PARAM_GAME_REQUESTS_MESSAGE = "message";
public static final String PARAM_GAME_REQUESTS_OPTIONS = "options";
public static final String PARAM_GAME_REQUESTS_TITLE = "title";
public static final String PARAM_GAME_REQUESTS_TO = "to";
public static final String PARAM_GRAPH_DOMAIN = "graphDomain";
public static final String PARAM_IMAGE = "image";
public static final String PARAM_INITIAL_SCORE = "initialScore";
public static final String PARAM_INTENT = "intent";
public static final String PARAM_KEY = "key";
public static final String PARAM_LAST_REFRESH_TIME = "lastRefreshTime";
public static final String PARAM_PAYLOAD = "payload";
public static final String PARAM_PERMISSIONS = "permissions";
public static final String PARAM_PLACEMENT_ID = "placementID";
public static final String PARAM_PRODUCT_ID = "productID";
public static final String PARAM_PURCHASE_TOKEN = "purchaseToken";
public static final String PARAM_SCORE = "score";
public static final String PARAM_SCORE_FORMAT = "scoreFormat";
public static final String PARAM_SESSION_ID = "sessionID";
public static final String PARAM_SORT_ORDER = "sortOrder";
public static final String PARAM_TEXT = "text";
public static final String PARAM_TITLE = "title";
public static final String PARAM_TOURNAMENTS = "INSTANT_TOURNAMENT";
public static final String PARAM_TOURNAMENTS_APP_ID = "app_id";
public static final String PARAM_TOURNAMENTS_DEEPLINK = "deeplink";
public static final String PARAM_TOURNAMENTS_END_TIME = "end_time";
public static final String PARAM_TOURNAMENTS_ID = "tournament_id";
public static final String PARAM_TOURNAMENTS_PAYLOAD = "tournament_payload";
public static final String PARAM_TOURNAMENTS_SCORE = "score";
public static final String PARAM_TOURNAMENTS_SCORE_FORMAT = "score_format";
public static final String PARAM_TOURNAMENTS_SORT_ORDER = "sort_order";
public static final String PARAM_TOURNAMENTS_TITLE = "tournament_title";
public static final String PARAM_TOURNAMENT_ID = "tournamentId";
public static final String PARAM_TYPE = "type";
public static final String PARAM_UPDATE_ACTION = "action";
public static final String PARAM_UPDATE_IMAGE = "image";
public static final String PARAM_UPDATE_TEMPLATE = "template";
public static final String PARAM_UPDATE_TEXT = "text";
public static final String PARAM_URL = "url";
public static final String PARAM_USER_ID = "userID";
public static final String PARAM_VALUE = "value";
public static final String PREF_DAEMON_PACKAGE_NAME = "com.facebook.gamingservices.cloudgaming:preferences";
public static final String RECEIVER_HANDLER = "com.facebook.gamingservices.DAEMON_RESPONSE_HANDLER";
public static final String RECEIVER_INTENT = "com.facebook.gamingservices.DAEMON_RESPONSE";
public static final String RECEIVER_PAYLOAD = "returnPayload";
public static final String REQUEST_ACTION = "com.facebook.gamingservices.DAEMON_REQUEST";
public static final String REQUEST_ID = "requestID";
}

View File

@@ -0,0 +1,128 @@
package com.facebook.gamingservices.cloudgaming.internal;
import android.content.Context;
import android.os.Bundle;
import androidx.annotation.Nullable;
import com.facebook.FacebookRequestError;
import com.facebook.appevents.InternalAppEventsLogger;
import java.util.concurrent.ConcurrentHashMap;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class SDKLogger {
private static SDKLogger instance;
private final InternalAppEventsLogger logger;
private String appID = null;
private String userID = null;
private String sessionID = null;
private ConcurrentHashMap<String, String> requestIDToFunctionTypeMap = new ConcurrentHashMap<>();
public void setAppID(String str) {
this.appID = str;
}
public void setSessionID(String str) {
this.sessionID = str;
}
public void setUserID(String str) {
this.userID = str;
}
private SDKLogger(Context context) {
this.logger = new InternalAppEventsLogger(context);
}
public static synchronized SDKLogger getInstance(Context context) {
SDKLogger sDKLogger;
synchronized (SDKLogger.class) {
try {
if (instance == null) {
instance = new SDKLogger(context);
}
sDKLogger = instance;
} catch (Throwable th) {
throw th;
}
}
return sDKLogger;
}
public static void logInternalError(Context context, SDKMessageEnum sDKMessageEnum, Exception exc) {
getInstance(context).logInternalError(sDKMessageEnum, exc);
}
public void logPreparingRequest(String str, String str2, JSONObject jSONObject) {
Bundle parametersWithRequestIDAndFunctionType = getParametersWithRequestIDAndFunctionType(str2, str);
parametersWithRequestIDAndFunctionType.putString("payload", jSONObject.toString());
this.logger.logEventImplicitly(SDKAnalyticsEvents.EVENT_PREPARING_REQUEST, parametersWithRequestIDAndFunctionType);
}
public void logSentRequest(String str, String str2, JSONObject jSONObject) {
Bundle parametersWithRequestIDAndFunctionType = getParametersWithRequestIDAndFunctionType(str2, str);
this.requestIDToFunctionTypeMap.put(str2, str);
parametersWithRequestIDAndFunctionType.putString("payload", jSONObject.toString());
this.logger.logEventImplicitly(SDKAnalyticsEvents.EVENT_SENT_REQUEST, parametersWithRequestIDAndFunctionType);
}
public void logSendingSuccessResponse(String str) {
this.logger.logEventImplicitly(SDKAnalyticsEvents.EVENT_SENDING_SUCCESS_RESPONSE, getParametersWithRequestIDAndFunctionType(str));
}
public void logSendingErrorResponse(FacebookRequestError facebookRequestError, @Nullable String str) {
Bundle parametersWithRequestIDAndFunctionType = getParametersWithRequestIDAndFunctionType(str);
parametersWithRequestIDAndFunctionType.putString("error_code", Integer.toString(facebookRequestError.getErrorCode()));
parametersWithRequestIDAndFunctionType.putString("error_type", facebookRequestError.getErrorType());
parametersWithRequestIDAndFunctionType.putString("error_message", facebookRequestError.getErrorMessage());
this.logger.logEventImplicitly(SDKAnalyticsEvents.EVENT_SENDING_ERROR_RESPONSE, parametersWithRequestIDAndFunctionType);
}
public void logLoginSuccess() {
this.logger.logEventImplicitly(SDKAnalyticsEvents.EVENT_LOGIN_SUCCESS, getInitParameters());
}
public void logGameLoadComplete() {
this.logger.logEventImplicitly(SDKAnalyticsEvents.EVENT_GAME_LOAD_COMPLETE, getInitParameters());
}
public void logInternalError(SDKMessageEnum sDKMessageEnum, Exception exc) {
Bundle initParameters = getInitParameters();
initParameters.putString(SDKAnalyticsEvents.PARAMETER_FUNCTION_TYPE, sDKMessageEnum.toString());
initParameters.putString("error_type", exc.getClass().getName());
initParameters.putString("error_message", exc.getMessage());
this.logger.logEventImplicitly(SDKAnalyticsEvents.EVENT_INTERNAL_ERROR, initParameters);
}
private Bundle getParametersWithRequestIDAndFunctionType(@Nullable String str) {
Bundle initParameters = getInitParameters();
if (str != null) {
String orDefault = this.requestIDToFunctionTypeMap.getOrDefault(str, null);
initParameters.putString("request_id", str);
if (orDefault != null) {
initParameters.putString(SDKAnalyticsEvents.PARAMETER_FUNCTION_TYPE, orDefault);
this.requestIDToFunctionTypeMap.remove(str);
}
}
return initParameters;
}
private Bundle getParametersWithRequestIDAndFunctionType(String str, String str2) {
Bundle initParameters = getInitParameters();
initParameters.putString("request_id", str);
initParameters.putString(SDKAnalyticsEvents.PARAMETER_FUNCTION_TYPE, str2);
return initParameters;
}
private Bundle getInitParameters() {
Bundle bundle = new Bundle();
String str = this.appID;
if (str != null) {
bundle.putString("app_id", str);
}
String str2 = this.sessionID;
if (str2 != null) {
bundle.putString(SDKAnalyticsEvents.PARAMETER_SESSION_ID, str2);
}
return bundle;
}
}

View File

@@ -0,0 +1,72 @@
package com.facebook.gamingservices.cloudgaming.internal;
import androidx.annotation.Nullable;
import com.ironsource.v8;
/* loaded from: classes2.dex */
public enum SDKMessageEnum {
OPEN_PLAY_STORE("openPlayStore"),
OPEN_APP_STORE("openAppStore"),
MARK_GAME_LOADED("markGameLoaded"),
GET_PLAYER_DATA("getPlayerData"),
SET_PLAYER_DATA("setPlayerData"),
GET_CATALOG("getCatalog"),
GET_PURCHASES("getPurchases"),
PURCHASE("purchase"),
CONSUME_PURCHASE("consumePurchase"),
ON_READY("onReady"),
GET_SUBSCRIBABLE_CATALOG("getSubscribableCatalog"),
PURCHASE_SUBSCRIPTION("purchaseSubscription"),
GET_SUBSCRIPTIONS("getSubscriptions"),
CANCEL_SUBSCRIPTION("cancelSubscription"),
LOAD_INTERSTITIAL_AD("loadInterstitialAd"),
LOAD_REWARDED_VIDEO("loadRewardedVideo"),
SHOW_INTERSTITIAL_AD("showInterstitialAd"),
SHOW_REWARDED_VIDEO(v8.g.h),
GET_ACCESS_TOKEN("getAccessToken"),
GET_CONTEXT_TOKEN("getContextToken"),
GET_PAYLOAD("getPayload"),
IS_ENV_READY("isEnvReady"),
SHARE("share"),
CAN_CREATE_SHORTCUT("canCreateShortcut"),
CREATE_SHORTCUT("createShortcut"),
OPEN_GAMING_SERVICES_DEEP_LINK("openGamingServicesDeepLink"),
OPEN_GAME_REQUESTS_DIALOG("openGameRequestsDialog"),
POST_SESSION_SCORE("postSessionScore"),
POST_SESSION_SCORE_ASYNC("postSessionScoreAsync"),
GET_TOURNAMENT_ASYNC("getTournamentAsync"),
TOURNAMENT_CREATE_ASYNC("tournamentCreateAsync"),
TOURNAMENT_SHARE_ASYNC("tournamentShareAsync"),
TOURNAMENT_POST_SCORE_ASYNC("tournamentPostScoreAsync"),
TOURNAMENT_GET_TOURNAMENTS_ASYNC("getTournaments"),
TOURNAMENT_JOIN_ASYNC("joinTournament"),
OPEN_LINK("openExternalLink"),
PERFORM_HAPTIC_FEEDBACK_ASYNC("performHapticFeedbackAsync"),
CONTEXT_SWITCH("contextSwitch"),
CONTEXT_CHOOSE("contextChoose"),
CONTEXT_CREATE("contextCreate"),
CONTEXT_GET_ID("contextGetID"),
DEBUG_PRINT("debugPrint"),
GET_COUNTRY_ISO("getCountryISO");
private final String mStringValue;
@Override // java.lang.Enum
public String toString() {
return this.mStringValue;
}
SDKMessageEnum(String str) {
this.mStringValue = str;
}
@Nullable
public static SDKMessageEnum fromString(String str) {
for (SDKMessageEnum sDKMessageEnum : values()) {
if (sDKMessageEnum.toString().equals(str)) {
return sDKMessageEnum;
}
}
return null;
}
}

View File

@@ -0,0 +1,42 @@
package com.facebook.gamingservices.cloudgaming.internal;
import androidx.annotation.Nullable;
/* loaded from: classes2.dex */
public enum SDKShareIntentEnum {
INVITE("INVITE"),
REQUEST("REQUEST"),
CHALLENGE("CHALLENGE"),
SHARE("SHARE");
private final String mStringValue;
@Override // java.lang.Enum
public String toString() {
return this.mStringValue;
}
SDKShareIntentEnum(String str) {
this.mStringValue = str;
}
@Nullable
public static String validate(String str) {
for (SDKShareIntentEnum sDKShareIntentEnum : values()) {
if (sDKShareIntentEnum.toString().equals(str)) {
return str;
}
}
return null;
}
@Nullable
public static SDKShareIntentEnum fromString(String str) {
for (SDKShareIntentEnum sDKShareIntentEnum : values()) {
if (sDKShareIntentEnum.toString().equals(str)) {
return sDKShareIntentEnum;
}
}
return null;
}
}

View File

@@ -0,0 +1,20 @@
package com.facebook.gamingservices.internal;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class DateFormatter {
public static final DateFormatter INSTANCE = new DateFormatter();
private DateFormatter() {
}
public final ZonedDateTime format$facebook_gamingservices_release(String isoDate) {
Intrinsics.checkNotNullParameter(isoDate, "isoDate");
DateTimeFormatter ofPattern = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssZ");
Intrinsics.checkNotNullExpressionValue(ofPattern, "ofPattern(\"yyyy-MM-dd'T'HH:mm:ssZ\")");
return ZonedDateTime.parse(isoDate, ofPattern);
}
}

View File

@@ -0,0 +1,51 @@
package com.facebook.gamingservices.internal;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import com.facebook.AccessToken;
import com.facebook.GraphRequest;
import com.facebook.GraphRequestAsyncTask;
import com.facebook.HttpMethod;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.crashshield.AutoHandleExceptions;
import com.facebook.share.internal.ShareConstants;
import java.io.File;
import java.io.FileNotFoundException;
import kotlin.jvm.internal.Intrinsics;
@AutoHandleExceptions
/* loaded from: classes2.dex */
public final class GamingMediaUploader {
public static final GamingMediaUploader INSTANCE = new GamingMediaUploader();
private static final String photoUploadEdge = "me/photos";
private GamingMediaUploader() {
}
public static final GraphRequestAsyncTask uploadToGamingServices(String str, Bitmap imageBitmap, Bundle bundle, GraphRequest.Callback callback) {
Intrinsics.checkNotNullParameter(imageBitmap, "imageBitmap");
return GraphRequest.Companion.newUploadPhotoRequest(AccessToken.Companion.getCurrentAccessToken(), photoUploadEdge, imageBitmap, str, bundle, callback).executeAsync();
}
public static final GraphRequestAsyncTask uploadToGamingServices(String str, File imageFile, Bundle bundle, GraphRequest.Callback callback) throws FileNotFoundException {
Intrinsics.checkNotNullParameter(imageFile, "imageFile");
return GraphRequest.Companion.newUploadPhotoRequest(AccessToken.Companion.getCurrentAccessToken(), photoUploadEdge, imageFile, str, bundle, callback).executeAsync();
}
public static final GraphRequestAsyncTask uploadToGamingServices(String str, Uri imageUri, Bundle bundle, GraphRequest.Callback callback) throws FileNotFoundException {
Intrinsics.checkNotNullParameter(imageUri, "imageUri");
if (Utility.isFileUri(imageUri) || Utility.isContentUri(imageUri)) {
return GraphRequest.Companion.newUploadPhotoRequest(AccessToken.Companion.getCurrentAccessToken(), photoUploadEdge, imageUri, str, bundle, callback).executeAsync();
}
Bundle bundle2 = new Bundle();
if (bundle != null) {
bundle2.putAll(bundle);
}
bundle2.putString("url", imageUri.toString());
if (str != null && str.length() != 0) {
bundle2.putString(ShareConstants.FEED_CAPTION_PARAM, str);
}
return new GraphRequest(AccessToken.Companion.getCurrentAccessToken(), photoUploadEdge, bundle2, HttpMethod.POST, callback, null, 32, null).executeAsync();
}
}

View File

@@ -0,0 +1,68 @@
package com.facebook.gamingservices.internal;
import android.net.Uri;
import android.os.Bundle;
import com.facebook.FacebookSdk;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class TournamentJoinDialogURIBuilder {
public static final TournamentJoinDialogURIBuilder INSTANCE = new TournamentJoinDialogURIBuilder();
private TournamentJoinDialogURIBuilder() {
}
private final Uri.Builder baseUriBuilder() {
Uri.Builder appendPath = new Uri.Builder().scheme("https").authority(FacebookSdk.getFacebookGamingDomain()).appendPath("dialog").appendPath("join_tournament");
Intrinsics.checkNotNullExpressionValue(appendPath, "Builder()\n .scheme(\"https\")\n .authority(FacebookSdk.getFacebookGamingDomain())\n .appendPath(\"dialog\")\n .appendPath(\"join_tournament\")");
return appendPath;
}
public static /* synthetic */ Uri uri$facebook_gamingservices_release$default(TournamentJoinDialogURIBuilder tournamentJoinDialogURIBuilder, String str, String str2, int i, Object obj) {
if ((i & 1) != 0) {
str = null;
}
if ((i & 2) != 0) {
str2 = null;
}
return tournamentJoinDialogURIBuilder.uri$facebook_gamingservices_release(str, str2);
}
public final Uri uri$facebook_gamingservices_release(String str, String str2) {
Uri.Builder baseUriBuilder = baseUriBuilder();
if (str != null) {
baseUriBuilder.appendQueryParameter(SDKConstants.PARAM_TOURNAMENTS_ID, str);
}
if (str2 != null) {
baseUriBuilder.appendQueryParameter("payload", str2);
}
Uri build = baseUriBuilder.build();
Intrinsics.checkNotNullExpressionValue(build, "builder.build()");
return build;
}
public static /* synthetic */ Bundle bundle$facebook_gamingservices_release$default(TournamentJoinDialogURIBuilder tournamentJoinDialogURIBuilder, String str, String str2, String str3, int i, Object obj) {
if ((i & 2) != 0) {
str2 = null;
}
if ((i & 4) != 0) {
str3 = null;
}
return tournamentJoinDialogURIBuilder.bundle$facebook_gamingservices_release(str, str2, str3);
}
public final Bundle bundle$facebook_gamingservices_release(String appID, String str, String str2) {
Intrinsics.checkNotNullParameter(appID, "appID");
Bundle bundle = new Bundle();
bundle.putString(SDKConstants.PARAM_TOURNAMENTS_DEEPLINK, SDKConstants.PARAM_TOURNAMENTS);
bundle.putString("app_id", appID);
if (str != null) {
bundle.putString(SDKConstants.PARAM_TOURNAMENTS_ID, str);
}
if (str2 != null) {
bundle.putString("payload", str2);
}
return bundle;
}
}

View File

@@ -0,0 +1,15 @@
package com.facebook.gamingservices.internal;
import java.util.Arrays;
/* loaded from: classes2.dex */
public enum TournamentScoreType {
NUMERIC,
TIME;
/* renamed from: values, reason: to resolve conflict with enum method */
public static TournamentScoreType[] valuesCustom() {
TournamentScoreType[] valuesCustom = values();
return (TournamentScoreType[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}

View File

@@ -0,0 +1,102 @@
package com.facebook.gamingservices.internal;
import android.net.Uri;
import android.os.Bundle;
import com.facebook.gamingservices.TournamentConfig;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import java.time.Instant;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class TournamentShareDialogURIBuilder {
public static final TournamentShareDialogURIBuilder INSTANCE = new TournamentShareDialogURIBuilder();
public static final String authority = "fb.gg";
public static final String me = "me";
public static final String scheme = "https";
public static final String tournament = "instant_tournament";
private TournamentShareDialogURIBuilder() {
}
public final Uri uriForUpdating$facebook_gamingservices_release(String tournamentID, Number score, String appID) {
Intrinsics.checkNotNullParameter(tournamentID, "tournamentID");
Intrinsics.checkNotNullParameter(score, "score");
Intrinsics.checkNotNullParameter(appID, "appID");
Uri build = new Uri.Builder().scheme("https").authority("fb.gg").appendPath(me).appendPath(tournament).appendPath(appID).appendQueryParameter(SDKConstants.PARAM_TOURNAMENTS_ID, tournamentID).appendQueryParameter("score", score.toString()).build();
Intrinsics.checkNotNullExpressionValue(build, "Builder()\n .scheme(scheme)\n .authority(authority)\n .appendPath(me)\n .appendPath(tournament)\n .appendPath(appID)\n .appendQueryParameter(SDKConstants.PARAM_TOURNAMENTS_ID, tournamentID)\n .appendQueryParameter(SDKConstants.PARAM_TOURNAMENTS_SCORE, score.toString())\n .build()");
return build;
}
public final Uri uriForCreating$facebook_gamingservices_release(TournamentConfig config, Number score, String appID) {
Intrinsics.checkNotNullParameter(config, "config");
Intrinsics.checkNotNullParameter(score, "score");
Intrinsics.checkNotNullParameter(appID, "appID");
Uri.Builder appendQueryParameter = new Uri.Builder().scheme("https").authority("fb.gg").appendPath(me).appendPath(tournament).appendPath(appID).appendQueryParameter("score", score.toString());
Instant endTime = config.getEndTime();
if (endTime != null) {
appendQueryParameter.appendQueryParameter(SDKConstants.PARAM_TOURNAMENTS_END_TIME, endTime.toString());
}
TournamentSortOrder sortOrder = config.getSortOrder();
if (sortOrder != null) {
appendQueryParameter.appendQueryParameter(SDKConstants.PARAM_TOURNAMENTS_SORT_ORDER, sortOrder.toString());
}
TournamentScoreType scoreType = config.getScoreType();
if (scoreType != null) {
appendQueryParameter.appendQueryParameter(SDKConstants.PARAM_TOURNAMENTS_SCORE_FORMAT, scoreType.toString());
}
String title = config.getTitle();
if (title != null) {
appendQueryParameter.appendQueryParameter(SDKConstants.PARAM_TOURNAMENTS_TITLE, title);
}
String payload = config.getPayload();
if (payload != null) {
appendQueryParameter.appendQueryParameter(SDKConstants.PARAM_TOURNAMENTS_PAYLOAD, payload);
}
Uri build = appendQueryParameter.build();
Intrinsics.checkNotNullExpressionValue(build, "builder.build()");
return build;
}
public final Bundle bundleForUpdating$facebook_gamingservices_release(String tournamentID, Number score, String appID) {
Intrinsics.checkNotNullParameter(tournamentID, "tournamentID");
Intrinsics.checkNotNullParameter(score, "score");
Intrinsics.checkNotNullParameter(appID, "appID");
Bundle bundle = new Bundle();
bundle.putString(SDKConstants.PARAM_TOURNAMENTS_DEEPLINK, SDKConstants.PARAM_TOURNAMENTS);
bundle.putString("app_id", appID);
bundle.putString("score", score.toString());
bundle.putString(SDKConstants.PARAM_TOURNAMENTS_ID, tournamentID);
return bundle;
}
public final Bundle bundleForCreating$facebook_gamingservices_release(TournamentConfig config, Number score, String appID) {
Intrinsics.checkNotNullParameter(config, "config");
Intrinsics.checkNotNullParameter(score, "score");
Intrinsics.checkNotNullParameter(appID, "appID");
Bundle bundle = new Bundle();
bundle.putString(SDKConstants.PARAM_TOURNAMENTS_DEEPLINK, SDKConstants.PARAM_TOURNAMENTS);
bundle.putString("app_id", appID);
bundle.putString("score", score.toString());
TournamentSortOrder sortOrder = config.getSortOrder();
if (sortOrder != null) {
bundle.putString(SDKConstants.PARAM_TOURNAMENTS_SORT_ORDER, sortOrder.toString());
}
TournamentScoreType scoreType = config.getScoreType();
if (scoreType != null) {
bundle.putString(SDKConstants.PARAM_TOURNAMENTS_SCORE_FORMAT, scoreType.toString());
}
String title = config.getTitle();
if (title != null) {
bundle.putString(SDKConstants.PARAM_TOURNAMENTS_TITLE, title);
}
String payload = config.getPayload();
if (payload != null) {
bundle.putString(SDKConstants.PARAM_TOURNAMENTS_PAYLOAD, payload);
}
Instant endTime = config.getEndTime();
if (endTime != null) {
bundle.putString(SDKConstants.PARAM_TOURNAMENTS_END_TIME, String.valueOf((int) endTime.getEpochSecond()));
}
return bundle;
}
}

View File

@@ -0,0 +1,30 @@
package com.facebook.gamingservices.internal;
import java.util.Arrays;
/* loaded from: classes2.dex */
public enum TournamentSortOrder {
LowerIsBetter("LOWER_IS_BETTER"),
HigherIsBetter("HIGHER_IS_BETTER");
private final String rawValue;
public final String getRawValue() {
return this.rawValue;
}
@Override // java.lang.Enum
public String toString() {
return this.rawValue;
}
TournamentSortOrder(String str) {
this.rawValue = str;
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static TournamentSortOrder[] valuesCustom() {
TournamentSortOrder[] valuesCustom = values();
return (TournamentSortOrder[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}

View File

@@ -0,0 +1,149 @@
package com.facebook.gamingservices.model;
import android.os.Parcel;
import android.os.Parcelable;
import com.facebook.share.model.ShareModel;
import com.facebook.share.model.ShareModelBuilder;
import java.util.Collections;
import java.util.List;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class ContextChooseContent implements ShareModel {
public static final CREATOR CREATOR = new CREATOR(null);
private final List<String> filters;
private final Integer maxSize;
private final Integer minSize;
public /* synthetic */ ContextChooseContent(Builder builder, DefaultConstructorMarker defaultConstructorMarker) {
this(builder);
}
@Override // android.os.Parcelable
public int describeContents() {
return 0;
}
public final Integer getMaxSize() {
return this.maxSize;
}
public final Integer getMinSize() {
return this.minSize;
}
private ContextChooseContent(Builder builder) {
this.filters = builder.getFilters$facebook_gamingservices_release();
this.maxSize = builder.getMaxSize$facebook_gamingservices_release();
this.minSize = builder.getMinSize$facebook_gamingservices_release();
}
public ContextChooseContent(Parcel parcel) {
Intrinsics.checkNotNullParameter(parcel, "parcel");
this.filters = parcel.createStringArrayList();
this.maxSize = Integer.valueOf(parcel.readInt());
this.minSize = Integer.valueOf(parcel.readInt());
}
public final List<String> getFilters() {
List<String> list = this.filters;
if (list == null) {
return null;
}
return Collections.unmodifiableList(list);
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel out, int i) {
Intrinsics.checkNotNullParameter(out, "out");
out.writeStringList(this.filters);
Integer num = this.maxSize;
out.writeInt(num == null ? 0 : num.intValue());
Integer num2 = this.minSize;
out.writeInt(num2 != null ? num2.intValue() : 0);
}
public static final class Builder implements ShareModelBuilder<ContextChooseContent, Builder> {
private List<String> filters;
private Integer maxSize;
private Integer minSize;
public final List<String> getFilters$facebook_gamingservices_release() {
return this.filters;
}
public final Integer getMaxSize$facebook_gamingservices_release() {
return this.maxSize;
}
public final Integer getMinSize$facebook_gamingservices_release() {
return this.minSize;
}
public final Builder setFilters(List<String> list) {
this.filters = list;
return this;
}
public final void setFilters$facebook_gamingservices_release(List<String> list) {
this.filters = list;
}
public final Builder setMaxSize(Integer num) {
this.maxSize = num;
return this;
}
public final void setMaxSize$facebook_gamingservices_release(Integer num) {
this.maxSize = num;
}
public final Builder setMinSize(Integer num) {
this.minSize = num;
return this;
}
public final void setMinSize$facebook_gamingservices_release(Integer num) {
this.minSize = num;
}
@Override // com.facebook.share.ShareBuilder
public ContextChooseContent build() {
return new ContextChooseContent(this, null);
}
@Override // com.facebook.share.model.ShareModelBuilder
public Builder readFrom(ContextChooseContent contextChooseContent) {
Builder minSize;
return (contextChooseContent == null || (minSize = setFilters(contextChooseContent.getFilters()).setMaxSize(contextChooseContent.getMaxSize()).setMinSize(contextChooseContent.getMinSize())) == null) ? this : minSize;
}
public final Builder readFrom(Parcel parcel) {
Intrinsics.checkNotNullParameter(parcel, "parcel");
return readFrom((ContextChooseContent) parcel.readParcelable(ContextChooseContent.class.getClassLoader()));
}
}
public static final class CREATOR implements Parcelable.Creator<ContextChooseContent> {
public /* synthetic */ CREATOR(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private CREATOR() {
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public ContextChooseContent createFromParcel(Parcel parcel) {
Intrinsics.checkNotNullParameter(parcel, "parcel");
return new ContextChooseContent(parcel);
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public ContextChooseContent[] newArray(int i) {
return new ContextChooseContent[i];
}
}
}

View File

@@ -0,0 +1,97 @@
package com.facebook.gamingservices.model;
import android.os.Parcel;
import android.os.Parcelable;
import com.facebook.share.model.ShareModel;
import com.facebook.share.model.ShareModelBuilder;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class ContextCreateContent implements ShareModel {
public static final CREATOR CREATOR = new CREATOR(null);
private final String suggestedPlayerID;
public /* synthetic */ ContextCreateContent(Builder builder, DefaultConstructorMarker defaultConstructorMarker) {
this(builder);
}
@Override // android.os.Parcelable
public int describeContents() {
return 0;
}
public final String getSuggestedPlayerID() {
return this.suggestedPlayerID;
}
private ContextCreateContent(Builder builder) {
this.suggestedPlayerID = builder.getSuggestedPlayerID$facebook_gamingservices_release();
}
public ContextCreateContent(Parcel parcel) {
Intrinsics.checkNotNullParameter(parcel, "parcel");
this.suggestedPlayerID = parcel.readString();
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel out, int i) {
Intrinsics.checkNotNullParameter(out, "out");
out.writeString(this.suggestedPlayerID);
}
public static final class Builder implements ShareModelBuilder<ContextCreateContent, Builder> {
private String suggestedPlayerID;
public final String getSuggestedPlayerID$facebook_gamingservices_release() {
return this.suggestedPlayerID;
}
public final Builder setSuggestedPlayerID(String str) {
this.suggestedPlayerID = str;
return this;
}
public final void setSuggestedPlayerID$facebook_gamingservices_release(String str) {
this.suggestedPlayerID = str;
}
@Override // com.facebook.share.ShareBuilder
public ContextCreateContent build() {
return new ContextCreateContent(this, null);
}
@Override // com.facebook.share.model.ShareModelBuilder
public Builder readFrom(ContextCreateContent contextCreateContent) {
Builder suggestedPlayerID;
return (contextCreateContent == null || (suggestedPlayerID = setSuggestedPlayerID(contextCreateContent.getSuggestedPlayerID())) == null) ? this : suggestedPlayerID;
}
public final Builder readFrom(Parcel parcel) {
Intrinsics.checkNotNullParameter(parcel, "parcel");
return readFrom((ContextCreateContent) parcel.readParcelable(ContextCreateContent.class.getClassLoader()));
}
}
public static final class CREATOR implements Parcelable.Creator<ContextCreateContent> {
public /* synthetic */ CREATOR(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private CREATOR() {
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public ContextCreateContent createFromParcel(Parcel parcel) {
Intrinsics.checkNotNullParameter(parcel, "parcel");
return new ContextCreateContent(parcel);
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public ContextCreateContent[] newArray(int i) {
return new ContextCreateContent[i];
}
}
}

View File

@@ -0,0 +1,97 @@
package com.facebook.gamingservices.model;
import android.os.Parcel;
import android.os.Parcelable;
import com.facebook.share.model.ShareModel;
import com.facebook.share.model.ShareModelBuilder;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class ContextSwitchContent implements ShareModel {
public static final CREATOR CREATOR = new CREATOR(null);
private final String contextID;
public /* synthetic */ ContextSwitchContent(Builder builder, DefaultConstructorMarker defaultConstructorMarker) {
this(builder);
}
@Override // android.os.Parcelable
public int describeContents() {
return 0;
}
public final String getContextID() {
return this.contextID;
}
private ContextSwitchContent(Builder builder) {
this.contextID = builder.getContextID$facebook_gamingservices_release();
}
public ContextSwitchContent(Parcel parcel) {
Intrinsics.checkNotNullParameter(parcel, "parcel");
this.contextID = parcel.readString();
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel out, int i) {
Intrinsics.checkNotNullParameter(out, "out");
out.writeString(this.contextID);
}
public static final class Builder implements ShareModelBuilder<ContextSwitchContent, Builder> {
private String contextID;
public final String getContextID$facebook_gamingservices_release() {
return this.contextID;
}
public final Builder setContextID(String str) {
this.contextID = str;
return this;
}
public final void setContextID$facebook_gamingservices_release(String str) {
this.contextID = str;
}
@Override // com.facebook.share.ShareBuilder
public ContextSwitchContent build() {
return new ContextSwitchContent(this, null);
}
@Override // com.facebook.share.model.ShareModelBuilder
public Builder readFrom(ContextSwitchContent contextSwitchContent) {
Builder contextID;
return (contextSwitchContent == null || (contextID = setContextID(contextSwitchContent.getContextID())) == null) ? this : contextID;
}
public final Builder readFrom(Parcel parcel) {
Intrinsics.checkNotNullParameter(parcel, "parcel");
return readFrom((ContextSwitchContent) parcel.readParcelable(ContextSwitchContent.class.getClassLoader()));
}
}
public static final class CREATOR implements Parcelable.Creator<ContextSwitchContent> {
public /* synthetic */ CREATOR(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private CREATOR() {
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public ContextSwitchContent createFromParcel(Parcel parcel) {
Intrinsics.checkNotNullParameter(parcel, "parcel");
return new ContextSwitchContent(parcel);
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public ContextSwitchContent[] newArray(int i) {
return new ContextSwitchContent[i];
}
}
}

View File

@@ -0,0 +1,159 @@
package com.facebook.gamingservices.model;
import android.graphics.Bitmap;
import android.util.Base64;
import com.facebook.gamingservices.GamingContext;
import java.io.ByteArrayOutputStream;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class CustomUpdateContent {
private final String contextTokenId;
private final CustomUpdateLocalizedText cta;
private final String data;
private final String image;
private final CustomUpdateMedia media;
private final CustomUpdateLocalizedText text;
public /* synthetic */ CustomUpdateContent(String str, CustomUpdateLocalizedText customUpdateLocalizedText, CustomUpdateLocalizedText customUpdateLocalizedText2, String str2, CustomUpdateMedia customUpdateMedia, String str3, DefaultConstructorMarker defaultConstructorMarker) {
this(str, customUpdateLocalizedText, customUpdateLocalizedText2, str2, customUpdateMedia, str3);
}
public final String getContextTokenId() {
return this.contextTokenId;
}
public final CustomUpdateLocalizedText getCta() {
return this.cta;
}
public final String getData() {
return this.data;
}
public final String getImage() {
return this.image;
}
public final CustomUpdateMedia getMedia() {
return this.media;
}
public final CustomUpdateLocalizedText getText() {
return this.text;
}
private CustomUpdateContent(String str, CustomUpdateLocalizedText customUpdateLocalizedText, CustomUpdateLocalizedText customUpdateLocalizedText2, String str2, CustomUpdateMedia customUpdateMedia, String str3) {
this.contextTokenId = str;
this.text = customUpdateLocalizedText;
this.cta = customUpdateLocalizedText2;
this.image = str2;
this.media = customUpdateMedia;
this.data = str3;
}
public /* synthetic */ CustomUpdateContent(String str, CustomUpdateLocalizedText customUpdateLocalizedText, CustomUpdateLocalizedText customUpdateLocalizedText2, String str2, CustomUpdateMedia customUpdateMedia, String str3, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(str, customUpdateLocalizedText, (i & 4) != 0 ? null : customUpdateLocalizedText2, (i & 8) != 0 ? null : str2, (i & 16) != 0 ? null : customUpdateMedia, (i & 32) != 0 ? null : str3);
}
public final JSONObject toGraphRequestContent() {
JSONObject jSONObject = new JSONObject();
jSONObject.put("context_token_id", this.contextTokenId);
jSONObject.put("text", this.text.toJSONObject().toString());
CustomUpdateLocalizedText customUpdateLocalizedText = this.cta;
if (customUpdateLocalizedText != null) {
jSONObject.put("cta", customUpdateLocalizedText.toJSONObject().toString());
}
String str = this.image;
if (str != null) {
jSONObject.put("image", str);
}
CustomUpdateMedia customUpdateMedia = this.media;
if (customUpdateMedia != null) {
jSONObject.put("media", customUpdateMedia.toJSONObject().toString());
}
String str2 = this.data;
if (str2 != null) {
jSONObject.put("data", str2);
}
return jSONObject;
}
public static final class Builder {
private final String contextTokenId;
private CustomUpdateLocalizedText cta;
private String data;
private final Bitmap image;
private final CustomUpdateMedia media;
private final CustomUpdateLocalizedText text;
public final CustomUpdateLocalizedText getCta() {
return this.cta;
}
public final String getData() {
return this.data;
}
public final Builder setCta(CustomUpdateLocalizedText cta) {
Intrinsics.checkNotNullParameter(cta, "cta");
this.cta = cta;
return this;
}
public final Builder setData(String data) {
Intrinsics.checkNotNullParameter(data, "data");
this.data = data;
return this;
}
private Builder(String str, CustomUpdateLocalizedText customUpdateLocalizedText, Bitmap bitmap, CustomUpdateMedia customUpdateMedia) {
this.contextTokenId = str;
this.text = customUpdateLocalizedText;
this.image = bitmap;
this.media = customUpdateMedia;
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public Builder(GamingContext contextToken, CustomUpdateLocalizedText text, Bitmap image) {
this(contextToken.getContextID(), text, image, null);
Intrinsics.checkNotNullParameter(contextToken, "contextToken");
Intrinsics.checkNotNullParameter(text, "text");
Intrinsics.checkNotNullParameter(image, "image");
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public Builder(GamingContext contextToken, CustomUpdateLocalizedText text, CustomUpdateMedia media) {
this(contextToken.getContextID(), text, null, media);
Intrinsics.checkNotNullParameter(contextToken, "contextToken");
Intrinsics.checkNotNullParameter(text, "text");
Intrinsics.checkNotNullParameter(media, "media");
}
public final CustomUpdateContent build() {
CustomUpdateMedia customUpdateMedia = this.media;
if (customUpdateMedia != null) {
if (!((customUpdateMedia.getGif() != null) ^ (this.media.getVideo() != null))) {
throw new IllegalArgumentException("Invalid CustomUpdateMedia, please set either gif or video");
}
}
String bitmapToBase64String = bitmapToBase64String(this.image);
String str = this.contextTokenId;
if (str == null) {
throw new IllegalArgumentException("parameter contextToken must not be null");
}
return new CustomUpdateContent(str, this.text, this.cta, bitmapToBase64String, this.media, this.data, null);
}
private final String bitmapToBase64String(Bitmap bitmap) {
if (bitmap == null) {
return null;
}
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
return Intrinsics.stringPlus("data:image/png;base64,", Base64.encodeToString(byteArrayOutputStream.toByteArray(), 2));
}
}
}

View File

@@ -0,0 +1,16 @@
package com.facebook.gamingservices.model;
/* loaded from: classes2.dex */
public final class CustomUpdateContentKt {
private static final String CONTEXT_TOKEN_KEY = "context_token_id";
private static final String CTA_KEY = "cta";
private static final String DATA_KEY = "data";
private static final String DEFAULT_KEY = "default";
private static final String GIF_KEY = "gif";
private static final String IMAGE_KEY = "image";
private static final String LOCALIZATIONS_KEY = "localizations";
private static final String MEDIA_KEY = "media";
private static final String TEXT_KEY = "text";
private static final String URL_KEY = "url";
private static final String VIDEO_KEY = "video";
}

View File

@@ -0,0 +1,93 @@
package com.facebook.gamingservices.model;
import com.mbridge.msdk.newreward.player.view.hybrid.util.MRAIDCommunicatorUtil;
import java.util.HashMap;
import java.util.Map;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class CustomUpdateLocalizedText {
/* renamed from: default, reason: not valid java name */
private final String f0default;
private final HashMap<String, String> localizations;
/* JADX WARN: Multi-variable type inference failed */
public static /* synthetic */ CustomUpdateLocalizedText copy$default(CustomUpdateLocalizedText customUpdateLocalizedText, String str, HashMap hashMap, int i, Object obj) {
if ((i & 1) != 0) {
str = customUpdateLocalizedText.f0default;
}
if ((i & 2) != 0) {
hashMap = customUpdateLocalizedText.localizations;
}
return customUpdateLocalizedText.copy(str, hashMap);
}
public final String component1() {
return this.f0default;
}
public final HashMap<String, String> component2() {
return this.localizations;
}
public final CustomUpdateLocalizedText copy(String str, HashMap<String, String> hashMap) {
Intrinsics.checkNotNullParameter(str, "default");
return new CustomUpdateLocalizedText(str, hashMap);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof CustomUpdateLocalizedText)) {
return false;
}
CustomUpdateLocalizedText customUpdateLocalizedText = (CustomUpdateLocalizedText) obj;
return Intrinsics.areEqual(this.f0default, customUpdateLocalizedText.f0default) && Intrinsics.areEqual(this.localizations, customUpdateLocalizedText.localizations);
}
public final String getDefault() {
return this.f0default;
}
public final HashMap<String, String> getLocalizations() {
return this.localizations;
}
public int hashCode() {
int hashCode = this.f0default.hashCode() * 31;
HashMap<String, String> hashMap = this.localizations;
return hashCode + (hashMap == null ? 0 : hashMap.hashCode());
}
public String toString() {
return "CustomUpdateLocalizedText(default=" + this.f0default + ", localizations=" + this.localizations + ')';
}
public CustomUpdateLocalizedText(String str, HashMap<String, String> hashMap) {
Intrinsics.checkNotNullParameter(str, "default");
this.f0default = str;
this.localizations = hashMap;
}
public /* synthetic */ CustomUpdateLocalizedText(String str, HashMap hashMap, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(str, (i & 2) != 0 ? null : hashMap);
}
public final JSONObject toJSONObject() {
JSONObject jSONObject = new JSONObject();
jSONObject.put(MRAIDCommunicatorUtil.STATES_DEFAULT, this.f0default);
HashMap<String, String> hashMap = this.localizations;
if (hashMap != null) {
JSONObject jSONObject2 = new JSONObject();
for (Map.Entry<String, String> entry : hashMap.entrySet()) {
jSONObject2.put(entry.getKey(), entry.getValue());
}
jSONObject.put("localizations", jSONObject2);
}
return jSONObject;
}
}

View File

@@ -0,0 +1,94 @@
package com.facebook.gamingservices.model;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class CustomUpdateMedia {
private final CustomUpdateMediaInfo gif;
private final CustomUpdateMediaInfo video;
/* JADX WARN: Multi-variable type inference failed */
public CustomUpdateMedia() {
this(null, 0 == true ? 1 : 0, 3, 0 == true ? 1 : 0);
}
public static /* synthetic */ CustomUpdateMedia copy$default(CustomUpdateMedia customUpdateMedia, CustomUpdateMediaInfo customUpdateMediaInfo, CustomUpdateMediaInfo customUpdateMediaInfo2, int i, Object obj) {
if ((i & 1) != 0) {
customUpdateMediaInfo = customUpdateMedia.gif;
}
if ((i & 2) != 0) {
customUpdateMediaInfo2 = customUpdateMedia.video;
}
return customUpdateMedia.copy(customUpdateMediaInfo, customUpdateMediaInfo2);
}
public final CustomUpdateMediaInfo component1() {
return this.gif;
}
public final CustomUpdateMediaInfo component2() {
return this.video;
}
public final CustomUpdateMedia copy(CustomUpdateMediaInfo customUpdateMediaInfo, CustomUpdateMediaInfo customUpdateMediaInfo2) {
return new CustomUpdateMedia(customUpdateMediaInfo, customUpdateMediaInfo2);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof CustomUpdateMedia)) {
return false;
}
CustomUpdateMedia customUpdateMedia = (CustomUpdateMedia) obj;
return Intrinsics.areEqual(this.gif, customUpdateMedia.gif) && Intrinsics.areEqual(this.video, customUpdateMedia.video);
}
public final CustomUpdateMediaInfo getGif() {
return this.gif;
}
public final CustomUpdateMediaInfo getVideo() {
return this.video;
}
public int hashCode() {
CustomUpdateMediaInfo customUpdateMediaInfo = this.gif;
int hashCode = (customUpdateMediaInfo == null ? 0 : customUpdateMediaInfo.hashCode()) * 31;
CustomUpdateMediaInfo customUpdateMediaInfo2 = this.video;
return hashCode + (customUpdateMediaInfo2 != null ? customUpdateMediaInfo2.hashCode() : 0);
}
public String toString() {
return "CustomUpdateMedia(gif=" + this.gif + ", video=" + this.video + ')';
}
public CustomUpdateMedia(CustomUpdateMediaInfo customUpdateMediaInfo, CustomUpdateMediaInfo customUpdateMediaInfo2) {
this.gif = customUpdateMediaInfo;
this.video = customUpdateMediaInfo2;
}
public /* synthetic */ CustomUpdateMedia(CustomUpdateMediaInfo customUpdateMediaInfo, CustomUpdateMediaInfo customUpdateMediaInfo2, int i, DefaultConstructorMarker defaultConstructorMarker) {
this((i & 1) != 0 ? null : customUpdateMediaInfo, (i & 2) != 0 ? null : customUpdateMediaInfo2);
}
public final JSONObject toJSONObject() {
JSONObject jSONObject = new JSONObject();
CustomUpdateMediaInfo customUpdateMediaInfo = this.gif;
if (customUpdateMediaInfo != null) {
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("url", customUpdateMediaInfo.getUrl());
jSONObject.put("gif", jSONObject2);
}
CustomUpdateMediaInfo customUpdateMediaInfo2 = this.video;
if (customUpdateMediaInfo2 != null) {
JSONObject jSONObject3 = new JSONObject();
jSONObject3.put("url", customUpdateMediaInfo2.getUrl());
jSONObject.put("video", jSONObject3);
}
return jSONObject;
}
}

View File

@@ -0,0 +1,48 @@
package com.facebook.gamingservices.model;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class CustomUpdateMediaInfo {
private final String url;
public static /* synthetic */ CustomUpdateMediaInfo copy$default(CustomUpdateMediaInfo customUpdateMediaInfo, String str, int i, Object obj) {
if ((i & 1) != 0) {
str = customUpdateMediaInfo.url;
}
return customUpdateMediaInfo.copy(str);
}
public final String component1() {
return this.url;
}
public final CustomUpdateMediaInfo copy(String url) {
Intrinsics.checkNotNullParameter(url, "url");
return new CustomUpdateMediaInfo(url);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
return (obj instanceof CustomUpdateMediaInfo) && Intrinsics.areEqual(this.url, ((CustomUpdateMediaInfo) obj).url);
}
public final String getUrl() {
return this.url;
}
public int hashCode() {
return this.url.hashCode();
}
public String toString() {
return "CustomUpdateMediaInfo(url=" + this.url + ')';
}
public CustomUpdateMediaInfo(String url) {
Intrinsics.checkNotNullParameter(url, "url");
this.url = url;
}
}