166 lines
8.0 KiB
Java
166 lines
8.0 KiB
Java
|
package com.discord.widgets.servers;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.os.Bundle;
|
||
|
import android.widget.LinearLayout;
|
||
|
import android.widget.TextView;
|
||
|
import androidx.fragment.app.Fragment;
|
||
|
import androidx.fragment.app.FragmentManager;
|
||
|
import c.a.k.b;
|
||
|
import c.d.b.a.a;
|
||
|
import com.discord.app.AppDialog;
|
||
|
import com.discord.databinding.WidgetServerDeleteDialogBinding;
|
||
|
import com.discord.models.experiments.domain.Experiment;
|
||
|
import com.discord.models.guild.Guild;
|
||
|
import com.discord.models.user.MeUser;
|
||
|
import com.discord.stores.StoreStream;
|
||
|
import com.discord.stores.StoreUser;
|
||
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
||
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
||
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
||
|
import com.discord.widgets.guild_delete_feedback.GuildDeleteFeedbackSheetNavigator;
|
||
|
import com.google.android.material.button.MaterialButton;
|
||
|
import d0.z.d.m;
|
||
|
import kotlin.jvm.functions.Function0;
|
||
|
import kotlin.jvm.functions.Function1;
|
||
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
||
|
import kotlin.reflect.KProperty;
|
||
|
import rx.Observable;
|
||
|
import rx.functions.Func2;
|
||
|
/* compiled from: WidgetServerDeleteDialog.kt */
|
||
|
public final class WidgetServerDeleteDialog extends AppDialog {
|
||
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.V(WidgetServerDeleteDialog.class, "binding", "getBinding()Lcom/discord/databinding/WidgetServerDeleteDialogBinding;", 0)};
|
||
|
public static final Companion Companion = new Companion(null);
|
||
|
private static final String INTENT_GUILD_ID = "INTENT_GUILD_ID";
|
||
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetServerDeleteDialog$binding$2.INSTANCE, null, 2, null);
|
||
|
|
||
|
/* compiled from: WidgetServerDeleteDialog.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");
|
||
|
WidgetServerDeleteDialog widgetServerDeleteDialog = new WidgetServerDeleteDialog();
|
||
|
Bundle bundle = new Bundle();
|
||
|
bundle.putLong("INTENT_GUILD_ID", j);
|
||
|
widgetServerDeleteDialog.setArguments(bundle);
|
||
|
widgetServerDeleteDialog.show(fragmentManager, WidgetServerDeleteDialog.class.getSimpleName());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* compiled from: WidgetServerDeleteDialog.kt */
|
||
|
public static final class Model {
|
||
|
public static final Companion Companion = new Companion(null);
|
||
|
private final Guild guild;
|
||
|
|
||
|
/* renamed from: me reason: collision with root package name */
|
||
|
private final MeUser f2162me;
|
||
|
|
||
|
/* compiled from: WidgetServerDeleteDialog.kt */
|
||
|
public static final class Companion {
|
||
|
private Companion() {
|
||
|
}
|
||
|
|
||
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
||
|
this();
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
/* JADX WARNING: Unknown variable types count: 1 */
|
||
|
public final Observable<Model> get$app_productionBetaRelease(long j) {
|
||
|
StoreStream.Companion companion = StoreStream.Companion;
|
||
|
Observable observeMe$default = StoreUser.observeMe$default(companion.getUsers(), false, 1, null);
|
||
|
Observable<Guild> observeGuild = companion.getGuilds().observeGuild(j);
|
||
|
WidgetServerDeleteDialog$Model$Companion$get$1 widgetServerDeleteDialog$Model$Companion$get$1 = WidgetServerDeleteDialog$Model$Companion$get$1.INSTANCE;
|
||
|
if (widgetServerDeleteDialog$Model$Companion$get$1 != null) {
|
||
|
widgetServerDeleteDialog$Model$Companion$get$1 = new WidgetServerDeleteDialog$sam$rx_functions_Func2$0(widgetServerDeleteDialog$Model$Companion$get$1);
|
||
|
}
|
||
|
Observable j2 = Observable.j(observeMe$default, observeGuild, (Func2) widgetServerDeleteDialog$Model$Companion$get$1);
|
||
|
m.checkNotNullExpressionValue(j2, "Observable.combineLatest… ::Model\n )");
|
||
|
return ObservableExtensionsKt.computationLatest(j2).r();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public Model(MeUser meUser, Guild guild) {
|
||
|
m.checkNotNullParameter(meUser, "me");
|
||
|
this.f2162me = meUser;
|
||
|
this.guild = guild;
|
||
|
}
|
||
|
|
||
|
public final Guild getGuild() {
|
||
|
return this.guild;
|
||
|
}
|
||
|
|
||
|
public final MeUser getMe() {
|
||
|
return this.f2162me;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public WidgetServerDeleteDialog() {
|
||
|
super(2131559160);
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ void access$afterDeleteGuild(WidgetServerDeleteDialog widgetServerDeleteDialog, long j) {
|
||
|
widgetServerDeleteDialog.afterDeleteGuild(j);
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ void access$configureUI(WidgetServerDeleteDialog widgetServerDeleteDialog, Model model) {
|
||
|
widgetServerDeleteDialog.configureUI(model);
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ WidgetServerDeleteDialogBinding access$getBinding$p(WidgetServerDeleteDialog widgetServerDeleteDialog) {
|
||
|
return widgetServerDeleteDialog.getBinding();
|
||
|
}
|
||
|
|
||
|
private final void afterDeleteGuild(long j) {
|
||
|
dismiss();
|
||
|
Experiment userExperiment = StoreStream.Companion.getExperiments().getUserExperiment("2020-12_guild_delete_feedback", true);
|
||
|
if (userExperiment != null && userExperiment.getBucket() == 1) {
|
||
|
GuildDeleteFeedbackSheetNavigator.INSTANCE.enqueueNotice(j);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private final void configureUI(Model model) {
|
||
|
if (model.getGuild() == null) {
|
||
|
dismiss();
|
||
|
return;
|
||
|
}
|
||
|
TextView textView = getBinding().d;
|
||
|
m.checkNotNullExpressionValue(textView, "binding.serverSettingsDeleteServerHeader");
|
||
|
Context context = getContext();
|
||
|
textView.setText(context != null ? b.g(context, 2131888082, new Object[]{model.getGuild().getName()}, null, 4) : null);
|
||
|
LinearLayout linearLayout = getBinding().f;
|
||
|
m.checkNotNullExpressionValue(linearLayout, "binding.serverSettingsDeleteServerMfaWrap");
|
||
|
linearLayout.setVisibility(model.getMe().getMfaEnabled() ? 0 : 8);
|
||
|
TextView textView2 = getBinding().g;
|
||
|
m.checkNotNullExpressionValue(textView2, "binding.serverSettingsDeleteServerText");
|
||
|
b.m(textView2, 2131888079, new Object[]{model.getGuild().getName()}, null, 4);
|
||
|
getBinding().b.setOnClickListener(new WidgetServerDeleteDialog$configureUI$1(this));
|
||
|
MaterialButton materialButton = getBinding().f1880c;
|
||
|
m.checkNotNullExpressionValue(materialButton, "binding.serverSettingsDeleteServerConfirm");
|
||
|
materialButton.setEnabled(model.getGuild().isOwner(model.getMe().getId()));
|
||
|
getBinding().f1880c.setOnClickListener(new WidgetServerDeleteDialog$configureUI$2(this, model));
|
||
|
}
|
||
|
|
||
|
private final WidgetServerDeleteDialogBinding getBinding() {
|
||
|
return (WidgetServerDeleteDialogBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
||
|
}
|
||
|
|
||
|
public static final void show(FragmentManager fragmentManager, long j) {
|
||
|
Companion.show(fragmentManager, j);
|
||
|
}
|
||
|
|
||
|
@Override // com.discord.app.AppDialog
|
||
|
public void onViewBoundOrOnResume() {
|
||
|
super.onViewBoundOrOnResume();
|
||
|
Observable<Model> observable = Model.Companion.get$app_productionBetaRelease(getArgumentsOrDefault().getLong("INTENT_GUILD_ID"));
|
||
|
m.checkNotNullExpressionValue(observable, "Model.get(guildId)");
|
||
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(observable, this, null, 2, null), WidgetServerDeleteDialog.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetServerDeleteDialog$onViewBoundOrOnResume$1(this), 62, (Object) null);
|
||
|
}
|
||
|
}
|