package com.facebook.internal; import android.app.Activity; import android.content.ActivityNotFoundException; import android.net.Uri; import android.os.Bundle; import androidx.browser.customtabs.CustomTabsIntent; import com.facebook.FacebookSdk; import com.facebook.internal.instrument.crashshield.CrashShieldHandler; import com.facebook.login.CustomTabPrefetchHelper; import java.util.ArrayList; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; /* loaded from: classes2.dex */ public class CustomTab { public static final Companion Companion = new Companion(null); private Uri uri; public static Uri getURIForAction(String str, Bundle bundle) { if (CrashShieldHandler.isObjectCrashing(CustomTab.class)) { return null; } try { return Companion.getURIForAction(str, bundle); } catch (Throwable th) { CrashShieldHandler.handleThrowable(th, CustomTab.class); return null; } } public CustomTab(String action, Bundle bundle) { Uri uRIForAction; Intrinsics.checkNotNullParameter(action, "action"); bundle = bundle == null ? new Bundle() : bundle; GamingAction[] valuesCustom = GamingAction.valuesCustom(); ArrayList arrayList = new ArrayList(valuesCustom.length); for (GamingAction gamingAction : valuesCustom) { arrayList.add(gamingAction.getRawValue()); } if (arrayList.contains(action)) { Utility utility = Utility.INSTANCE; uRIForAction = Utility.buildUri(ServerProtocol.getGamingDialogAuthority(), Intrinsics.stringPlus("/dialog/", action), bundle); } else { uRIForAction = Companion.getURIForAction(action, bundle); } this.uri = uRIForAction; } public final Uri getUri() { if (CrashShieldHandler.isObjectCrashing(this)) { return null; } try { return this.uri; } catch (Throwable th) { CrashShieldHandler.handleThrowable(th, this); return null; } } public final void setUri(Uri uri) { if (CrashShieldHandler.isObjectCrashing(this)) { return; } try { Intrinsics.checkNotNullParameter(uri, ""); this.uri = uri; } catch (Throwable th) { CrashShieldHandler.handleThrowable(th, this); } } public final boolean openCustomTab(Activity activity, String str) { if (CrashShieldHandler.isObjectCrashing(this)) { return false; } try { Intrinsics.checkNotNullParameter(activity, "activity"); CustomTabsIntent build = new CustomTabsIntent.Builder(CustomTabPrefetchHelper.Companion.getPreparedSessionOnce()).build(); build.intent.setPackage(str); try { build.launchUrl(activity, this.uri); return true; } catch (ActivityNotFoundException unused) { return false; } } catch (Throwable th) { CrashShieldHandler.handleThrowable(th, this); return false; } } public static final class Companion { public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } private Companion() { } public Uri getURIForAction(String action, Bundle bundle) { Intrinsics.checkNotNullParameter(action, "action"); Utility utility = Utility.INSTANCE; return Utility.buildUri(ServerProtocol.getDialogAuthority(), FacebookSdk.getGraphApiVersion() + "/dialog/" + action, bundle); } } }