2021-08-03 07:33:18 +00:00
|
|
|
package com.discord.widgets.settings.account;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.view.View;
|
|
|
|
import android.widget.LinearLayout;
|
|
|
|
import android.widget.RelativeLayout;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import androidx.fragment.app.Fragment;
|
|
|
|
import androidx.fragment.app.FragmentManager;
|
2021-08-13 06:23:11 +00:00
|
|
|
import c.a.d.j;
|
2021-08-11 06:37:47 +00:00
|
|
|
import c.a.k.b;
|
2021-08-03 07:33:18 +00:00
|
|
|
import c.d.b.a.a;
|
|
|
|
import com.airbnb.lottie.LottieAnimationView;
|
2021-08-09 22:51:56 +00:00
|
|
|
import com.discord.R;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.discord.app.AppActivity;
|
|
|
|
import com.discord.app.AppFragment;
|
|
|
|
import com.discord.app.AppViewFlipper;
|
|
|
|
import com.discord.databinding.WidgetSettingsAccountBinding;
|
|
|
|
import com.discord.models.domain.ModelConnectedAccount;
|
|
|
|
import com.discord.models.user.MeUser;
|
|
|
|
import com.discord.stores.StoreMFA;
|
|
|
|
import com.discord.stores.StoreStream;
|
|
|
|
import com.discord.stores.StoreUser;
|
|
|
|
import com.discord.utilities.accessibility.AccessibilityUtils;
|
|
|
|
import com.discord.utilities.auth.GoogleSmartLockManager;
|
|
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
|
|
import com.discord.utilities.user.UserUtils;
|
|
|
|
import com.discord.utilities.view.extensions.ViewExtensions;
|
|
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
|
|
|
import com.discord.utilities.views.ViewCoroutineScopeKt;
|
|
|
|
import com.discord.views.CheckedSetting;
|
|
|
|
import com.discord.widgets.notice.WidgetNoticeDialog;
|
|
|
|
import com.discord.widgets.settings.account.WidgetEnableSMSBackupDialog;
|
|
|
|
import com.google.android.material.button.MaterialButton;
|
|
|
|
import d0.t.n;
|
|
|
|
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 kotlinx.coroutines.CoroutineScope;
|
|
|
|
import rx.Observable;
|
|
|
|
/* compiled from: WidgetSettingsAccount.kt */
|
|
|
|
public final class WidgetSettingsAccount extends AppFragment {
|
2021-10-09 06:29:02 +00:00
|
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.Z(WidgetSettingsAccount.class, "binding", "getBinding()Lcom/discord/databinding/WidgetSettingsAccountBinding;", 0)};
|
2021-08-03 07:33:18 +00:00
|
|
|
public static final Companion Companion = new Companion(null);
|
|
|
|
private static final String EXTRA_HINT_DATA_MANAGEMENT = "com.discord.extra.HINT_DATA_MANAGEMENT";
|
|
|
|
private static final String EXTRA_REDIRECT = "extra_redirect";
|
|
|
|
private static final int MFA_DISABLED_VIEW_INDEX = 1;
|
|
|
|
private static final int MFA_ENABLED_VIEW_INDEX = 0;
|
|
|
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetSettingsAccount$binding$2.INSTANCE, null, 2, null);
|
|
|
|
|
|
|
|
/* compiled from: WidgetSettingsAccount.kt */
|
|
|
|
public static final class Companion {
|
|
|
|
private Companion() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static /* synthetic */ void launch$default(Companion companion, Context context, boolean z2, Redirect redirect, int i, Object obj) {
|
|
|
|
if ((i & 2) != 0) {
|
|
|
|
z2 = false;
|
|
|
|
}
|
|
|
|
if ((i & 4) != 0) {
|
|
|
|
redirect = null;
|
|
|
|
}
|
|
|
|
companion.launch(context, z2, redirect);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void launch(Context context) {
|
|
|
|
launch$default(this, context, false, null, 6, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void launch(Context context, boolean z2) {
|
|
|
|
launch$default(this, context, z2, null, 4, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void launch(Context context, boolean z2, Redirect redirect) {
|
|
|
|
m.checkNotNullParameter(context, "context");
|
|
|
|
Intent intent = new Intent();
|
2021-08-09 22:51:56 +00:00
|
|
|
intent.putExtra(WidgetSettingsAccount.EXTRA_HINT_DATA_MANAGEMENT, z2);
|
|
|
|
intent.putExtra(WidgetSettingsAccount.EXTRA_REDIRECT, redirect);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (redirect != null) {
|
|
|
|
intent.addFlags(268435456);
|
|
|
|
intent.addFlags(67108864);
|
|
|
|
}
|
2021-08-13 06:23:11 +00:00
|
|
|
j.d(context, WidgetSettingsAccount.class, intent);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: WidgetSettingsAccount.kt */
|
|
|
|
public static final class Model {
|
|
|
|
public static final Companion Companion = new Companion(null);
|
|
|
|
private final ModelConnectedAccount contactSyncConnection;
|
|
|
|
private final MeUser meUser;
|
|
|
|
private final boolean ownsAnyGuilds;
|
|
|
|
private final StoreMFA.State pendingMFAState;
|
|
|
|
|
|
|
|
/* compiled from: WidgetSettingsAccount.kt */
|
|
|
|
public static final class Companion {
|
|
|
|
private Companion() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this();
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Observable<Model> get() {
|
|
|
|
StoreStream.Companion companion = StoreStream.Companion;
|
2021-08-10 21:19:22 +00:00
|
|
|
Observable<Model> g = Observable.g(StoreUser.observeMe$default(companion.getUsers(), false, 1, null), companion.getMFA().observeState(), companion.getGuilds().observeGuilds(), companion.getUserConnections().observeConnectedAccounts(), companion.getExperiments().observeUserExperiment("2021-04_contact_sync_android_main", true), WidgetSettingsAccount$Model$Companion$get$1.INSTANCE);
|
|
|
|
m.checkNotNullExpressionValue(g, "Observable.combineLatest… )\n }");
|
|
|
|
return g;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-10 21:19:22 +00:00
|
|
|
public Model(MeUser meUser, StoreMFA.State state, boolean z2, ModelConnectedAccount modelConnectedAccount) {
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullParameter(meUser, "meUser");
|
|
|
|
m.checkNotNullParameter(state, "pendingMFAState");
|
|
|
|
this.meUser = meUser;
|
|
|
|
this.pendingMFAState = state;
|
|
|
|
this.ownsAnyGuilds = z2;
|
|
|
|
this.contactSyncConnection = modelConnectedAccount;
|
|
|
|
}
|
|
|
|
|
2021-08-10 21:19:22 +00:00
|
|
|
public static /* synthetic */ Model copy$default(Model model, MeUser meUser, StoreMFA.State state, boolean z2, ModelConnectedAccount modelConnectedAccount, int i, Object obj) {
|
2021-08-03 07:33:18 +00:00
|
|
|
if ((i & 1) != 0) {
|
|
|
|
meUser = model.meUser;
|
|
|
|
}
|
|
|
|
if ((i & 2) != 0) {
|
|
|
|
state = model.pendingMFAState;
|
|
|
|
}
|
|
|
|
if ((i & 4) != 0) {
|
|
|
|
z2 = model.ownsAnyGuilds;
|
|
|
|
}
|
|
|
|
if ((i & 8) != 0) {
|
|
|
|
modelConnectedAccount = model.contactSyncConnection;
|
|
|
|
}
|
2021-08-10 21:19:22 +00:00
|
|
|
return model.copy(meUser, state, z2, modelConnectedAccount);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final MeUser component1() {
|
|
|
|
return this.meUser;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final StoreMFA.State component2() {
|
|
|
|
return this.pendingMFAState;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final boolean component3() {
|
|
|
|
return this.ownsAnyGuilds;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final ModelConnectedAccount component4() {
|
|
|
|
return this.contactSyncConnection;
|
|
|
|
}
|
|
|
|
|
2021-08-10 21:19:22 +00:00
|
|
|
public final Model copy(MeUser meUser, StoreMFA.State state, boolean z2, ModelConnectedAccount modelConnectedAccount) {
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullParameter(meUser, "meUser");
|
|
|
|
m.checkNotNullParameter(state, "pendingMFAState");
|
2021-08-10 21:19:22 +00:00
|
|
|
return new Model(meUser, state, z2, modelConnectedAccount);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
if (this == obj) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!(obj instanceof Model)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
Model model = (Model) obj;
|
2021-08-10 21:19:22 +00:00
|
|
|
return m.areEqual(this.meUser, model.meUser) && m.areEqual(this.pendingMFAState, model.pendingMFAState) && this.ownsAnyGuilds == model.ownsAnyGuilds && m.areEqual(this.contactSyncConnection, model.contactSyncConnection);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final ModelConnectedAccount getContactSyncConnection() {
|
|
|
|
return this.contactSyncConnection;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final MeUser getMeUser() {
|
|
|
|
return this.meUser;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final boolean getOwnsAnyGuilds() {
|
|
|
|
return this.ownsAnyGuilds;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final StoreMFA.State getPendingMFAState() {
|
|
|
|
return this.pendingMFAState;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode() {
|
|
|
|
MeUser meUser = this.meUser;
|
|
|
|
int i = 0;
|
|
|
|
int hashCode = (meUser != null ? meUser.hashCode() : 0) * 31;
|
|
|
|
StoreMFA.State state = this.pendingMFAState;
|
|
|
|
int hashCode2 = (hashCode + (state != null ? state.hashCode() : 0)) * 31;
|
|
|
|
boolean z2 = this.ownsAnyGuilds;
|
|
|
|
if (z2) {
|
|
|
|
z2 = true;
|
|
|
|
}
|
2021-08-10 21:19:22 +00:00
|
|
|
int i2 = z2 ? 1 : 0;
|
2021-08-03 07:33:18 +00:00
|
|
|
int i3 = z2 ? 1 : 0;
|
|
|
|
int i4 = z2 ? 1 : 0;
|
2021-08-10 21:19:22 +00:00
|
|
|
int i5 = (hashCode2 + i2) * 31;
|
2021-08-03 07:33:18 +00:00
|
|
|
ModelConnectedAccount modelConnectedAccount = this.contactSyncConnection;
|
|
|
|
if (modelConnectedAccount != null) {
|
|
|
|
i = modelConnectedAccount.hashCode();
|
|
|
|
}
|
2021-08-10 21:19:22 +00:00
|
|
|
return i5 + i;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
2021-10-09 06:29:02 +00:00
|
|
|
StringBuilder O = a.O("Model(meUser=");
|
|
|
|
O.append(this.meUser);
|
|
|
|
O.append(", pendingMFAState=");
|
|
|
|
O.append(this.pendingMFAState);
|
|
|
|
O.append(", ownsAnyGuilds=");
|
|
|
|
O.append(this.ownsAnyGuilds);
|
|
|
|
O.append(", contactSyncConnection=");
|
|
|
|
O.append(this.contactSyncConnection);
|
|
|
|
O.append(")");
|
|
|
|
return O.toString();
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: WidgetSettingsAccount.kt */
|
|
|
|
public enum Redirect {
|
|
|
|
SMS_BACKUP
|
|
|
|
}
|
|
|
|
|
|
|
|
public WidgetSettingsAccount() {
|
2021-08-09 22:51:56 +00:00
|
|
|
super(R.layout.widget_settings_account);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$configureUI(WidgetSettingsAccount widgetSettingsAccount, Model model) {
|
|
|
|
widgetSettingsAccount.configureUI(model);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ WidgetSettingsAccountBinding access$getBinding$p(WidgetSettingsAccount widgetSettingsAccount) {
|
|
|
|
return widgetSettingsAccount.getBinding();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$showOwnsGuildModal(WidgetSettingsAccount widgetSettingsAccount) {
|
|
|
|
widgetSettingsAccount.showOwnsGuildModal();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$showRemove2FAModal(WidgetSettingsAccount widgetSettingsAccount) {
|
|
|
|
widgetSettingsAccount.showRemove2FAModal();
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void configureAccountVerificationBanner(MeUser meUser) {
|
2021-08-10 21:19:22 +00:00
|
|
|
RelativeLayout relativeLayout = getBinding().C;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(relativeLayout, "binding.settingsAccountVerification");
|
|
|
|
relativeLayout.setVisibility(meUser.isVerified() ^ true ? 0 : 8);
|
|
|
|
if (meUser.getEmail() == null) {
|
2021-08-10 21:19:22 +00:00
|
|
|
TextView textView = getBinding().E;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(textView, "binding.settingsAccountVerificationTitle");
|
2021-08-09 22:51:56 +00:00
|
|
|
textView.setText(getString(R.string.add_email_banner_title));
|
2021-08-10 21:19:22 +00:00
|
|
|
MaterialButton materialButton = getBinding().D;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(materialButton, "binding.settingsAccountVerificationButton");
|
2021-08-09 22:51:56 +00:00
|
|
|
materialButton.setText(getString(R.string.add_email_short));
|
2021-08-03 07:33:18 +00:00
|
|
|
} else {
|
2021-08-10 21:19:22 +00:00
|
|
|
TextView textView2 = getBinding().E;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(textView2, "binding.settingsAccountVerificationTitle");
|
2021-08-09 22:51:56 +00:00
|
|
|
textView2.setText(getString(R.string.verify_your_email));
|
2021-08-10 21:19:22 +00:00
|
|
|
MaterialButton materialButton2 = getBinding().D;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(materialButton2, "binding.settingsAccountVerificationButton");
|
2021-08-09 22:51:56 +00:00
|
|
|
materialButton2.setText(getString(R.string.verify));
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
2021-08-10 21:19:22 +00:00
|
|
|
getBinding().D.setOnClickListener(WidgetSettingsAccount$configureAccountVerificationBanner$1.INSTANCE);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private final void configureMFA(boolean z2, boolean z3) {
|
2021-08-10 21:19:22 +00:00
|
|
|
TextView textView = getBinding().l;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(textView, "binding.settingsAccountMfaEnabledHeader");
|
|
|
|
int i = 0;
|
|
|
|
textView.setVisibility(z2 ? 0 : 8);
|
2021-08-10 21:19:22 +00:00
|
|
|
AppViewFlipper appViewFlipper = getBinding().m;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(appViewFlipper, "binding.settingsAccountMfaFlipper");
|
|
|
|
appViewFlipper.setDisplayedChild(!z2 ? 1 : 0);
|
2021-08-10 21:19:22 +00:00
|
|
|
LottieAnimationView lottieAnimationView = getBinding().n;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(lottieAnimationView, "binding.settingsAccountMfaLottie");
|
|
|
|
lottieAnimationView.setVisibility(z2 ^ true ? 0 : 8);
|
2021-08-10 21:19:22 +00:00
|
|
|
TextView textView2 = getBinding().o;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(textView2, "binding.settingsAccountMfaSalesPitch");
|
|
|
|
textView2.setVisibility(z2 ^ true ? 0 : 8);
|
2021-08-10 21:19:22 +00:00
|
|
|
MaterialButton materialButton = getBinding().j;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(materialButton, "binding.settingsAccountMfaEnable");
|
|
|
|
if (!(!z2)) {
|
|
|
|
i = 8;
|
|
|
|
}
|
|
|
|
materialButton.setVisibility(i);
|
2021-08-10 21:19:22 +00:00
|
|
|
MaterialButton materialButton2 = getBinding().j;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(materialButton2, "binding.settingsAccountMfaEnable");
|
|
|
|
materialButton2.setEnabled(!z3);
|
2021-08-10 21:19:22 +00:00
|
|
|
TextView textView3 = getBinding().F;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(textView3, "binding.settingsAccountViewBackupCodes");
|
|
|
|
textView3.setEnabled(!z3);
|
2021-08-10 21:19:22 +00:00
|
|
|
TextView textView4 = getBinding().w;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(textView4, "binding.settingsAccountRemoveTwoFa");
|
|
|
|
textView4.setEnabled(!z3);
|
2021-08-10 21:19:22 +00:00
|
|
|
LinearLayout linearLayout = getBinding().i;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.settingsAccountMfaDisabledContainer");
|
|
|
|
ViewExtensions.setEnabledAlpha$default(linearLayout, !z3, 0.0f, 2, null);
|
2021-08-10 21:19:22 +00:00
|
|
|
LinearLayout linearLayout2 = getBinding().k;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(linearLayout2, "binding.settingsAccountMfaEnabledContainer");
|
|
|
|
ViewExtensions.setEnabledAlpha$default(linearLayout2, !z3, 0.0f, 2, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void configureUI(Model model) {
|
|
|
|
String str;
|
|
|
|
MeUser component1 = model.component1();
|
|
|
|
StoreMFA.State component2 = model.component2();
|
|
|
|
ModelConnectedAccount component4 = model.component4();
|
|
|
|
configureAccountVerificationBanner(component1);
|
2021-08-10 21:19:22 +00:00
|
|
|
LinearLayout linearLayout = getBinding().p;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.settingsAccountNameContainer");
|
2021-08-10 21:19:22 +00:00
|
|
|
int i = 8;
|
2021-08-03 07:33:18 +00:00
|
|
|
linearLayout.setVisibility(component4 != null ? 0 : 8);
|
2021-08-10 21:19:22 +00:00
|
|
|
TextView textView = getBinding().q;
|
|
|
|
m.checkNotNullExpressionValue(textView, "binding.settingsAccountNameText");
|
2021-08-03 07:33:18 +00:00
|
|
|
if (component4 == null || (str = component4.getUsername()) == null) {
|
|
|
|
str = "";
|
|
|
|
}
|
2021-08-10 21:19:22 +00:00
|
|
|
textView.setText(str);
|
|
|
|
TextView textView2 = getBinding().B;
|
|
|
|
m.checkNotNullExpressionValue(textView2, "binding.settingsAccountTagText");
|
|
|
|
UserUtils userUtils = UserUtils.INSTANCE;
|
|
|
|
textView2.setText(UserUtils.getUserNameWithDiscriminator$default(userUtils, component1, null, null, 3, null));
|
|
|
|
TextView textView3 = getBinding().f;
|
|
|
|
m.checkNotNullExpressionValue(textView3, "binding.settingsAccountEmailText");
|
|
|
|
textView3.setText(component1.getEmail());
|
2021-10-08 22:11:56 +00:00
|
|
|
TextView textView4 = getBinding().f1992s;
|
2021-08-10 21:19:22 +00:00
|
|
|
m.checkNotNullExpressionValue(textView4, "binding.settingsAccountPhoneText");
|
|
|
|
textView4.setText(component1.getPhoneNumber());
|
|
|
|
getBinding().d.setOnClickListener(new WidgetSettingsAccount$configureUI$1(this));
|
|
|
|
getBinding().A.setOnClickListener(WidgetSettingsAccount$configureUI$2.INSTANCE);
|
|
|
|
getBinding().p.setOnClickListener(WidgetSettingsAccount$configureUI$3.INSTANCE);
|
|
|
|
getBinding().e.setOnClickListener(WidgetSettingsAccount$configureUI$4.INSTANCE);
|
|
|
|
getBinding().r.setOnClickListener(WidgetSettingsAccount$configureUI$5.INSTANCE);
|
|
|
|
TextView textView5 = getBinding().l;
|
|
|
|
m.checkNotNullExpressionValue(textView5, "binding.settingsAccountMfaEnabledHeader");
|
|
|
|
textView5.setVisibility(component1.getMfaEnabled() ? 0 : 8);
|
|
|
|
AppViewFlipper appViewFlipper = getBinding().m;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(appViewFlipper, "binding.settingsAccountMfaFlipper");
|
|
|
|
appViewFlipper.setDisplayedChild(!component1.getMfaEnabled());
|
2021-08-10 21:19:22 +00:00
|
|
|
LottieAnimationView lottieAnimationView = getBinding().n;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(lottieAnimationView, "binding.settingsAccountMfaLottie");
|
|
|
|
lottieAnimationView.setVisibility(component1.getMfaEnabled() ^ true ? 0 : 8);
|
2021-08-10 21:19:22 +00:00
|
|
|
TextView textView6 = getBinding().o;
|
|
|
|
m.checkNotNullExpressionValue(textView6, "binding.settingsAccountMfaSalesPitch");
|
|
|
|
textView6.setVisibility(component1.getMfaEnabled() ^ true ? 0 : 8);
|
|
|
|
MaterialButton materialButton = getBinding().j;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(materialButton, "binding.settingsAccountMfaEnable");
|
|
|
|
if (!component1.getMfaEnabled()) {
|
|
|
|
i = 0;
|
|
|
|
}
|
|
|
|
materialButton.setVisibility(i);
|
|
|
|
if (component2.getActivationState() != StoreMFA.MFAActivationState.NONE) {
|
|
|
|
configureMFA(component2.getActivationState() == StoreMFA.MFAActivationState.PENDING_ENABLED, true);
|
|
|
|
} else {
|
|
|
|
configureMFA(component1.getMfaEnabled(), false);
|
|
|
|
}
|
2021-08-10 21:19:22 +00:00
|
|
|
getBinding().j.setOnClickListener(WidgetSettingsAccount$configureUI$6.INSTANCE);
|
|
|
|
getBinding().F.setOnClickListener(WidgetSettingsAccount$configureUI$7.INSTANCE);
|
|
|
|
getBinding().w.setOnClickListener(new WidgetSettingsAccount$configureUI$8(this));
|
|
|
|
getBinding().G.setOnClickListener(WidgetSettingsAccount$configureUI$9.INSTANCE);
|
|
|
|
getBinding().u.setOnClickListener(new WidgetSettingsAccount$configureUI$10(this, model));
|
|
|
|
getBinding().t.setOnClickListener(new WidgetSettingsAccount$configureUI$11(this, model));
|
2021-08-03 07:33:18 +00:00
|
|
|
String sMSBackupDisabledMessage = getSMSBackupDisabledMessage(component1);
|
|
|
|
CharSequence charSequence = null;
|
|
|
|
if (sMSBackupDisabledMessage != null || component2.isTogglingSMSBackup()) {
|
2021-10-08 22:11:56 +00:00
|
|
|
CheckedSetting.d(getBinding().f1994y, null, 1);
|
|
|
|
TextView textView7 = getBinding().f1995z;
|
2021-08-10 21:19:22 +00:00
|
|
|
m.checkNotNullExpressionValue(textView7, "binding.settingsAccountSmsPhone");
|
|
|
|
ViewExtensions.setEnabledAlpha$default(textView7, false, 0.0f, 2, null);
|
2021-08-03 07:33:18 +00:00
|
|
|
} else {
|
2021-10-08 22:11:56 +00:00
|
|
|
TextView textView8 = getBinding().f1995z;
|
2021-08-10 21:19:22 +00:00
|
|
|
m.checkNotNullExpressionValue(textView8, "binding.settingsAccountSmsPhone");
|
|
|
|
ViewExtensions.setEnabledAlpha$default(textView8, true, 0.0f, 2, null);
|
2021-10-08 22:11:56 +00:00
|
|
|
getBinding().f1994y.e(new WidgetSettingsAccount$configureUI$12(this, component1));
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
2021-10-08 22:11:56 +00:00
|
|
|
TextView textView9 = getBinding().f1995z;
|
2021-08-10 21:19:22 +00:00
|
|
|
m.checkNotNullExpressionValue(textView9, "binding.settingsAccountSmsPhone");
|
2021-08-03 07:33:18 +00:00
|
|
|
if (component1.getPhoneNumber() != null) {
|
2021-10-08 22:11:56 +00:00
|
|
|
TextView textView10 = getBinding().f1995z;
|
2021-08-10 21:19:22 +00:00
|
|
|
m.checkNotNullExpressionValue(textView10, "binding.settingsAccountSmsPhone");
|
|
|
|
Context context = textView10.getContext();
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(context, "binding.settingsAccountSmsPhone.context");
|
2021-08-09 22:51:56 +00:00
|
|
|
charSequence = b.h(context, R.string.mfa_sms_auth_current_phone, new Object[]{component1.getPhoneNumber()}, null, 4);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
2021-08-10 21:19:22 +00:00
|
|
|
ViewExtensions.setTextAndVisibilityBy(textView9, charSequence);
|
2021-10-08 22:11:56 +00:00
|
|
|
CheckedSetting checkedSetting = getBinding().f1994y;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(checkedSetting, "binding.settingsAccountSmsBackup");
|
|
|
|
checkedSetting.setChecked(userUtils.isMfaSMSEnabled(component1));
|
2021-10-08 22:11:56 +00:00
|
|
|
CheckedSetting checkedSetting2 = getBinding().f1994y;
|
2021-08-03 07:33:18 +00:00
|
|
|
if (sMSBackupDisabledMessage == null) {
|
2021-08-09 22:51:56 +00:00
|
|
|
sMSBackupDisabledMessage = getString(R.string.mfa_sms_auth_sales_pitch);
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(sMSBackupDisabledMessage, "getString(R.string.mfa_sms_auth_sales_pitch)");
|
|
|
|
}
|
|
|
|
CheckedSetting.i(checkedSetting2, sMSBackupDisabledMessage, false, 2);
|
2021-08-09 22:51:56 +00:00
|
|
|
if (getMostRecentIntent().getSerializableExtra(EXTRA_REDIRECT) == Redirect.SMS_BACKUP) {
|
|
|
|
getMostRecentIntent().removeExtra(EXTRA_REDIRECT);
|
2021-08-03 07:33:18 +00:00
|
|
|
WidgetEnableSMSBackupDialog.Companion companion = WidgetEnableSMSBackupDialog.Companion;
|
|
|
|
FragmentManager parentFragmentManager = getParentFragmentManager();
|
|
|
|
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
|
|
|
|
companion.show(parentFragmentManager, true);
|
|
|
|
}
|
2021-10-08 22:11:56 +00:00
|
|
|
for (TextView textView11 : n.listOf((Object[]) new TextView[]{getBinding().g, getBinding().f1991c, getBinding().h})) {
|
2021-08-03 07:33:18 +00:00
|
|
|
AccessibilityUtils accessibilityUtils = AccessibilityUtils.INSTANCE;
|
2021-08-10 21:19:22 +00:00
|
|
|
m.checkNotNullExpressionValue(textView11, "header");
|
|
|
|
accessibilityUtils.setViewIsHeading(textView11);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private final WidgetSettingsAccountBinding getBinding() {
|
|
|
|
return (WidgetSettingsAccountBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final String getSMSBackupDisabledMessage(MeUser meUser) {
|
|
|
|
UserUtils userUtils = UserUtils.INSTANCE;
|
|
|
|
if (userUtils.isPartner(meUser) || userUtils.isStaff(meUser)) {
|
2021-08-09 22:51:56 +00:00
|
|
|
return getString(R.string.mfa_sms_disabled_partner);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
if (meUser.getEmail() == null) {
|
2021-08-09 22:51:56 +00:00
|
|
|
return getString(R.string.mfa_sms_disabled_no_email);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final void launch(Context context) {
|
|
|
|
Companion.launch$default(Companion, context, false, null, 6, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final void launch(Context context, boolean z2) {
|
|
|
|
Companion.launch$default(Companion, context, z2, null, 4, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final void launch(Context context, boolean z2, Redirect redirect) {
|
|
|
|
Companion.launch(context, z2, redirect);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void showOwnsGuildModal() {
|
2021-08-09 22:51:56 +00:00
|
|
|
WidgetNoticeDialog.Builder positiveButton$default = WidgetNoticeDialog.Builder.setPositiveButton$default(new WidgetNoticeDialog.Builder(requireContext()).setTitle(R.string.delete_account_transfer_ownership).setMessage(R.string.delete_account_transfer_ownership_body), (int) R.string.okay, (Function1) null, 2, (Object) null);
|
2021-08-03 07:33:18 +00:00
|
|
|
FragmentManager parentFragmentManager = getParentFragmentManager();
|
|
|
|
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
|
|
|
|
positiveButton$default.show(parentFragmentManager);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void showRemove2FAModal() {
|
|
|
|
WidgetNoticeDialog.Companion companion = WidgetNoticeDialog.Companion;
|
|
|
|
AppActivity appActivity = getAppActivity();
|
|
|
|
if (appActivity != null) {
|
2021-08-09 22:51:56 +00:00
|
|
|
String string = requireContext().getString(R.string.two_fa_remove);
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(string, "requireContext().getString(R.string.two_fa_remove)");
|
2021-08-09 22:51:56 +00:00
|
|
|
String string2 = requireContext().getString(R.string.user_settings_mfa_enable_code_body);
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(string2, "requireContext().getStri…ngs_mfa_enable_code_body)");
|
2021-08-09 22:51:56 +00:00
|
|
|
String string3 = requireContext().getString(R.string.two_fa_auth_code);
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(string3, "requireContext().getStri….string.two_fa_auth_code)");
|
|
|
|
WidgetNoticeDialog.Companion.showInputModal$default(companion, appActivity, string, string2, string3, new WidgetSettingsAccount$showRemove2FAModal$1(this), null, null, 96, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.app.AppFragment, androidx.fragment.app.Fragment
|
|
|
|
public void onActivityResult(int i, int i2, Intent intent) {
|
|
|
|
super.onActivityResult(i, i2, intent);
|
|
|
|
if (i == 4008) {
|
|
|
|
GoogleSmartLockManager.Companion.handleResult(i2, intent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
|
|
public void onViewBound(View view) {
|
|
|
|
m.checkNotNullParameter(view, "view");
|
|
|
|
super.onViewBound(view);
|
2021-08-09 22:51:56 +00:00
|
|
|
setActionBarSubtitle(R.string.user_settings);
|
|
|
|
setActionBarTitle(R.string.user_settings_my_account);
|
2021-08-03 07:33:18 +00:00
|
|
|
AppFragment.setActionBarDisplayHomeAsUpEnabled$default(this, false, 1, null);
|
|
|
|
setRetainInstance(true);
|
2021-08-09 22:51:56 +00:00
|
|
|
if (getMostRecentIntent().getBooleanExtra(EXTRA_HINT_DATA_MANAGEMENT, false)) {
|
2021-08-10 21:19:22 +00:00
|
|
|
LinearLayout linearLayout = getBinding().v;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.settingsAccountPrivateDataWrap");
|
|
|
|
CoroutineScope coroutineScope = ViewCoroutineScopeKt.getCoroutineScope(linearLayout);
|
|
|
|
if (coroutineScope != null) {
|
2021-09-27 20:31:35 +00:00
|
|
|
c.q.a.k.a.H(coroutineScope, null, null, new WidgetSettingsAccount$onViewBound$1(this, null), 3, null);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
|
|
public void onViewBoundOrOnResume() {
|
|
|
|
super.onViewBoundOrOnResume();
|
|
|
|
Observable<Model> r = Model.Companion.get().r();
|
|
|
|
m.checkNotNullExpressionValue(r, "Model\n .get()\n … .distinctUntilChanged()");
|
|
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.computationLatest(r), this, null, 2, null), WidgetSettingsAccount.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetSettingsAccount$onViewBoundOrOnResume$1(this), 62, (Object) null);
|
|
|
|
}
|
|
|
|
}
|