package com.facebook.internal; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import com.facebook.FacebookActivity; import com.facebook.FacebookException; import com.facebook.FacebookSdk; import com.facebook.internal.FetchedAppSettings; import com.facebook.internal.NativeProtocol; /* loaded from: classes.dex */ public class DialogPresenter { public interface ParameterProvider { Bundle a(); Bundle b(); } public static void a(AppCall appCall) { b(appCall, new FacebookException("Unable to show the provided content via the web or the installed version of the Facebook app. Some dialogs are only supported starting API 14.")); } public static void b(AppCall appCall, FacebookException facebookException) { a(appCall, facebookException); } public static NativeProtocol.ProtocolVersionQueryResult b(DialogFeature dialogFeature) { String c = FacebookSdk.c(); String action = dialogFeature.getAction(); return NativeProtocol.a(action, a(c, action, dialogFeature)); } public static void a(AppCall appCall, Activity activity) { activity.startActivityForResult(appCall.c(), appCall.b()); appCall.d(); } public static void a(AppCall appCall, FragmentWrapper fragmentWrapper) { fragmentWrapper.a(appCall.c(), appCall.b()); throw null; } public static boolean a(DialogFeature dialogFeature) { return b(dialogFeature).a() != -1; } public static void a(AppCall appCall, FacebookException facebookException) { if (facebookException == null) { return; } Validate.c(FacebookSdk.b()); Intent intent = new Intent(); intent.setClass(FacebookSdk.b(), FacebookActivity.class); intent.setAction(FacebookActivity.b); NativeProtocol.a(intent, appCall.a().toString(), (String) null, NativeProtocol.e(), NativeProtocol.a(facebookException)); appCall.a(intent); } public static void a(AppCall appCall, String str, Bundle bundle) { Validate.c(FacebookSdk.b()); Validate.d(FacebookSdk.b()); Bundle bundle2 = new Bundle(); bundle2.putString("action", str); bundle2.putBundle("params", bundle); Intent intent = new Intent(); NativeProtocol.a(intent, appCall.a().toString(), str, NativeProtocol.e(), bundle2); intent.setClass(FacebookSdk.b(), FacebookActivity.class); intent.setAction("FacebookDialogFragment"); appCall.a(intent); } public static void a(AppCall appCall, ParameterProvider parameterProvider, DialogFeature dialogFeature) { Bundle b; Context b2 = FacebookSdk.b(); String action = dialogFeature.getAction(); NativeProtocol.ProtocolVersionQueryResult b3 = b(dialogFeature); int a = b3.a(); if (a != -1) { if (NativeProtocol.b(a)) { b = parameterProvider.a(); } else { b = parameterProvider.b(); } if (b == null) { b = new Bundle(); } Intent a2 = NativeProtocol.a(b2, appCall.a().toString(), action, b3, b); if (a2 != null) { appCall.a(a2); return; } throw new FacebookException("Unable to create Intent; this likely means theFacebook app is not installed."); } throw new FacebookException("Cannot present this dialog. This likely means that the Facebook app is not installed."); } private static int[] a(String str, String str2, DialogFeature dialogFeature) { FetchedAppSettings.DialogFeatureConfig a = FetchedAppSettings.a(str, str2, dialogFeature.name()); return a != null ? a.c() : new int[]{dialogFeature.getMinVersion()}; } }