- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
277 lines
13 KiB
Java
277 lines
13 KiB
Java
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;
|
|
}
|
|
}
|
|
}
|