2021-08-03 07:33:18 +00:00
|
|
|
package com.discord.widgets.settings.account;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.net.Uri;
|
|
|
|
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;
|
|
|
|
import c.a.e.l;
|
|
|
|
import c.a.e.o;
|
|
|
|
import c.a.l.b;
|
|
|
|
import c.d.b.a.a;
|
|
|
|
import com.airbnb.lottie.LottieAnimationView;
|
|
|
|
import com.discord.api.user.User;
|
|
|
|
import com.discord.app.AppActivity;
|
|
|
|
import com.discord.app.AppFragment;
|
|
|
|
import com.discord.app.AppViewFlipper;
|
|
|
|
import com.discord.databinding.WidgetSettingsAccountBinding;
|
|
|
|
import com.discord.dialogs.ImageUploadDialog;
|
|
|
|
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.color.ColorCompat;
|
|
|
|
import com.discord.utilities.icon.IconUtils;
|
|
|
|
import com.discord.utilities.images.MGImages;
|
|
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
|
|
import com.discord.utilities.stateful.StatefulViews;
|
|
|
|
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.CustomProfilesEditingFeatureFlag;
|
|
|
|
import com.discord.widgets.settings.account.WidgetEnableSMSBackupDialog;
|
|
|
|
import com.facebook.drawee.view.SimpleDraweeView;
|
|
|
|
import com.google.android.material.button.MaterialButton;
|
|
|
|
import d0.g0.t;
|
|
|
|
import d0.g0.w;
|
|
|
|
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;
|
|
|
|
import rx.functions.Action1;
|
|
|
|
/* compiled from: WidgetSettingsAccount.kt */
|
|
|
|
public final class WidgetSettingsAccount extends AppFragment {
|
|
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.V(WidgetSettingsAccount.class, "binding", "getBinding()Lcom/discord/databinding/WidgetSettingsAccountBinding;", 0)};
|
|
|
|
public static final Companion Companion = new Companion(null);
|
|
|
|
private static final String DEFAULT_AVATAR_URL_SEGMENT = "asset://asset/images/default_avatar";
|
|
|
|
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 Action1<String> accountAvatarSelectedResult;
|
|
|
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetSettingsAccount$binding$2.INSTANCE, null, 2, null);
|
|
|
|
private String lastIconUrl;
|
2021-08-04 23:47:20 +00:00
|
|
|
private final StatefulViews state = new StatefulViews(2131364985);
|
2021-08-03 07:33:18 +00:00
|
|
|
|
|
|
|
/* 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();
|
|
|
|
intent.putExtra("com.discord.extra.HINT_DATA_MANAGEMENT", z2);
|
|
|
|
intent.putExtra("extra_redirect", redirect);
|
|
|
|
if (redirect != null) {
|
|
|
|
intent.addFlags(268435456);
|
|
|
|
intent.addFlags(67108864);
|
|
|
|
}
|
|
|
|
l.d(context, WidgetSettingsAccount.class, intent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: WidgetSettingsAccount.kt */
|
|
|
|
public static final class Model {
|
|
|
|
public static final Companion Companion = new Companion(null);
|
|
|
|
private final ModelConnectedAccount contactSyncConnection;
|
|
|
|
private final boolean isCustomProfileEditingEnabled;
|
|
|
|
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;
|
|
|
|
Observable<Model> f = Observable.f(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), CustomProfilesEditingFeatureFlag.Companion.getINSTANCE().observeIsEnabled(), WidgetSettingsAccount$Model$Companion$get$1.INSTANCE);
|
|
|
|
m.checkNotNullExpressionValue(f, "Observable.combineLatest… )\n }");
|
|
|
|
return f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public Model(MeUser meUser, StoreMFA.State state, boolean z2, ModelConnectedAccount modelConnectedAccount, boolean z3) {
|
|
|
|
m.checkNotNullParameter(meUser, "meUser");
|
|
|
|
m.checkNotNullParameter(state, "pendingMFAState");
|
|
|
|
this.meUser = meUser;
|
|
|
|
this.pendingMFAState = state;
|
|
|
|
this.ownsAnyGuilds = z2;
|
|
|
|
this.contactSyncConnection = modelConnectedAccount;
|
|
|
|
this.isCustomProfileEditingEnabled = z3;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static /* synthetic */ Model copy$default(Model model, MeUser meUser, StoreMFA.State state, boolean z2, ModelConnectedAccount modelConnectedAccount, boolean z3, int i, Object obj) {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
if ((i & 16) != 0) {
|
|
|
|
z3 = model.isCustomProfileEditingEnabled;
|
|
|
|
}
|
|
|
|
return model.copy(meUser, state, z2, modelConnectedAccount, z3);
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final boolean component5() {
|
|
|
|
return this.isCustomProfileEditingEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Model copy(MeUser meUser, StoreMFA.State state, boolean z2, ModelConnectedAccount modelConnectedAccount, boolean z3) {
|
|
|
|
m.checkNotNullParameter(meUser, "meUser");
|
|
|
|
m.checkNotNullParameter(state, "pendingMFAState");
|
|
|
|
return new Model(meUser, state, z2, modelConnectedAccount, z3);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
if (this == obj) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!(obj instanceof Model)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
Model model = (Model) obj;
|
|
|
|
return m.areEqual(this.meUser, model.meUser) && m.areEqual(this.pendingMFAState, model.pendingMFAState) && this.ownsAnyGuilds == model.ownsAnyGuilds && m.areEqual(this.contactSyncConnection, model.contactSyncConnection) && this.isCustomProfileEditingEnabled == model.isCustomProfileEditingEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
int i2 = 1;
|
|
|
|
if (z2) {
|
|
|
|
z2 = true;
|
|
|
|
}
|
|
|
|
int i3 = z2 ? 1 : 0;
|
|
|
|
int i4 = z2 ? 1 : 0;
|
|
|
|
int i5 = z2 ? 1 : 0;
|
|
|
|
int i6 = (hashCode2 + i3) * 31;
|
|
|
|
ModelConnectedAccount modelConnectedAccount = this.contactSyncConnection;
|
|
|
|
if (modelConnectedAccount != null) {
|
|
|
|
i = modelConnectedAccount.hashCode();
|
|
|
|
}
|
|
|
|
int i7 = (i6 + i) * 31;
|
|
|
|
boolean z3 = this.isCustomProfileEditingEnabled;
|
|
|
|
if (!z3) {
|
|
|
|
i2 = z3 ? 1 : 0;
|
|
|
|
}
|
|
|
|
return i7 + i2;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final boolean isCustomProfileEditingEnabled() {
|
|
|
|
return this.isCustomProfileEditingEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
StringBuilder K = a.K("Model(meUser=");
|
|
|
|
K.append(this.meUser);
|
|
|
|
K.append(", pendingMFAState=");
|
|
|
|
K.append(this.pendingMFAState);
|
|
|
|
K.append(", ownsAnyGuilds=");
|
|
|
|
K.append(this.ownsAnyGuilds);
|
|
|
|
K.append(", contactSyncConnection=");
|
|
|
|
K.append(this.contactSyncConnection);
|
|
|
|
K.append(", isCustomProfileEditingEnabled=");
|
|
|
|
return a.F(K, this.isCustomProfileEditingEnabled, ")");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: WidgetSettingsAccount.kt */
|
|
|
|
public enum Redirect {
|
|
|
|
SMS_BACKUP
|
|
|
|
}
|
|
|
|
|
|
|
|
public WidgetSettingsAccount() {
|
2021-08-06 20:07:13 +00:00
|
|
|
super(2131559242);
|
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 */ void access$configureUpdatedUser(WidgetSettingsAccount widgetSettingsAccount, User user) {
|
|
|
|
widgetSettingsAccount.configureUpdatedUser(user);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ WidgetSettingsAccountBinding access$getBinding$p(WidgetSettingsAccount widgetSettingsAccount) {
|
|
|
|
return widgetSettingsAccount.getBinding();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ StatefulViews access$getState$p(WidgetSettingsAccount widgetSettingsAccount) {
|
|
|
|
return widgetSettingsAccount.state;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$setIcon(WidgetSettingsAccount widgetSettingsAccount, com.discord.models.user.User user) {
|
|
|
|
widgetSettingsAccount.setIcon(user);
|
|
|
|
}
|
|
|
|
|
|
|
|
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) {
|
|
|
|
RelativeLayout relativeLayout = getBinding().J;
|
|
|
|
m.checkNotNullExpressionValue(relativeLayout, "binding.settingsAccountVerification");
|
|
|
|
relativeLayout.setVisibility(meUser.isVerified() ^ true ? 0 : 8);
|
|
|
|
if (meUser.getEmail() == null) {
|
|
|
|
TextView textView = getBinding().L;
|
|
|
|
m.checkNotNullExpressionValue(textView, "binding.settingsAccountVerificationTitle");
|
2021-08-06 20:07:13 +00:00
|
|
|
textView.setText(getString(2131886249));
|
2021-08-03 07:33:18 +00:00
|
|
|
MaterialButton materialButton = getBinding().K;
|
|
|
|
m.checkNotNullExpressionValue(materialButton, "binding.settingsAccountVerificationButton");
|
2021-08-06 20:07:13 +00:00
|
|
|
materialButton.setText(getString(2131886251));
|
2021-08-03 07:33:18 +00:00
|
|
|
} else {
|
|
|
|
TextView textView2 = getBinding().L;
|
|
|
|
m.checkNotNullExpressionValue(textView2, "binding.settingsAccountVerificationTitle");
|
2021-08-06 20:07:13 +00:00
|
|
|
textView2.setText(getString(2131894938));
|
2021-08-03 07:33:18 +00:00
|
|
|
MaterialButton materialButton2 = getBinding().K;
|
|
|
|
m.checkNotNullExpressionValue(materialButton2, "binding.settingsAccountVerificationButton");
|
2021-08-06 20:07:13 +00:00
|
|
|
materialButton2.setText(getString(2131894923));
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
getBinding().K.setOnClickListener(WidgetSettingsAccount$configureAccountVerificationBanner$1.INSTANCE);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void configureMFA(boolean z2, boolean z3) {
|
|
|
|
TextView textView = getBinding().p;
|
|
|
|
m.checkNotNullExpressionValue(textView, "binding.settingsAccountMfaEnabledHeader");
|
|
|
|
int i = 0;
|
|
|
|
textView.setVisibility(z2 ? 0 : 8);
|
|
|
|
AppViewFlipper appViewFlipper = getBinding().q;
|
|
|
|
m.checkNotNullExpressionValue(appViewFlipper, "binding.settingsAccountMfaFlipper");
|
|
|
|
appViewFlipper.setDisplayedChild(!z2 ? 1 : 0);
|
|
|
|
LottieAnimationView lottieAnimationView = getBinding().r;
|
|
|
|
m.checkNotNullExpressionValue(lottieAnimationView, "binding.settingsAccountMfaLottie");
|
|
|
|
lottieAnimationView.setVisibility(z2 ^ true ? 0 : 8);
|
2021-08-06 20:07:13 +00:00
|
|
|
TextView textView2 = getBinding().f1941s;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(textView2, "binding.settingsAccountMfaSalesPitch");
|
|
|
|
textView2.setVisibility(z2 ^ true ? 0 : 8);
|
|
|
|
MaterialButton materialButton = getBinding().n;
|
|
|
|
m.checkNotNullExpressionValue(materialButton, "binding.settingsAccountMfaEnable");
|
|
|
|
if (!(!z2)) {
|
|
|
|
i = 8;
|
|
|
|
}
|
|
|
|
materialButton.setVisibility(i);
|
|
|
|
MaterialButton materialButton2 = getBinding().n;
|
|
|
|
m.checkNotNullExpressionValue(materialButton2, "binding.settingsAccountMfaEnable");
|
|
|
|
materialButton2.setEnabled(!z3);
|
|
|
|
TextView textView3 = getBinding().M;
|
|
|
|
m.checkNotNullExpressionValue(textView3, "binding.settingsAccountViewBackupCodes");
|
|
|
|
textView3.setEnabled(!z3);
|
|
|
|
TextView textView4 = getBinding().B;
|
|
|
|
m.checkNotNullExpressionValue(textView4, "binding.settingsAccountRemoveTwoFa");
|
|
|
|
textView4.setEnabled(!z3);
|
|
|
|
LinearLayout linearLayout = getBinding().m;
|
|
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.settingsAccountMfaDisabledContainer");
|
|
|
|
ViewExtensions.setEnabledAlpha$default(linearLayout, !z3, 0.0f, 2, null);
|
|
|
|
LinearLayout linearLayout2 = getBinding().o;
|
|
|
|
m.checkNotNullExpressionValue(linearLayout2, "binding.settingsAccountMfaEnabledContainer");
|
|
|
|
ViewExtensions.setEnabledAlpha$default(linearLayout2, !z3, 0.0f, 2, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void configureUI(Model model) {
|
|
|
|
String str;
|
|
|
|
RelativeLayout relativeLayout = getBinding().b;
|
|
|
|
m.checkNotNullExpressionValue(relativeLayout, "binding.avatarEditSection");
|
|
|
|
int i = 8;
|
|
|
|
relativeLayout.setVisibility(model.isCustomProfileEditingEnabled() ^ true ? 0 : 8);
|
2021-08-06 20:07:13 +00:00
|
|
|
View view = getBinding().f1940c;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(view, "binding.avatarEditSectionBottomDivider");
|
|
|
|
view.setVisibility(model.isCustomProfileEditingEnabled() ^ true ? 0 : 8);
|
|
|
|
MeUser component1 = model.component1();
|
|
|
|
StoreMFA.State component2 = model.component2();
|
|
|
|
ModelConnectedAccount component4 = model.component4();
|
|
|
|
configureAccountVerificationBanner(component1);
|
|
|
|
TextView textView = getBinding().G;
|
|
|
|
m.checkNotNullExpressionValue(textView, "binding.settingsAccountTag");
|
|
|
|
UserUtils userUtils = UserUtils.INSTANCE;
|
|
|
|
TextView textView2 = getBinding().G;
|
|
|
|
m.checkNotNullExpressionValue(textView2, "binding.settingsAccountTag");
|
|
|
|
textView.setText(UserUtils.getUserNameWithDiscriminator$default(userUtils, component1, Integer.valueOf(ColorCompat.getThemedColor(textView2.getContext(), 2130969888)), null, 2, null));
|
|
|
|
LinearLayout linearLayout = getBinding().t;
|
|
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.settingsAccountNameContainer");
|
|
|
|
linearLayout.setVisibility(component4 != null ? 0 : 8);
|
|
|
|
TextView textView3 = getBinding().u;
|
|
|
|
m.checkNotNullExpressionValue(textView3, "binding.settingsAccountNameText");
|
|
|
|
if (component4 == null || (str = component4.getUsername()) == null) {
|
|
|
|
str = "";
|
|
|
|
}
|
|
|
|
textView3.setText(str);
|
|
|
|
TextView textView4 = getBinding().I;
|
|
|
|
m.checkNotNullExpressionValue(textView4, "binding.settingsAccountTagText");
|
|
|
|
textView4.setText(UserUtils.getUserNameWithDiscriminator$default(userUtils, component1, null, null, 3, null));
|
|
|
|
TextView textView5 = getBinding().j;
|
|
|
|
m.checkNotNullExpressionValue(textView5, "binding.settingsAccountEmailText");
|
|
|
|
textView5.setText(component1.getEmail());
|
|
|
|
TextView textView6 = getBinding().w;
|
|
|
|
m.checkNotNullExpressionValue(textView6, "binding.settingsAccountPhoneText");
|
|
|
|
textView6.setText(component1.getPhoneNumber());
|
|
|
|
getBinding().h.setOnClickListener(new WidgetSettingsAccount$configureUI$1(this));
|
|
|
|
this.accountAvatarSelectedResult = new WidgetSettingsAccount$configureUI$2(this, component1);
|
|
|
|
setIcon(component1);
|
|
|
|
getBinding().A.setOnClickListener(new WidgetSettingsAccount$configureUI$3(this, component1));
|
|
|
|
getBinding().g.setOnClickListener(new WidgetSettingsAccount$configureUI$4(this));
|
|
|
|
getBinding().H.setOnClickListener(WidgetSettingsAccount$configureUI$5.INSTANCE);
|
|
|
|
getBinding().t.setOnClickListener(WidgetSettingsAccount$configureUI$6.INSTANCE);
|
|
|
|
getBinding().i.setOnClickListener(WidgetSettingsAccount$configureUI$7.INSTANCE);
|
|
|
|
getBinding().v.setOnClickListener(WidgetSettingsAccount$configureUI$8.INSTANCE);
|
|
|
|
this.state.configureSaveActionView(getBinding().C);
|
|
|
|
getBinding().C.setOnClickListener(new WidgetSettingsAccount$configureUI$9(this, component1));
|
|
|
|
TextView textView7 = getBinding().p;
|
|
|
|
m.checkNotNullExpressionValue(textView7, "binding.settingsAccountMfaEnabledHeader");
|
|
|
|
textView7.setVisibility(component1.getMfaEnabled() ? 0 : 8);
|
|
|
|
AppViewFlipper appViewFlipper = getBinding().q;
|
|
|
|
m.checkNotNullExpressionValue(appViewFlipper, "binding.settingsAccountMfaFlipper");
|
|
|
|
appViewFlipper.setDisplayedChild(!component1.getMfaEnabled());
|
|
|
|
LottieAnimationView lottieAnimationView = getBinding().r;
|
|
|
|
m.checkNotNullExpressionValue(lottieAnimationView, "binding.settingsAccountMfaLottie");
|
|
|
|
lottieAnimationView.setVisibility(component1.getMfaEnabled() ^ true ? 0 : 8);
|
2021-08-06 20:07:13 +00:00
|
|
|
TextView textView8 = getBinding().f1941s;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(textView8, "binding.settingsAccountMfaSalesPitch");
|
|
|
|
textView8.setVisibility(component1.getMfaEnabled() ^ true ? 0 : 8);
|
|
|
|
MaterialButton materialButton = getBinding().n;
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
getBinding().n.setOnClickListener(WidgetSettingsAccount$configureUI$10.INSTANCE);
|
|
|
|
getBinding().M.setOnClickListener(WidgetSettingsAccount$configureUI$11.INSTANCE);
|
|
|
|
getBinding().B.setOnClickListener(new WidgetSettingsAccount$configureUI$12(this));
|
|
|
|
getBinding().N.setOnClickListener(WidgetSettingsAccount$configureUI$13.INSTANCE);
|
2021-08-06 20:07:13 +00:00
|
|
|
getBinding().f1943y.setOnClickListener(new WidgetSettingsAccount$configureUI$14(this, model));
|
|
|
|
getBinding().f1942x.setOnClickListener(new WidgetSettingsAccount$configureUI$15(this, model));
|
2021-08-03 07:33:18 +00:00
|
|
|
String sMSBackupDisabledMessage = getSMSBackupDisabledMessage(component1);
|
|
|
|
CharSequence charSequence = null;
|
|
|
|
if (sMSBackupDisabledMessage != null || component2.isTogglingSMSBackup()) {
|
|
|
|
CheckedSetting.d(getBinding().E, null, 1);
|
|
|
|
TextView textView9 = getBinding().F;
|
|
|
|
m.checkNotNullExpressionValue(textView9, "binding.settingsAccountSmsPhone");
|
|
|
|
ViewExtensions.setEnabledAlpha$default(textView9, false, 0.0f, 2, null);
|
|
|
|
} else {
|
|
|
|
TextView textView10 = getBinding().F;
|
|
|
|
m.checkNotNullExpressionValue(textView10, "binding.settingsAccountSmsPhone");
|
|
|
|
ViewExtensions.setEnabledAlpha$default(textView10, true, 0.0f, 2, null);
|
|
|
|
getBinding().E.e(new WidgetSettingsAccount$configureUI$16(this, component1));
|
|
|
|
}
|
|
|
|
TextView textView11 = getBinding().F;
|
|
|
|
m.checkNotNullExpressionValue(textView11, "binding.settingsAccountSmsPhone");
|
|
|
|
if (component1.getPhoneNumber() != null) {
|
|
|
|
TextView textView12 = getBinding().F;
|
|
|
|
m.checkNotNullExpressionValue(textView12, "binding.settingsAccountSmsPhone");
|
|
|
|
Context context = textView12.getContext();
|
|
|
|
m.checkNotNullExpressionValue(context, "binding.settingsAccountSmsPhone.context");
|
2021-08-06 20:07:13 +00:00
|
|
|
charSequence = b.h(context, 2131891508, new Object[]{component1.getPhoneNumber()}, null, 4);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
ViewExtensions.setTextAndVisibilityBy(textView11, charSequence);
|
|
|
|
CheckedSetting checkedSetting = getBinding().E;
|
|
|
|
m.checkNotNullExpressionValue(checkedSetting, "binding.settingsAccountSmsBackup");
|
|
|
|
checkedSetting.setChecked(userUtils.isMfaSMSEnabled(component1));
|
|
|
|
CheckedSetting checkedSetting2 = getBinding().E;
|
|
|
|
if (sMSBackupDisabledMessage == null) {
|
2021-08-06 20:07:13 +00:00
|
|
|
sMSBackupDisabledMessage = getString(2131891509);
|
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);
|
|
|
|
if (getMostRecentIntent().getSerializableExtra("extra_redirect") == Redirect.SMS_BACKUP) {
|
|
|
|
getMostRecentIntent().removeExtra("extra_redirect");
|
|
|
|
WidgetEnableSMSBackupDialog.Companion companion = WidgetEnableSMSBackupDialog.Companion;
|
|
|
|
FragmentManager parentFragmentManager = getParentFragmentManager();
|
|
|
|
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
|
|
|
|
companion.show(parentFragmentManager, true);
|
|
|
|
}
|
|
|
|
for (TextView textView13 : n.listOf((Object[]) new TextView[]{getBinding().k, getBinding().e, getBinding().l})) {
|
|
|
|
AccessibilityUtils accessibilityUtils = AccessibilityUtils.INSTANCE;
|
|
|
|
m.checkNotNullExpressionValue(textView13, "header");
|
|
|
|
accessibilityUtils.setViewIsHeading(textView13);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void configureUpdatedUser(User user) {
|
2021-08-06 20:07:13 +00:00
|
|
|
o.i(this, 2131893359, 0, 4);
|
2021-08-03 07:33:18 +00:00
|
|
|
StatefulViews.clear$default(this.state, false, 1, null);
|
|
|
|
StoreStream.Companion.getAuthentication().setAuthed(user.q());
|
|
|
|
AppFragment.hideKeyboard$default(this, null, 1, null);
|
|
|
|
getBinding().D.fullScroll(33);
|
|
|
|
}
|
|
|
|
|
|
|
|
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-06 20:07:13 +00:00
|
|
|
return getString(2131891513);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
if (meUser.getEmail() == null) {
|
2021-08-06 20:07:13 +00:00
|
|
|
return getString(2131891512);
|
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 setIcon(com.discord.models.user.User user) {
|
|
|
|
StatefulViews statefulViews = this.state;
|
|
|
|
SimpleDraweeView simpleDraweeView = getBinding().f;
|
|
|
|
m.checkNotNullExpressionValue(simpleDraweeView, "binding.settingsAccountAvatar");
|
|
|
|
String str = (String) statefulViews.get(simpleDraweeView.getId(), IconUtils.getForUser$default(Long.valueOf(user.getId()), user.getAvatar(), Integer.valueOf(user.getDiscriminator()), true, null, 16, null));
|
|
|
|
boolean z2 = true;
|
|
|
|
if (!m.areEqual(str, this.lastIconUrl)) {
|
|
|
|
SimpleDraweeView simpleDraweeView2 = getBinding().f;
|
|
|
|
m.checkNotNullExpressionValue(simpleDraweeView2, "binding.settingsAccountAvatar");
|
|
|
|
IconUtils.setIcon$default(simpleDraweeView2, str, 2131165288, (Function1) null, (MGImages.ChangeDetector) null, 24, (Object) null);
|
|
|
|
this.lastIconUrl = str;
|
|
|
|
}
|
|
|
|
TextView textView = getBinding().A;
|
|
|
|
m.checkNotNullExpressionValue(textView, "binding.settingsAccountRemoveAvatar");
|
|
|
|
int i = 0;
|
|
|
|
if (str != null && w.contains$default((CharSequence) str, (CharSequence) "asset://asset/images/default_avatar", false, 2, (Object) null)) {
|
|
|
|
z2 = false;
|
|
|
|
}
|
|
|
|
if (!z2) {
|
|
|
|
i = 8;
|
|
|
|
}
|
|
|
|
textView.setVisibility(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void showOwnsGuildModal() {
|
2021-08-06 20:07:13 +00:00
|
|
|
WidgetNoticeDialog.Builder positiveButton$default = WidgetNoticeDialog.Builder.setPositiveButton$default(new WidgetNoticeDialog.Builder(requireContext()).setTitle(2131888080).setMessage(2131888081), 2131892004, (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-06 20:07:13 +00:00
|
|
|
String string = requireContext().getString(2131894461);
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(string, "requireContext().getString(R.string.two_fa_remove)");
|
2021-08-06 20:07:13 +00:00
|
|
|
String string2 = requireContext().getString(2131894801);
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(string2, "requireContext().getStri…ngs_mfa_enable_code_body)");
|
2021-08-06 20:07:13 +00:00
|
|
|
String string3 = requireContext().getString(2131894418);
|
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 onImageChosen(Uri uri, String str) {
|
|
|
|
m.checkNotNullParameter(uri, "uri");
|
|
|
|
m.checkNotNullParameter(str, "mimeType");
|
|
|
|
super.onImageChosen(uri, str);
|
|
|
|
if (!t.startsWith$default(str, "image", false, 2, null)) {
|
2021-08-06 20:07:13 +00:00
|
|
|
o.g(getContext(), 2131894783, 0, null, 12);
|
2021-08-03 07:33:18 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
FragmentManager parentFragmentManager = getParentFragmentManager();
|
|
|
|
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
|
|
|
|
MGImages.prepareImageUpload(uri, str, parentFragmentManager, this, this.accountAvatarSelectedResult, ImageUploadDialog.PreviewType.USER_AVATAR);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
|
|
public void onImageCropped(Uri uri, String str) {
|
|
|
|
m.checkNotNullParameter(uri, "uri");
|
|
|
|
m.checkNotNullParameter(str, "mimeType");
|
|
|
|
super.onImageCropped(uri, str);
|
|
|
|
MGImages.requestDataUrl(getContext(), uri, str, this.accountAvatarSelectedResult);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
|
|
public void onViewBound(View view) {
|
|
|
|
m.checkNotNullParameter(view, "view");
|
|
|
|
super.onViewBound(view);
|
2021-08-06 20:07:13 +00:00
|
|
|
setActionBarSubtitle(2131894701);
|
|
|
|
setActionBarTitle(2131894807);
|
2021-08-03 07:33:18 +00:00
|
|
|
AppFragment.setActionBarDisplayHomeAsUpEnabled$default(this, false, 1, null);
|
|
|
|
setRetainInstance(true);
|
|
|
|
this.state.setupUnsavedChangesConfirmation(this);
|
|
|
|
this.state.setupTextWatcherWithSaveAction(this, getBinding().C, new View[0]);
|
|
|
|
if (getMostRecentIntent().getBooleanExtra("com.discord.extra.HINT_DATA_MANAGEMENT", false)) {
|
2021-08-06 20:07:13 +00:00
|
|
|
LinearLayout linearLayout = getBinding().f1944z;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.settingsAccountPrivateDataWrap");
|
|
|
|
CoroutineScope coroutineScope = ViewCoroutineScopeKt.getCoroutineScope(linearLayout);
|
|
|
|
if (coroutineScope != null) {
|
|
|
|
c.q.a.k.a.G(coroutineScope, null, null, new WidgetSettingsAccount$onViewBound$1(this, null), 3, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@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);
|
|
|
|
}
|
|
|
|
}
|