discord-jadx/app/src/main/java/c/a/a/q.java

217 lines
9.5 KiB
Java

package c.a.a;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import c.a.i.p4;
import com.discord.api.auth.mfa.EnableMfaResponse;
import com.discord.app.AppDialog;
import com.discord.restapi.RestAPIParams;
import com.discord.utilities.error.Error;
import com.discord.utilities.rest.RestAPI;
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 com.google.android.material.textfield.TextInputLayout;
import d0.z.d.k;
import d0.z.d.m;
import d0.z.d.o;
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: WidgetEnableTwoFactorPasswordDialog.kt */
public final class q extends AppDialog {
public static final /* synthetic */ KProperty[] i = {c.d.b.a.a.W(q.class, "binding", "getBinding()Lcom/discord/databinding/WidgetEnableTwoFactorPasswordDialogBinding;", 0)};
public static final a j = new a(null);
public final FragmentViewBindingDelegate k = FragmentViewBindingDelegateKt.viewBinding$default(this, b.i, null, 2, null);
public Function1<? super String, Unit> l = c.i;
/* compiled from: WidgetEnableTwoFactorPasswordDialog.kt */
public static final class a {
public a(DefaultConstructorMarker defaultConstructorMarker) {
}
}
/* compiled from: WidgetEnableTwoFactorPasswordDialog.kt */
public static final /* synthetic */ class b extends k implements Function1<View, p4> {
public static final b i = new b();
public b() {
super(1, p4.class, "bind", "bind(Landroid/view/View;)Lcom/discord/databinding/WidgetEnableTwoFactorPasswordDialogBinding;", 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 p4 invoke(View view) {
View view2 = view;
m.checkNotNullParameter(view2, "p1");
int i2 = 2131363054;
LinearLayout linearLayout = (LinearLayout) view2.findViewById(2131363054);
if (linearLayout != null) {
i2 = 2131363055;
TextView textView = (TextView) view2.findViewById(2131363055);
if (textView != null) {
i2 = 2131363056;
MaterialButton materialButton = (MaterialButton) view2.findViewById(2131363056);
if (materialButton != null) {
i2 = 2131363057;
TextView textView2 = (TextView) view2.findViewById(2131363057);
if (textView2 != null) {
i2 = 2131363058;
LinearLayout linearLayout2 = (LinearLayout) view2.findViewById(2131363058);
if (linearLayout2 != null) {
i2 = 2131363059;
LoadingButton loadingButton = (LoadingButton) view2.findViewById(2131363059);
if (loadingButton != null) {
i2 = 2131363060;
TextInputLayout textInputLayout = (TextInputLayout) view2.findViewById(2131363060);
if (textInputLayout != null) {
return new p4((LinearLayout) view2, linearLayout, textView, materialButton, textView2, linearLayout2, loadingButton, textInputLayout);
}
}
}
}
}
}
}
throw new NullPointerException("Missing required view with ID: ".concat(view2.getResources().getResourceName(i2)));
}
}
/* compiled from: WidgetEnableTwoFactorPasswordDialog.kt */
public static final class c extends o implements Function1<String, Unit> {
public static final c i = new c();
public c() {
super(1);
}
/* 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(String str) {
m.checkNotNullParameter(str, "it");
return Unit.a;
}
}
/* compiled from: WidgetEnableTwoFactorPasswordDialog.kt */
public static final class d implements View.OnClickListener {
public final /* synthetic */ q i;
public final /* synthetic */ View j;
/* compiled from: WidgetEnableTwoFactorPasswordDialog.kt */
public static final class a extends o implements Function1<EnableMfaResponse, Unit> {
public static final a i = new a();
public a() {
super(1);
}
/* 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(EnableMfaResponse enableMfaResponse) {
m.checkNotNullParameter(enableMfaResponse, "it");
return Unit.a;
}
}
/* compiled from: WidgetEnableTwoFactorPasswordDialog.kt */
public static final class b extends o implements Function1<Error, Unit> {
public final /* synthetic */ d this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public b(d dVar) {
super(1);
this.this$0 = dVar;
}
/* 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(Error error) {
Error error2 = error;
m.checkNotNullParameter(error2, "error");
q qVar = this.this$0.i;
KProperty[] kPropertyArr = q.i;
qVar.g().f140c.setIsLoading(false);
Error.Response response = error2.getResponse();
m.checkNotNullExpressionValue(response, "error.response");
if (response.getCode() == 60005) {
error2.setShowErrorToasts(false);
this.this$0.i.dismiss();
q qVar2 = this.this$0.i;
Function1<? super String, Unit> function1 = qVar2.l;
TextInputLayout textInputLayout = qVar2.g().d;
m.checkNotNullExpressionValue(textInputLayout, "binding.enableTwoFactorPasswordViewInput");
function1.invoke(ViewExtensions.getTextOrEmpty(textInputLayout));
}
return Unit.a;
}
}
public d(q qVar, View view) {
this.i = qVar;
this.j = view;
}
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
q qVar = this.i;
KProperty[] kPropertyArr = q.i;
TextInputLayout textInputLayout = qVar.g().d;
m.checkNotNullExpressionValue(textInputLayout, "binding.enableTwoFactorPasswordViewInput");
String textOrEmpty = ViewExtensions.getTextOrEmpty(textInputLayout);
this.i.g().f140c.setIsLoading(true);
Observable ui$default = ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(RestAPI.Companion.getApi().enableMFA(new RestAPIParams.EnableMFA("random code", "random secret", textOrEmpty)), false, 1, null), this.i, null, 2, null);
a aVar = a.i;
ObservableExtensionsKt.appSubscribe$default(ui$default, this.i.getClass(), this.j.getContext(), (Function1) null, new b(this), (Function0) null, (Function0) null, aVar, 52, (Object) null);
}
}
/* compiled from: WidgetEnableTwoFactorPasswordDialog.kt */
public static final class e implements View.OnClickListener {
public final /* synthetic */ q i;
public e(q qVar) {
this.i = qVar;
}
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
FragmentActivity activity = this.i.getActivity();
if (activity != null) {
activity.onBackPressed();
}
}
}
public q() {
super(2131558998);
}
public final p4 g() {
return (p4) this.k.getValue((Fragment) this, i[0]);
}
@Override // com.discord.app.AppDialog
public void onViewBound(View view) {
m.checkNotNullParameter(view, "view");
super.onViewBound(view);
setCancelable(false);
g().f140c.setIsLoading(false);
g().f140c.setOnClickListener(new d(this, view));
g().b.setOnClickListener(new e(this));
}
}