218 lines
9.9 KiB
Java
218 lines
9.9 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.d5;
|
|
import com.discord.R;
|
|
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 r extends AppDialog {
|
|
public static final /* synthetic */ KProperty[] i = {c.d.b.a.a.a0(r.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, d5> {
|
|
public static final b i = new b();
|
|
|
|
public b() {
|
|
super(1, d5.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 d5 invoke(View view) {
|
|
View view2 = view;
|
|
m.checkNotNullParameter(view2, "p1");
|
|
int i2 = R.id.enable_two_factor_password_body_container;
|
|
LinearLayout linearLayout = (LinearLayout) view2.findViewById(R.id.enable_two_factor_password_body_container);
|
|
if (linearLayout != null) {
|
|
i2 = R.id.enable_two_factor_password_body_text;
|
|
TextView textView = (TextView) view2.findViewById(R.id.enable_two_factor_password_body_text);
|
|
if (textView != null) {
|
|
i2 = R.id.enable_two_factor_password_cancel;
|
|
MaterialButton materialButton = (MaterialButton) view2.findViewById(R.id.enable_two_factor_password_cancel);
|
|
if (materialButton != null) {
|
|
i2 = R.id.enable_two_factor_password_header;
|
|
TextView textView2 = (TextView) view2.findViewById(R.id.enable_two_factor_password_header);
|
|
if (textView2 != null) {
|
|
i2 = R.id.enable_two_factor_password_header_container;
|
|
LinearLayout linearLayout2 = (LinearLayout) view2.findViewById(R.id.enable_two_factor_password_header_container);
|
|
if (linearLayout2 != null) {
|
|
i2 = R.id.enable_two_factor_password_ok;
|
|
LoadingButton loadingButton = (LoadingButton) view2.findViewById(R.id.enable_two_factor_password_ok);
|
|
if (loadingButton != null) {
|
|
i2 = R.id.enable_two_factor_password_view_input;
|
|
TextInputLayout textInputLayout = (TextInputLayout) view2.findViewById(R.id.enable_two_factor_password_view_input);
|
|
if (textInputLayout != null) {
|
|
return new d5((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 */ r 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");
|
|
r rVar = this.this$0.i;
|
|
KProperty[] kPropertyArr = r.i;
|
|
rVar.g().f82c.setIsLoading(false);
|
|
Error.Response response = error2.getResponse();
|
|
m.checkNotNullExpressionValue(response, "error.response");
|
|
if (response.getCode() == 60005) {
|
|
error2.setShowErrorToasts(false);
|
|
this.this$0.i.dismiss();
|
|
r rVar2 = this.this$0.i;
|
|
Function1<? super String, Unit> function1 = rVar2.l;
|
|
TextInputLayout textInputLayout = rVar2.g().d;
|
|
m.checkNotNullExpressionValue(textInputLayout, "binding.enableTwoFactorPasswordViewInput");
|
|
function1.invoke(ViewExtensions.getTextOrEmpty(textInputLayout));
|
|
}
|
|
return Unit.a;
|
|
}
|
|
}
|
|
|
|
public d(r rVar, View view) {
|
|
this.i = rVar;
|
|
this.j = view;
|
|
}
|
|
|
|
@Override // android.view.View.OnClickListener
|
|
public final void onClick(View view) {
|
|
r rVar = this.i;
|
|
KProperty[] kPropertyArr = r.i;
|
|
TextInputLayout textInputLayout = rVar.g().d;
|
|
m.checkNotNullExpressionValue(textInputLayout, "binding.enableTwoFactorPasswordViewInput");
|
|
String textOrEmpty = ViewExtensions.getTextOrEmpty(textInputLayout);
|
|
this.i.g().f82c.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 */ r i;
|
|
|
|
public e(r rVar) {
|
|
this.i = rVar;
|
|
}
|
|
|
|
@Override // android.view.View.OnClickListener
|
|
public final void onClick(View view) {
|
|
FragmentActivity activity = this.i.getActivity();
|
|
if (activity != null) {
|
|
activity.onBackPressed();
|
|
}
|
|
}
|
|
}
|
|
|
|
public r() {
|
|
super(R.layout.widget_enable_two_factor_password_dialog);
|
|
}
|
|
|
|
public final d5 g() {
|
|
return (d5) 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().f82c.setIsLoading(false);
|
|
g().f82c.setOnClickListener(new d(this, view));
|
|
g().b.setOnClickListener(new e(this));
|
|
}
|
|
}
|