discord-jadx/app/src/main/java/b/a/a/s.java

209 lines
9.1 KiB
Java
Raw Normal View History

2021-12-21 23:37:30 +00:00
package b.a.a;
2021-06-27 20:44:35 +00:00
import android.view.View;
2021-08-10 21:50:53 +00:00
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
2022-03-15 17:00:47 +00:00
import androidx.fragment.app.FragmentActivity;
2022-04-04 20:51:55 +00:00
import b.a.i.g5;
2021-08-10 21:50:53 +00:00
import com.discord.R;
2022-03-15 17:00:47 +00:00
import com.discord.api.auth.mfa.EnableMfaResponse;
2021-08-10 21:50:53 +00:00
import com.discord.app.AppDialog;
2022-03-15 17:00:47 +00:00
import com.discord.restapi.RestAPIParams;
import com.discord.utilities.error.Error;
import com.discord.utilities.rest.RestAPI;
2021-06-27 20:44:35 +00:00
import com.discord.utilities.rx.ObservableExtensionsKt;
2022-03-15 17:00:47 +00:00
import com.discord.utilities.view.extensions.ViewExtensions;
2021-08-10 21:50:53 +00:00
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
import com.discord.views.LoadingButton;
2022-03-15 17:00:47 +00:00
import com.google.android.material.button.MaterialButton;
import com.google.android.material.textfield.TextInputLayout;
2021-11-08 18:25:28 +00:00
import d0.z.d.k;
import d0.z.d.m;
import d0.z.d.o;
2021-08-10 21:50:53 +00:00
import kotlin.Unit;
2021-06-27 20:44:35 +00:00
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
2021-08-10 21:50:53 +00:00
import kotlin.jvm.internal.DefaultConstructorMarker;
2021-06-27 20:44:35 +00:00
import kotlin.reflect.KProperty;
2022-03-15 17:00:47 +00:00
import rx.Observable;
/* compiled from: WidgetEnableTwoFactorPasswordDialog.kt */
2022-03-02 20:59:20 +00:00
/* loaded from: classes.dex */
2021-08-10 21:50:53 +00:00
public final class s extends AppDialog {
2022-03-30 16:43:10 +00:00
public static final /* synthetic */ KProperty[] j = {b.d.b.a.a.b0(s.class, "binding", "getBinding()Lcom/discord/databinding/WidgetEnableTwoFactorPasswordDialogBinding;", 0)};
2021-12-17 22:03:14 +00:00
public static final a k = new a(null);
public final FragmentViewBindingDelegate l = FragmentViewBindingDelegateKt.viewBinding$default(this, b.j, null, 2, null);
2022-03-15 17:00:47 +00:00
public Function1<? super String, Unit> m = c.j;
2021-08-10 21:50:53 +00:00
2022-03-15 17:00:47 +00:00
/* compiled from: WidgetEnableTwoFactorPasswordDialog.kt */
2022-03-02 20:59:20 +00:00
/* loaded from: classes.dex */
2021-08-10 21:50:53 +00:00
public static final class a {
public a(DefaultConstructorMarker defaultConstructorMarker) {
}
}
2022-03-15 17:00:47 +00:00
/* compiled from: WidgetEnableTwoFactorPasswordDialog.kt */
2022-03-02 20:59:20 +00:00
/* loaded from: classes.dex */
2022-04-04 20:51:55 +00:00
public static final /* synthetic */ class b extends k implements Function1<View, g5> {
2021-12-17 22:03:14 +00:00
public static final b j = new b();
2021-08-10 21:50:53 +00:00
public b() {
2022-04-04 20:51:55 +00:00
super(1, g5.class, "bind", "bind(Landroid/view/View;)Lcom/discord/databinding/WidgetEnableTwoFactorPasswordDialogBinding;", 0);
2021-08-10 21:50:53 +00:00
}
@Override // kotlin.jvm.functions.Function1
2022-04-04 20:51:55 +00:00
public g5 invoke(View view) {
2021-08-10 21:50:53 +00:00
View view2 = view;
m.checkNotNullParameter(view2, "p1");
2022-03-15 17:00:47 +00:00
int i = R.id.enable_two_factor_password_body_container;
LinearLayout linearLayout = (LinearLayout) view2.findViewById(R.id.enable_two_factor_password_body_container);
if (linearLayout != null) {
i = R.id.enable_two_factor_password_body_text;
TextView textView = (TextView) view2.findViewById(R.id.enable_two_factor_password_body_text);
2021-08-10 21:50:53 +00:00
if (textView != null) {
2022-03-15 17:00:47 +00:00
i = R.id.enable_two_factor_password_cancel;
MaterialButton materialButton = (MaterialButton) view2.findViewById(R.id.enable_two_factor_password_cancel);
if (materialButton != null) {
i = R.id.enable_two_factor_password_header;
TextView textView2 = (TextView) view2.findViewById(R.id.enable_two_factor_password_header);
if (textView2 != null) {
i = R.id.enable_two_factor_password_header_container;
LinearLayout linearLayout2 = (LinearLayout) view2.findViewById(R.id.enable_two_factor_password_header_container);
if (linearLayout2 != null) {
i = R.id.enable_two_factor_password_ok;
LoadingButton loadingButton = (LoadingButton) view2.findViewById(R.id.enable_two_factor_password_ok);
if (loadingButton != null) {
i = R.id.enable_two_factor_password_view_input;
TextInputLayout textInputLayout = (TextInputLayout) view2.findViewById(R.id.enable_two_factor_password_view_input);
if (textInputLayout != null) {
2022-04-04 20:51:55 +00:00
return new g5((LinearLayout) view2, linearLayout, textView, materialButton, textView2, linearLayout2, loadingButton, textInputLayout);
2022-03-15 17:00:47 +00:00
}
}
}
}
2021-08-10 21:50:53 +00:00
}
}
}
2021-12-17 22:03:14 +00:00
throw new NullPointerException("Missing required view with ID: ".concat(view2.getResources().getResourceName(i)));
2021-08-10 21:50:53 +00:00
}
}
2022-03-15 17:00:47 +00:00
/* compiled from: WidgetEnableTwoFactorPasswordDialog.kt */
2022-03-02 20:59:20 +00:00
/* loaded from: classes.dex */
2022-03-15 17:00:47 +00:00
public static final class c extends o implements Function1<String, Unit> {
public static final c j = new c();
2022-03-02 20:59:20 +00:00
public c() {
2021-08-10 21:50:53 +00:00
super(1);
2021-06-27 20:44:35 +00:00
}
2021-08-10 21:50:53 +00:00
@Override // kotlin.jvm.functions.Function1
2022-03-15 17:00:47 +00:00
public Unit invoke(String str) {
m.checkNotNullParameter(str, "it");
2021-08-10 21:50:53 +00:00
return Unit.a;
}
}
2022-03-15 17:00:47 +00:00
/* compiled from: WidgetEnableTwoFactorPasswordDialog.kt */
2022-03-02 20:59:20 +00:00
/* loaded from: classes.dex */
2022-03-15 17:00:47 +00:00
public static final class d implements View.OnClickListener {
public final /* synthetic */ View k;
/* compiled from: WidgetEnableTwoFactorPasswordDialog.kt */
/* loaded from: classes.dex */
public static final class a extends o implements Function1<EnableMfaResponse, Unit> {
public static final a j = new a();
public a() {
super(1);
}
@Override // kotlin.jvm.functions.Function1
public Unit invoke(EnableMfaResponse enableMfaResponse) {
m.checkNotNullParameter(enableMfaResponse, "it");
return Unit.a;
}
2021-08-10 21:50:53 +00:00
}
2022-03-15 17:00:47 +00:00
/* compiled from: WidgetEnableTwoFactorPasswordDialog.kt */
/* loaded from: classes.dex */
public static final class b extends o implements Function1<Error, Unit> {
public b() {
super(1);
}
@Override // kotlin.jvm.functions.Function1
public Unit invoke(Error error) {
Error error2 = error;
m.checkNotNullParameter(error2, "error");
s sVar = s.this;
KProperty[] kPropertyArr = s.j;
sVar.g().c.setIsLoading(false);
Error.Response response = error2.getResponse();
m.checkNotNullExpressionValue(response, "error.response");
if (response.getCode() == 60005) {
error2.setShowErrorToasts(false);
s.this.dismiss();
s sVar2 = s.this;
Function1<? super String, Unit> function1 = sVar2.m;
TextInputLayout textInputLayout = sVar2.g().d;
m.checkNotNullExpressionValue(textInputLayout, "binding.enableTwoFactorPasswordViewInput");
function1.invoke(ViewExtensions.getTextOrEmpty(textInputLayout));
}
return Unit.a;
}
}
public d(View view) {
this.k = view;
}
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
2022-03-02 20:59:20 +00:00
s sVar = s.this;
2021-12-17 22:03:14 +00:00
KProperty[] kPropertyArr = s.j;
2022-03-15 17:00:47 +00:00
TextInputLayout textInputLayout = sVar.g().d;
m.checkNotNullExpressionValue(textInputLayout, "binding.enableTwoFactorPasswordViewInput");
String textOrEmpty = ViewExtensions.getTextOrEmpty(textInputLayout);
s.this.g().c.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), s.this, null, 2, null);
a aVar = a.j;
ObservableExtensionsKt.appSubscribe$default(ui$default, s.this.getClass(), this.k.getContext(), (Function1) null, new b(), (Function0) null, (Function0) null, aVar, 52, (Object) null);
2021-08-10 21:50:53 +00:00
}
}
2022-03-15 17:00:47 +00:00
/* compiled from: WidgetEnableTwoFactorPasswordDialog.kt */
2022-03-02 20:59:20 +00:00
/* loaded from: classes.dex */
2022-03-15 17:00:47 +00:00
public static final class e implements View.OnClickListener {
2021-08-10 21:50:53 +00:00
public e() {
}
2022-03-15 17:00:47 +00:00
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
FragmentActivity activity = s.this.e();
if (activity != null) {
activity.onBackPressed();
}
2021-08-10 21:50:53 +00:00
}
}
public s() {
2022-03-15 17:00:47 +00:00
super(R.layout.widget_enable_two_factor_password_dialog);
2021-08-10 21:50:53 +00:00
}
2022-04-04 20:51:55 +00:00
public final g5 g() {
return (g5) this.l.getValue((Fragment) this, j[0]);
2021-08-10 21:50:53 +00:00
}
@Override // com.discord.app.AppDialog
public void onViewBound(View view) {
m.checkNotNullParameter(view, "view");
super.onViewBound(view);
setCancelable(false);
2022-03-15 17:00:47 +00:00
g().c.setIsLoading(false);
g().c.setOnClickListener(new d(view));
2022-04-04 20:51:55 +00:00
g().f122b.setOnClickListener(new e());
2021-06-27 20:44:35 +00:00
}
}