package com.discord.widgets.guildscheduledevent; import android.content.Context; import android.os.Bundle; import android.view.View; import androidx.core.os.BundleKt; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentKt; import androidx.fragment.app.FragmentManager; import c.d.b.a.a; import c0.g; import c0.o; import c0.z.d.m; import com.discord.R; import com.discord.app.AppBottomSheet; import com.discord.databinding.WidgetEndStageBottomSheetBinding; import com.discord.utilities.rx.ObservableExtensionsKt; import com.discord.utilities.viewbinding.FragmentViewBindingDelegate; import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt; import com.discord.views.ScreenTitleView; import com.google.android.material.button.MaterialButton; import kotlin.Lazy; import kotlin.Unit; import kotlin.jvm.functions.Function0; import kotlin.jvm.functions.Function1; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.reflect.KProperty; /* compiled from: WidgetEndGuildScheduledEventBottomSheet.kt */ public final class WidgetEndGuildScheduledEventBottomSheet extends AppBottomSheet { public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.Z(WidgetEndGuildScheduledEventBottomSheet.class, "binding", "getBinding()Lcom/discord/databinding/WidgetEndStageBottomSheetBinding;", 0)}; public static final Companion Companion = new Companion(null); private static final String EXTRA_REQUEST_KEY = "INTENT_EXTRA_REQUEST_KEY"; private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetEndGuildScheduledEventBottomSheet$binding$2.INSTANCE, null, 2, null); private final Lazy guildScheduledEventId$delegate = g.lazy(new WidgetEndGuildScheduledEventBottomSheet$guildScheduledEventId$2(this)); private final Lazy requestKey$delegate = g.lazy(new WidgetEndGuildScheduledEventBottomSheet$requestKey$2(this)); /* compiled from: WidgetEndGuildScheduledEventBottomSheet.kt */ public static final class Companion { private Companion() { } public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } public final void registerForResult(Fragment fragment, String str, Function0 function0) { m.checkNotNullParameter(fragment, "fragment"); m.checkNotNullParameter(str, "requestKey"); m.checkNotNullParameter(function0, "onActionTaken"); FragmentKt.setFragmentResultListener(fragment, str, new WidgetEndGuildScheduledEventBottomSheet$Companion$registerForResult$1(str, function0)); } public final void show(FragmentManager fragmentManager, String str, long j) { m.checkNotNullParameter(fragmentManager, "fragmentManager"); m.checkNotNullParameter(str, "requestKey"); WidgetEndGuildScheduledEventBottomSheet widgetEndGuildScheduledEventBottomSheet = new WidgetEndGuildScheduledEventBottomSheet(); widgetEndGuildScheduledEventBottomSheet.setArguments(BundleKt.bundleOf(o.to("com.discord.intent.extra.EXTRA_GUILD_SCHEDULED_EVENT_ID", Long.valueOf(j)), o.to(WidgetEndGuildScheduledEventBottomSheet.EXTRA_REQUEST_KEY, str))); widgetEndGuildScheduledEventBottomSheet.show(fragmentManager, WidgetEndGuildScheduledEventBottomSheet.class.getSimpleName()); } } public WidgetEndGuildScheduledEventBottomSheet() { super(false, 1, null); } public static final /* synthetic */ void access$callOnActionTaken(WidgetEndGuildScheduledEventBottomSheet widgetEndGuildScheduledEventBottomSheet) { widgetEndGuildScheduledEventBottomSheet.callOnActionTaken(); } public static final /* synthetic */ void access$onConfirmEnd(WidgetEndGuildScheduledEventBottomSheet widgetEndGuildScheduledEventBottomSheet) { widgetEndGuildScheduledEventBottomSheet.onConfirmEnd(); } private final void callOnActionTaken() { String requestKey = getRequestKey(); m.checkNotNullExpressionValue(requestKey, "requestKey"); FragmentKt.setFragmentResult(this, requestKey, new Bundle()); } private final WidgetEndStageBottomSheetBinding getBinding() { return (WidgetEndStageBottomSheetBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]); } private final long getGuildScheduledEventId() { return ((Number) this.guildScheduledEventId$delegate.getValue()).longValue(); } private final String getRequestKey() { return (String) this.requestKey$delegate.getValue(); } private final void onConfirmEnd() { ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.restSubscribeOn$default(GuildScheduledEventAPI.INSTANCE.endEvent(getGuildScheduledEventId()), false, 1, null), WidgetEndGuildScheduledEventBottomSheet.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, WidgetEndGuildScheduledEventBottomSheet$onConfirmEnd$1.INSTANCE, 62, (Object) null); } @Override // com.discord.app.AppBottomSheet public int getContentViewResId() { return R.layout.widget_end_stage_bottom_sheet; } @Override // com.discord.app.AppBottomSheet, androidx.fragment.app.Fragment public void onViewCreated(View view, Bundle bundle) { m.checkNotNullParameter(view, "view"); super.onViewCreated(view, bundle); ScreenTitleView screenTitleView = getBinding().d; String string = requireContext().getString(R.string.guild_event_end_prompt_title); m.checkNotNullExpressionValue(string, "requireContext().getStriā€¦d_event_end_prompt_title)"); screenTitleView.setTitle(string); getBinding().d.setSubtitle(null); MaterialButton materialButton = getBinding().b; m.checkNotNullExpressionValue(materialButton, "binding.cancel"); materialButton.setText(requireContext().getString(R.string.guild_event_end_prompt_cancel)); MaterialButton materialButton2 = getBinding().f2228c; m.checkNotNullExpressionValue(materialButton2, "binding.confirm"); materialButton2.setText(requireContext().getString(R.string.guild_event_end_prompt_confirm)); getBinding().b.setOnClickListener(new WidgetEndGuildScheduledEventBottomSheet$onViewCreated$1(this)); getBinding().f2228c.setOnClickListener(new WidgetEndGuildScheduledEventBottomSheet$onViewCreated$2(this)); } }