292 lines
14 KiB
Java
292 lines
14 KiB
Java
package c.a.a.c;
|
|
|
|
import android.content.Context;
|
|
import android.os.Bundle;
|
|
import android.view.View;
|
|
import android.widget.ImageView;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.TextView;
|
|
import androidx.fragment.app.Fragment;
|
|
import androidx.fragment.app.FragmentViewModelLazyKt;
|
|
import c.a.a.c.k;
|
|
import c.a.d.h0;
|
|
import c.a.d.j0;
|
|
import c.a.i.x0;
|
|
import com.discord.app.AppDialog;
|
|
import com.discord.app.AppViewFlipper;
|
|
import com.discord.app.AppViewModel;
|
|
import com.discord.utilities.premium.PremiumGuildSubscriptionUtils;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.view.extensions.ViewExtensions;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
|
import com.discord.views.LoadingButton;
|
|
import com.google.android.material.button.MaterialButton;
|
|
import d0.g;
|
|
import d0.z.d.a0;
|
|
import d0.z.d.m;
|
|
import d0.z.d.o;
|
|
import java.util.Objects;
|
|
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;
|
|
import rx.Observable;
|
|
/* compiled from: PremiumGuildSubscriptionUncancelDialog.kt */
|
|
public final class b extends AppDialog {
|
|
public static final /* synthetic */ KProperty[] i = {c.d.b.a.a.V(b.class, "binding", "getBinding()Lcom/discord/databinding/PremiumGuildSubscriptionUncancelDialogBinding;", 0)};
|
|
public static final C0006b j = new C0006b(null);
|
|
public final FragmentViewBindingDelegate k = FragmentViewBindingDelegateKt.viewBinding$default(this, c.i, null, 2, null);
|
|
public final Lazy l;
|
|
public final Lazy m;
|
|
|
|
/* compiled from: java-style lambda group */
|
|
public static final class a implements View.OnClickListener {
|
|
public final /* synthetic */ int i;
|
|
public final /* synthetic */ Object j;
|
|
|
|
public a(int i, Object obj) {
|
|
this.i = i;
|
|
this.j = obj;
|
|
}
|
|
|
|
@Override // android.view.View.OnClickListener
|
|
public final void onClick(View view) {
|
|
int i = this.i;
|
|
if (i == 0) {
|
|
k kVar = (k) ((b) this.j).l.getValue();
|
|
k.c viewState = kVar.getViewState();
|
|
if (!m.areEqual(viewState, k.c.C0010c.a)) {
|
|
if ((viewState instanceof k.c.b) || (viewState instanceof k.c.a)) {
|
|
kVar.updateViewState(new k.c.a(null, 1));
|
|
}
|
|
}
|
|
} else if (i == 1) {
|
|
k kVar2 = (k) ((b) this.j).l.getValue();
|
|
k.c viewState2 = kVar2.getViewState();
|
|
if (!m.areEqual(viewState2, k.c.C0010c.a)) {
|
|
if (viewState2 instanceof k.c.b) {
|
|
k.c viewState3 = kVar2.getViewState();
|
|
Objects.requireNonNull(viewState3, "null cannot be cast to non-null type com.discord.dialogs.premiumguild.PremiumGuildSubscriptionUncancelViewModel.ViewState.Loaded");
|
|
if (!((k.c.b) viewState3).b) {
|
|
k.c viewState4 = kVar2.getViewState();
|
|
if (!(viewState4 instanceof k.c.b)) {
|
|
viewState4 = null;
|
|
}
|
|
k.c.b bVar = (k.c.b) viewState4;
|
|
if (bVar != null) {
|
|
kVar2.updateViewState(k.c.b.a(bVar, null, true, false, 5));
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(PremiumGuildSubscriptionUtils.INSTANCE.uncancelSubscriptionSlot(kVar2.m, kVar2.j, bVar.a, kVar2.l), kVar2, null, 2, null), k.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new l(kVar2, bVar), 62, (Object) null);
|
|
}
|
|
}
|
|
} else if ((viewState2 instanceof k.c.d) || (viewState2 instanceof k.c.a)) {
|
|
kVar2.updateViewState(new k.c.a(null, 1));
|
|
}
|
|
}
|
|
} else {
|
|
throw null;
|
|
}
|
|
}
|
|
}
|
|
|
|
/* compiled from: PremiumGuildSubscriptionUncancelDialog.kt */
|
|
/* renamed from: c.a.a.c.b$b reason: collision with other inner class name */
|
|
public static final class C0006b {
|
|
public C0006b(DefaultConstructorMarker defaultConstructorMarker) {
|
|
}
|
|
}
|
|
|
|
/* compiled from: PremiumGuildSubscriptionUncancelDialog.kt */
|
|
public static final /* synthetic */ class c extends d0.z.d.k implements Function1<View, x0> {
|
|
public static final c i = new c();
|
|
|
|
public c() {
|
|
super(1, x0.class, "bind", "bind(Landroid/view/View;)Lcom/discord/databinding/PremiumGuildSubscriptionUncancelDialogBinding;", 0);
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public x0 invoke(View view) {
|
|
View view2 = view;
|
|
m.checkNotNullParameter(view2, "p1");
|
|
int i2 = 2131364140;
|
|
LinearLayout linearLayout = (LinearLayout) view2.findViewById(2131364140);
|
|
if (linearLayout != null) {
|
|
i2 = 2131364385;
|
|
TextView textView = (TextView) view2.findViewById(2131364385);
|
|
if (textView != null) {
|
|
i2 = 2131364386;
|
|
LoadingButton loadingButton = (LoadingButton) view2.findViewById(2131364386);
|
|
if (loadingButton != null) {
|
|
i2 = 2131364387;
|
|
TextView textView2 = (TextView) view2.findViewById(2131364387);
|
|
if (textView2 != null) {
|
|
i2 = 2131364388;
|
|
AppViewFlipper appViewFlipper = (AppViewFlipper) view2.findViewById(2131364388);
|
|
if (appViewFlipper != null) {
|
|
i2 = 2131364389;
|
|
TextView textView3 = (TextView) view2.findViewById(2131364389);
|
|
if (textView3 != null) {
|
|
i2 = 2131364390;
|
|
ImageView imageView = (ImageView) view2.findViewById(2131364390);
|
|
if (imageView != null) {
|
|
i2 = 2131364391;
|
|
MaterialButton materialButton = (MaterialButton) view2.findViewById(2131364391);
|
|
if (materialButton != null) {
|
|
return new x0((LinearLayout) view2, linearLayout, textView, loadingButton, textView2, appViewFlipper, textView3, imageView, materialButton);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(view2.getResources().getResourceName(i2)));
|
|
}
|
|
}
|
|
|
|
/* compiled from: PremiumGuildSubscriptionUncancelDialog.kt */
|
|
public static final class d extends o implements Function1<k.c, Unit> {
|
|
public final /* synthetic */ b this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public d(b bVar) {
|
|
super(1);
|
|
this.this$0 = bVar;
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public Unit invoke(k.c cVar) {
|
|
k.c cVar2 = cVar;
|
|
b bVar = this.this$0;
|
|
m.checkNotNullExpressionValue(cVar2, "it");
|
|
KProperty[] kPropertyArr = b.i;
|
|
AppViewFlipper appViewFlipper = bVar.g().e;
|
|
m.checkNotNullExpressionValue(appViewFlipper, "binding.premiumGuildSubscriptionUncancelFlipper");
|
|
boolean z2 = true;
|
|
appViewFlipper.setDisplayedChild(!(cVar2 instanceof k.c.C0010c) ? 1 : 0);
|
|
TextView textView = bVar.g().d;
|
|
m.checkNotNullExpressionValue(textView, "binding.premiumGuildSubscriptionUncancelError");
|
|
boolean z3 = cVar2 instanceof k.c.b;
|
|
int i = 8;
|
|
textView.setVisibility(z3 && ((k.c.b) cVar2).f35c ? 0 : 8);
|
|
MaterialButton materialButton = bVar.g().h;
|
|
m.checkNotNullExpressionValue(materialButton, "binding.premiumGuildSubscriptionUncancelNevermind");
|
|
if (z3) {
|
|
i = 0;
|
|
}
|
|
materialButton.setVisibility(i);
|
|
MaterialButton materialButton2 = bVar.g().h;
|
|
m.checkNotNullExpressionValue(materialButton2, "binding.premiumGuildSubscriptionUncancelNevermind");
|
|
ViewExtensions.setEnabledAndAlpha$default(materialButton2, z3 && !((k.c.b) cVar2).b, 0.0f, 2, null);
|
|
bVar.g().f183c.setIsLoading(z3 && ((k.c.b) cVar2).b);
|
|
k.c.C0010c cVar3 = k.c.C0010c.a;
|
|
if (!(!m.areEqual(cVar2, cVar3)) || !z3 || ((k.c.b) cVar2).b) {
|
|
z2 = false;
|
|
}
|
|
bVar.setCancelable(z2);
|
|
if (!m.areEqual(cVar2, cVar3)) {
|
|
if (z3) {
|
|
TextView textView2 = bVar.g().f;
|
|
m.checkNotNullExpressionValue(textView2, "binding.premiumGuildSubscriptionUncancelHeader");
|
|
textView2.setText(bVar.getString(2131892316));
|
|
TextView textView3 = bVar.g().b;
|
|
m.checkNotNullExpressionValue(textView3, "binding.premiumGuildSubscriptionUncancelBody");
|
|
textView3.setText(bVar.getString(2131892313));
|
|
} else if (m.areEqual(cVar2, k.c.d.a)) {
|
|
TextView textView4 = bVar.g().f;
|
|
m.checkNotNullExpressionValue(textView4, "binding.premiumGuildSubscriptionUncancelHeader");
|
|
textView4.setText(bVar.getString(2131892312));
|
|
ImageView imageView = bVar.g().g;
|
|
m.checkNotNullExpressionValue(imageView, "binding.premiumGuildSubscriptionUncancelImage");
|
|
imageView.setVisibility(0);
|
|
TextView textView5 = bVar.g().b;
|
|
m.checkNotNullExpressionValue(textView5, "binding.premiumGuildSubscriptionUncancelBody");
|
|
textView5.setText(bVar.getString(2131892311));
|
|
bVar.g().f183c.setText(bVar.getString(2131891868));
|
|
} else if (cVar2 instanceof k.c.a) {
|
|
Integer num = ((k.c.a) cVar2).a;
|
|
if (num != null) {
|
|
c.a.d.o.i(bVar, num.intValue(), 0, 4);
|
|
}
|
|
bVar.dismiss();
|
|
}
|
|
}
|
|
return Unit.a;
|
|
}
|
|
}
|
|
|
|
/* compiled from: PremiumGuildSubscriptionUncancelDialog.kt */
|
|
public static final class e extends o implements Function0<Long> {
|
|
public final /* synthetic */ b this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public e(b bVar) {
|
|
super(0);
|
|
this.this$0 = bVar;
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
@Override // kotlin.jvm.functions.Function0
|
|
/* renamed from: invoke */
|
|
public Long mo1invoke() {
|
|
Bundle arguments = this.this$0.getArguments();
|
|
Long valueOf = arguments != null ? Long.valueOf(arguments.getLong("extra_slot_id")) : null;
|
|
Objects.requireNonNull(valueOf, "null cannot be cast to non-null type com.discord.primitives.PremiumGuildSubscriptionSlotId /* = kotlin.Long */");
|
|
return Long.valueOf(valueOf.longValue());
|
|
}
|
|
}
|
|
|
|
/* compiled from: PremiumGuildSubscriptionUncancelDialog.kt */
|
|
public static final class f extends o implements Function0<AppViewModel<k.c>> {
|
|
public final /* synthetic */ b this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public f(b bVar) {
|
|
super(0);
|
|
this.this$0 = bVar;
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
@Override // kotlin.jvm.functions.Function0
|
|
/* renamed from: invoke */
|
|
public AppViewModel<k.c> mo1invoke() {
|
|
return new k(((Number) this.this$0.m.getValue()).longValue(), null, null, null, null, 30);
|
|
}
|
|
}
|
|
|
|
public b() {
|
|
super(2131558645);
|
|
f fVar = new f(this);
|
|
h0 h0Var = new h0(this);
|
|
this.l = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(k.class), new m(3, h0Var), new j0(fVar));
|
|
this.m = g.lazy(new e(this));
|
|
}
|
|
|
|
public final x0 g() {
|
|
return (x0) this.k.getValue((Fragment) this, i[0]);
|
|
}
|
|
|
|
@Override // com.discord.app.AppDialog
|
|
public void onViewBound(View view) {
|
|
m.checkNotNullParameter(view, "view");
|
|
super.onViewBound(view);
|
|
g().h.setOnClickListener(new a(0, this));
|
|
g().f183c.setOnClickListener(new a(1, this));
|
|
}
|
|
|
|
@Override // com.discord.app.AppDialog
|
|
public void onViewBoundOrOnResume() {
|
|
super.onViewBoundOrOnResume();
|
|
Observable<k.c> r = ((k) this.l.getValue()).observeViewState().r();
|
|
m.checkNotNullExpressionValue(r, "viewModel\n .obser… .distinctUntilChanged()");
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle(r, this), b.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new d(this), 62, (Object) null);
|
|
}
|
|
}
|