2021-08-03 07:33:18 +00:00
|
|
|
package com.discord.widgets.guilds.leave;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import androidx.fragment.app.Fragment;
|
|
|
|
import androidx.fragment.app.FragmentManager;
|
|
|
|
import androidx.fragment.app.FragmentViewModelLazyKt;
|
2021-12-17 21:59:34 +00:00
|
|
|
import b.a.d.f0;
|
|
|
|
import b.a.d.h0;
|
|
|
|
import b.a.k.b;
|
|
|
|
import b.d.b.a.a;
|
2021-08-09 22:51:56 +00:00
|
|
|
import com.discord.R;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.discord.app.AppDialog;
|
|
|
|
import com.discord.databinding.LeaveGuildDialogBinding;
|
|
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
|
|
|
import com.discord.widgets.guilds.leave.LeaveGuildDialogViewModel;
|
2021-11-02 06:38:17 +00:00
|
|
|
import d0.z.d.a0;
|
|
|
|
import d0.z.d.m;
|
2021-08-03 07:33:18 +00:00
|
|
|
import kotlin.Lazy;
|
|
|
|
import kotlin.jvm.functions.Function0;
|
|
|
|
import kotlin.jvm.functions.Function1;
|
|
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
|
|
import kotlin.reflect.KProperty;
|
|
|
|
/* compiled from: WidgetLeaveGuildDialog.kt */
|
|
|
|
public final class WidgetLeaveGuildDialog extends AppDialog {
|
2021-11-05 06:48:17 +00:00
|
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.b0(WidgetLeaveGuildDialog.class, "binding", "getBinding()Lcom/discord/databinding/LeaveGuildDialogBinding;", 0)};
|
2021-08-03 07:33:18 +00:00
|
|
|
public static final Companion Companion = new Companion(null);
|
|
|
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetLeaveGuildDialog$binding$2.INSTANCE, null, 2, null);
|
|
|
|
private final Lazy viewModel$delegate;
|
|
|
|
|
|
|
|
/* compiled from: WidgetLeaveGuildDialog.kt */
|
|
|
|
public static final class Companion {
|
|
|
|
private Companion() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this();
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void show(FragmentManager fragmentManager, long j) {
|
|
|
|
m.checkNotNullParameter(fragmentManager, "fragmentManager");
|
|
|
|
Bundle bundle = new Bundle();
|
|
|
|
bundle.putLong("com.discord.intent.extra.EXTRA_GUILD_ID", j);
|
|
|
|
WidgetLeaveGuildDialog widgetLeaveGuildDialog = new WidgetLeaveGuildDialog();
|
|
|
|
widgetLeaveGuildDialog.setArguments(bundle);
|
|
|
|
widgetLeaveGuildDialog.show(fragmentManager, WidgetLeaveGuildDialog.class.getSimpleName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public WidgetLeaveGuildDialog() {
|
2021-08-09 22:51:56 +00:00
|
|
|
super(R.layout.leave_guild_dialog);
|
2021-08-03 07:33:18 +00:00
|
|
|
WidgetLeaveGuildDialog$viewModel$2 widgetLeaveGuildDialog$viewModel$2 = new WidgetLeaveGuildDialog$viewModel$2(this);
|
2021-08-13 06:23:11 +00:00
|
|
|
f0 f0Var = new f0(this);
|
|
|
|
this.viewModel$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(LeaveGuildDialogViewModel.class), new WidgetLeaveGuildDialog$appViewModels$$inlined$viewModels$1(f0Var), new h0(widgetLeaveGuildDialog$viewModel$2));
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$configureUI(WidgetLeaveGuildDialog widgetLeaveGuildDialog, LeaveGuildDialogViewModel.ViewState viewState) {
|
|
|
|
widgetLeaveGuildDialog.configureUI(viewState);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ Bundle access$getArgumentsOrDefault$p(WidgetLeaveGuildDialog widgetLeaveGuildDialog) {
|
|
|
|
return widgetLeaveGuildDialog.getArgumentsOrDefault();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ LeaveGuildDialogViewModel access$getViewModel$p(WidgetLeaveGuildDialog widgetLeaveGuildDialog) {
|
|
|
|
return widgetLeaveGuildDialog.getViewModel();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$handleEvent(WidgetLeaveGuildDialog widgetLeaveGuildDialog, LeaveGuildDialogViewModel.Event event) {
|
|
|
|
widgetLeaveGuildDialog.handleEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void configureUI(LeaveGuildDialogViewModel.ViewState viewState) {
|
|
|
|
if (viewState instanceof LeaveGuildDialogViewModel.ViewState.Valid) {
|
|
|
|
TextView textView = getBinding().e;
|
|
|
|
m.checkNotNullExpressionValue(textView, "binding.leaveGuildDialogHeader");
|
|
|
|
LeaveGuildDialogViewModel.ViewState.Valid valid = (LeaveGuildDialogViewModel.ViewState.Valid) viewState;
|
2021-08-09 22:51:56 +00:00
|
|
|
b.n(textView, R.string.leave_server_title, new Object[]{valid.getGuild().getName()}, null, 4);
|
2021-08-03 07:33:18 +00:00
|
|
|
TextView textView2 = getBinding().d;
|
|
|
|
m.checkNotNullExpressionValue(textView2, "binding.leaveGuildDialogBody");
|
2021-08-09 22:51:56 +00:00
|
|
|
b.n(textView2, valid.getGuild().isHub() ? R.string.leave_hub_body : R.string.leave_server_body_mobile, new Object[]{valid.getGuild().getName()}, null, 4);
|
2021-12-17 21:59:34 +00:00
|
|
|
getBinding().c.setText(getString(valid.getGuild().isHub() ? R.string.leave_hub : R.string.leave_server));
|
|
|
|
getBinding().c.setIsLoading(valid.isLoading());
|
2021-08-03 07:33:18 +00:00
|
|
|
} else if (m.areEqual(viewState, LeaveGuildDialogViewModel.ViewState.Invalid.INSTANCE)) {
|
|
|
|
dismiss();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private final LeaveGuildDialogBinding getBinding() {
|
|
|
|
return (LeaveGuildDialogBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final LeaveGuildDialogViewModel getViewModel() {
|
|
|
|
return (LeaveGuildDialogViewModel) this.viewModel$delegate.getValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void handleEvent(LeaveGuildDialogViewModel.Event event) {
|
|
|
|
if (m.areEqual(event, LeaveGuildDialogViewModel.Event.Dismiss.INSTANCE)) {
|
|
|
|
dismiss();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.app.AppDialog, androidx.fragment.app.Fragment
|
|
|
|
public void onResume() {
|
|
|
|
super.onResume();
|
|
|
|
requireDialog().setCanceledOnTouchOutside(true);
|
2021-12-17 21:59:34 +00:00
|
|
|
getBinding().c.setOnClickListener(new WidgetLeaveGuildDialog$onResume$1(this));
|
2021-12-20 07:27:17 +00:00
|
|
|
getBinding().f2101b.setOnClickListener(new WidgetLeaveGuildDialog$onResume$2(this));
|
2021-08-27 06:37:59 +00:00
|
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle$default(getViewModel().observeViewState(), this, null, 2, null), WidgetLeaveGuildDialog.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetLeaveGuildDialog$onResume$3(this), 62, (Object) null);
|
|
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle$default(getViewModel().observeEvents(), this, null, 2, null), WidgetLeaveGuildDialog.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetLeaveGuildDialog$onResume$4(this), 62, (Object) null);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|