package com.discord.widgets.settings; import android.annotation.SuppressLint; import android.content.Context; import android.text.method.LinkMovementMethod; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import androidx.appcompat.app.AlertDialog; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import c.a.d.f; import c.a.d.l; import c.a.d.q; import c.a.i.o5; import c.a.k.b; import c.d.b.a.a; import com.discord.app.AppFragment; import com.discord.databinding.ViewDialogConfirmationBinding; import com.discord.databinding.WidgetSettingsPrivacyBinding; import com.discord.models.domain.Consents; import com.discord.models.domain.Harvest; import com.discord.models.domain.ModelConnectedAccount; import com.discord.models.domain.ModelUserSettings; import com.discord.models.experiments.domain.Experiment; import com.discord.models.user.MeUser; import com.discord.stores.StoreStream; import com.discord.stores.StoreUser; import com.discord.stores.StoreUserConnections; import com.discord.stores.StoreUserSettings; import com.discord.utilities.accessibility.AccessibilityUtils; import com.discord.utilities.rest.RestAPI; import com.discord.utilities.rx.ObservableExtensionsKt; import com.discord.utilities.time.TimeUtils; import com.discord.utilities.user.UserUtils; import com.discord.utilities.viewbinding.FragmentViewBindingDelegate; import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt; import com.discord.views.CheckedSetting; import com.discord.views.RadioManager; import com.discord.widgets.notice.WidgetNoticeDialog; import com.google.android.material.button.MaterialButton; import d0.g; import d0.t.n; import d0.t.n0; import d0.z.d.m; import j0.l.e.j; import java.util.List; import kotlin.Lazy; import kotlin.Unit; import kotlin.jvm.functions.Function0; import kotlin.jvm.functions.Function1; import kotlin.jvm.functions.Function5; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.reflect.KProperty; import rx.Observable; import rx.functions.Func7; /* compiled from: WidgetSettingsPrivacy.kt */ public final class WidgetSettingsPrivacy extends AppFragment { public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.V(WidgetSettingsPrivacy.class, "binding", "getBinding()Lcom/discord/databinding/WidgetSettingsPrivacyBinding;", 0)}; public static final Companion Companion = new Companion(null); private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetSettingsPrivacy$binding$2.INSTANCE, null, 2, null); private AlertDialog dialog; private final Lazy explicitContentRadios$delegate = g.lazy(new WidgetSettingsPrivacy$explicitContentRadios$2(this)); private final Lazy friendSourceRadios$delegate = g.lazy(new WidgetSettingsPrivacy$friendSourceRadios$2(this)); private RadioManager radioManagerExplicit; private final StoreUserSettings userSettings = StoreStream.Companion.getUserSettings(); /* compiled from: WidgetSettingsPrivacy.kt */ public static final class Companion { private Companion() { } public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } public final void launch(Context context) { m.checkNotNullParameter(context, "context"); l.e(context, WidgetSettingsPrivacy.class, null, 4); } } /* compiled from: WidgetSettingsPrivacy.kt */ public static final class LocalState { private final ModelConnectedAccount contactSyncConnection; private final Experiment contactSyncExperiment; private final boolean defaultRestrictedGuilds; private final int explicitContentFilter; private final ModelUserSettings.FriendSourceFlags friendSourceFlags; /* renamed from: me reason: collision with root package name */ private final MeUser f2169me; private final int userDiscoveryFlags; public LocalState(MeUser meUser, int i, boolean z2, ModelUserSettings.FriendSourceFlags friendSourceFlags, ModelConnectedAccount modelConnectedAccount, Experiment experiment, int i2) { m.checkNotNullParameter(meUser, "me"); this.f2169me = meUser; this.explicitContentFilter = i; this.defaultRestrictedGuilds = z2; this.friendSourceFlags = friendSourceFlags; this.contactSyncConnection = modelConnectedAccount; this.contactSyncExperiment = experiment; this.userDiscoveryFlags = i2; } public static /* synthetic */ LocalState copy$default(LocalState localState, MeUser meUser, int i, boolean z2, ModelUserSettings.FriendSourceFlags friendSourceFlags, ModelConnectedAccount modelConnectedAccount, Experiment experiment, int i2, int i3, Object obj) { if ((i3 & 1) != 0) { meUser = localState.f2169me; } if ((i3 & 2) != 0) { i = localState.explicitContentFilter; } if ((i3 & 4) != 0) { z2 = localState.defaultRestrictedGuilds; } if ((i3 & 8) != 0) { friendSourceFlags = localState.friendSourceFlags; } if ((i3 & 16) != 0) { modelConnectedAccount = localState.contactSyncConnection; } if ((i3 & 32) != 0) { experiment = localState.contactSyncExperiment; } if ((i3 & 64) != 0) { i2 = localState.userDiscoveryFlags; } return localState.copy(meUser, i, z2, friendSourceFlags, modelConnectedAccount, experiment, i2); } public final MeUser component1() { return this.f2169me; } public final int component2() { return this.explicitContentFilter; } public final boolean component3() { return this.defaultRestrictedGuilds; } public final ModelUserSettings.FriendSourceFlags component4() { return this.friendSourceFlags; } public final ModelConnectedAccount component5() { return this.contactSyncConnection; } public final Experiment component6() { return this.contactSyncExperiment; } public final int component7() { return this.userDiscoveryFlags; } public final LocalState copy(MeUser meUser, int i, boolean z2, ModelUserSettings.FriendSourceFlags friendSourceFlags, ModelConnectedAccount modelConnectedAccount, Experiment experiment, int i2) { m.checkNotNullParameter(meUser, "me"); return new LocalState(meUser, i, z2, friendSourceFlags, modelConnectedAccount, experiment, i2); } public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof LocalState)) { return false; } LocalState localState = (LocalState) obj; return m.areEqual(this.f2169me, localState.f2169me) && this.explicitContentFilter == localState.explicitContentFilter && this.defaultRestrictedGuilds == localState.defaultRestrictedGuilds && m.areEqual(this.friendSourceFlags, localState.friendSourceFlags) && m.areEqual(this.contactSyncConnection, localState.contactSyncConnection) && m.areEqual(this.contactSyncExperiment, localState.contactSyncExperiment) && this.userDiscoveryFlags == localState.userDiscoveryFlags; } public final ModelConnectedAccount getContactSyncConnection() { return this.contactSyncConnection; } public final Experiment getContactSyncExperiment() { return this.contactSyncExperiment; } public final boolean getDefaultRestrictedGuilds() { return this.defaultRestrictedGuilds; } public final int getExplicitContentFilter() { return this.explicitContentFilter; } public final ModelUserSettings.FriendSourceFlags getFriendSourceFlags() { return this.friendSourceFlags; } public final MeUser getMe() { return this.f2169me; } public final int getUserDiscoveryFlags() { return this.userDiscoveryFlags; } public int hashCode() { MeUser meUser = this.f2169me; int i = 0; int hashCode = (((meUser != null ? meUser.hashCode() : 0) * 31) + this.explicitContentFilter) * 31; boolean z2 = this.defaultRestrictedGuilds; if (z2) { z2 = true; } int i2 = z2 ? 1 : 0; int i3 = z2 ? 1 : 0; int i4 = z2 ? 1 : 0; int i5 = (hashCode + i2) * 31; ModelUserSettings.FriendSourceFlags friendSourceFlags = this.friendSourceFlags; int hashCode2 = (i5 + (friendSourceFlags != null ? friendSourceFlags.hashCode() : 0)) * 31; ModelConnectedAccount modelConnectedAccount = this.contactSyncConnection; int hashCode3 = (hashCode2 + (modelConnectedAccount != null ? modelConnectedAccount.hashCode() : 0)) * 31; Experiment experiment = this.contactSyncExperiment; if (experiment != null) { i = experiment.hashCode(); } return ((hashCode3 + i) * 31) + this.userDiscoveryFlags; } public String toString() { StringBuilder K = a.K("LocalState(me="); K.append(this.f2169me); K.append(", explicitContentFilter="); K.append(this.explicitContentFilter); K.append(", defaultRestrictedGuilds="); K.append(this.defaultRestrictedGuilds); K.append(", friendSourceFlags="); K.append(this.friendSourceFlags); K.append(", contactSyncConnection="); K.append(this.contactSyncConnection); K.append(", contactSyncExperiment="); K.append(this.contactSyncExperiment); K.append(", userDiscoveryFlags="); return a.w(K, this.userDiscoveryFlags, ")"); } } /* compiled from: WidgetSettingsPrivacy.kt */ public static final class Model { public static final Companion Companion = new Companion(null); private final Consents consents; private final ModelConnectedAccount contactSyncConnection; private final boolean defaultRestrictedGuilds; private final int explicitContentFilter; private final ModelUserSettings.FriendSourceFlags friendSourceFlags; private final RestAPI.HarvestState harvestState; /* renamed from: me reason: collision with root package name */ private final MeUser f2170me; private final boolean showContactSync; private final int userDiscoveryFlags; /* compiled from: WidgetSettingsPrivacy.kt */ public static final class Companion { private Companion() { } public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } /* JADX WARN: Multi-variable type inference failed */ /* JADX DEBUG: Type inference failed for r9v0. Raw type applied. Possible types: rx.Observable, rx.Observable */ /* JADX WARNING: Unknown variable types count: 1 */ public final Observable get() { StoreStream.Companion companion = StoreStream.Companion; Observable observeMe$default = StoreUser.observeMe$default(companion.getUsers(), false, 1, null); Observable observeExplicitContentFilter = companion.getUserSettings().observeExplicitContentFilter(); Observable observeIsDefaultGuildsRestricted = companion.getUserSettings().observeIsDefaultGuildsRestricted(); Observable observeFriendSourceFlags = companion.getUserSettings().observeFriendSourceFlags(); Observable F = companion.getUserConnections().observeConnectedAccounts().F(WidgetSettingsPrivacy$Model$Companion$get$1.INSTANCE); Observable observeUserExperiment = companion.getExperiments().observeUserExperiment("2021-04_contact_sync_android_main", true); Observable observeFriendDiscoveryFlags = companion.getUserSettings().observeFriendDiscoveryFlags(); WidgetSettingsPrivacy$Model$Companion$get$2 widgetSettingsPrivacy$Model$Companion$get$2 = WidgetSettingsPrivacy$Model$Companion$get$2.INSTANCE; if (widgetSettingsPrivacy$Model$Companion$get$2 != null) { widgetSettingsPrivacy$Model$Companion$get$2 = new WidgetSettingsPrivacy$sam$rx_functions_Func7$0(widgetSettingsPrivacy$Model$Companion$get$2); } Observable Y = Observable.e(observeMe$default, observeExplicitContentFilter, observeIsDefaultGuildsRestricted, observeFriendSourceFlags, F, observeUserExperiment, observeFriendDiscoveryFlags, (Func7) widgetSettingsPrivacy$Model$Companion$get$2).Y(WidgetSettingsPrivacy$Model$Companion$get$3.INSTANCE); m.checkNotNullExpressionValue(Y, "Observable\n .co… }\n }"); Observable r = ObservableExtensionsKt.computationLatest(Y).r(); m.checkNotNullExpressionValue(r, "Observable\n .co… .distinctUntilChanged()"); return r; } } public Model(MeUser meUser, int i, boolean z2, ModelUserSettings.FriendSourceFlags friendSourceFlags, int i2, ModelConnectedAccount modelConnectedAccount, boolean z3, Consents consents, RestAPI.HarvestState harvestState) { m.checkNotNullParameter(meUser, "me"); m.checkNotNullParameter(consents, "consents"); this.f2170me = meUser; this.explicitContentFilter = i; this.defaultRestrictedGuilds = z2; this.friendSourceFlags = friendSourceFlags; this.userDiscoveryFlags = i2; this.contactSyncConnection = modelConnectedAccount; this.showContactSync = z3; this.consents = consents; this.harvestState = harvestState; } public static /* synthetic */ Model copy$default(Model model, MeUser meUser, int i, boolean z2, ModelUserSettings.FriendSourceFlags friendSourceFlags, int i2, ModelConnectedAccount modelConnectedAccount, boolean z3, Consents consents, RestAPI.HarvestState harvestState, int i3, Object obj) { return model.copy((i3 & 1) != 0 ? model.f2170me : meUser, (i3 & 2) != 0 ? model.explicitContentFilter : i, (i3 & 4) != 0 ? model.defaultRestrictedGuilds : z2, (i3 & 8) != 0 ? model.friendSourceFlags : friendSourceFlags, (i3 & 16) != 0 ? model.userDiscoveryFlags : i2, (i3 & 32) != 0 ? model.contactSyncConnection : modelConnectedAccount, (i3 & 64) != 0 ? model.showContactSync : z3, (i3 & 128) != 0 ? model.consents : consents, (i3 & 256) != 0 ? model.harvestState : harvestState); } public final MeUser component1() { return this.f2170me; } public final int component2() { return this.explicitContentFilter; } public final boolean component3() { return this.defaultRestrictedGuilds; } public final ModelUserSettings.FriendSourceFlags component4() { return this.friendSourceFlags; } public final int component5() { return this.userDiscoveryFlags; } public final ModelConnectedAccount component6() { return this.contactSyncConnection; } public final boolean component7() { return this.showContactSync; } public final Consents component8() { return this.consents; } public final RestAPI.HarvestState component9() { return this.harvestState; } public final Model copy(MeUser meUser, int i, boolean z2, ModelUserSettings.FriendSourceFlags friendSourceFlags, int i2, ModelConnectedAccount modelConnectedAccount, boolean z3, Consents consents, RestAPI.HarvestState harvestState) { m.checkNotNullParameter(meUser, "me"); m.checkNotNullParameter(consents, "consents"); return new Model(meUser, i, z2, friendSourceFlags, i2, modelConnectedAccount, z3, consents, harvestState); } public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Model)) { return false; } Model model = (Model) obj; return m.areEqual(this.f2170me, model.f2170me) && this.explicitContentFilter == model.explicitContentFilter && this.defaultRestrictedGuilds == model.defaultRestrictedGuilds && m.areEqual(this.friendSourceFlags, model.friendSourceFlags) && this.userDiscoveryFlags == model.userDiscoveryFlags && m.areEqual(this.contactSyncConnection, model.contactSyncConnection) && this.showContactSync == model.showContactSync && m.areEqual(this.consents, model.consents) && m.areEqual(this.harvestState, model.harvestState); } public final Consents getConsents() { return this.consents; } public final ModelConnectedAccount getContactSyncConnection() { return this.contactSyncConnection; } public final boolean getDefaultRestrictedGuilds() { return this.defaultRestrictedGuilds; } public final int getExplicitContentFilter() { return this.explicitContentFilter; } public final ModelUserSettings.FriendSourceFlags getFriendSourceFlags() { return this.friendSourceFlags; } public final RestAPI.HarvestState getHarvestState() { return this.harvestState; } public final MeUser getMe() { return this.f2170me; } public final boolean getShowContactSync() { return this.showContactSync; } public final int getUserDiscoveryFlags() { return this.userDiscoveryFlags; } public int hashCode() { MeUser meUser = this.f2170me; int i = 0; int hashCode = (((meUser != null ? meUser.hashCode() : 0) * 31) + this.explicitContentFilter) * 31; boolean z2 = this.defaultRestrictedGuilds; int i2 = 1; if (z2) { z2 = true; } int i3 = z2 ? 1 : 0; int i4 = z2 ? 1 : 0; int i5 = z2 ? 1 : 0; int i6 = (hashCode + i3) * 31; ModelUserSettings.FriendSourceFlags friendSourceFlags = this.friendSourceFlags; int hashCode2 = (((i6 + (friendSourceFlags != null ? friendSourceFlags.hashCode() : 0)) * 31) + this.userDiscoveryFlags) * 31; ModelConnectedAccount modelConnectedAccount = this.contactSyncConnection; int hashCode3 = (hashCode2 + (modelConnectedAccount != null ? modelConnectedAccount.hashCode() : 0)) * 31; boolean z3 = this.showContactSync; if (!z3) { i2 = z3 ? 1 : 0; } int i7 = (hashCode3 + i2) * 31; Consents consents = this.consents; int hashCode4 = (i7 + (consents != null ? consents.hashCode() : 0)) * 31; RestAPI.HarvestState harvestState = this.harvestState; if (harvestState != null) { i = harvestState.hashCode(); } return hashCode4 + i; } public String toString() { StringBuilder K = a.K("Model(me="); K.append(this.f2170me); K.append(", explicitContentFilter="); K.append(this.explicitContentFilter); K.append(", defaultRestrictedGuilds="); K.append(this.defaultRestrictedGuilds); K.append(", friendSourceFlags="); K.append(this.friendSourceFlags); K.append(", userDiscoveryFlags="); K.append(this.userDiscoveryFlags); K.append(", contactSyncConnection="); K.append(this.contactSyncConnection); K.append(", showContactSync="); K.append(this.showContactSync); K.append(", consents="); K.append(this.consents); K.append(", harvestState="); K.append(this.harvestState); K.append(")"); return K.toString(); } } public WidgetSettingsPrivacy() { super(2131559243); } public static final /* synthetic */ void access$configureRequestDataButton(WidgetSettingsPrivacy widgetSettingsPrivacy, boolean z2, RestAPI.HarvestState harvestState) { widgetSettingsPrivacy.configureRequestDataButton(z2, harvestState); } public static final /* synthetic */ void access$configureUI(WidgetSettingsPrivacy widgetSettingsPrivacy, Model model) { widgetSettingsPrivacy.configureUI(model); } public static final /* synthetic */ void access$confirmConsent(WidgetSettingsPrivacy widgetSettingsPrivacy, Context context, Function5 function5) { widgetSettingsPrivacy.confirmConsent(context, function5); } public static final /* synthetic */ void access$deleteContactSync(WidgetSettingsPrivacy widgetSettingsPrivacy) { widgetSettingsPrivacy.deleteContactSync(); } public static final /* synthetic */ WidgetSettingsPrivacyBinding access$getBinding$p(WidgetSettingsPrivacy widgetSettingsPrivacy) { return widgetSettingsPrivacy.getBinding(); } public static final /* synthetic */ StoreUserSettings access$getUserSettings$p(WidgetSettingsPrivacy widgetSettingsPrivacy) { return widgetSettingsPrivacy.userSettings; } public static final /* synthetic */ void access$onRequestDataClick(WidgetSettingsPrivacy widgetSettingsPrivacy, Context context, RestAPI.HarvestState harvestState) { widgetSettingsPrivacy.onRequestDataClick(context, harvestState); } public static final /* synthetic */ void access$showDefaultGuildsRestrictedExistingServers(WidgetSettingsPrivacy widgetSettingsPrivacy, boolean z2) { widgetSettingsPrivacy.showDefaultGuildsRestrictedExistingServers(z2); } public static final /* synthetic */ void access$toggleConsent(WidgetSettingsPrivacy widgetSettingsPrivacy, boolean z2, String str, CheckedSetting checkedSetting) { widgetSettingsPrivacy.toggleConsent(z2, str, checkedSetting); } public static final /* synthetic */ void access$toggleContactSync(WidgetSettingsPrivacy widgetSettingsPrivacy, ModelConnectedAccount modelConnectedAccount, boolean z2) { widgetSettingsPrivacy.toggleContactSync(modelConnectedAccount, z2); } public static final /* synthetic */ void access$updateDefaultGuildsRestricted(WidgetSettingsPrivacy widgetSettingsPrivacy, boolean z2, boolean z3) { widgetSettingsPrivacy.updateDefaultGuildsRestricted(z2, z3); } public static final /* synthetic */ void access$updateFriendDiscoveryFlags(WidgetSettingsPrivacy widgetSettingsPrivacy, boolean z2, boolean z3) { widgetSettingsPrivacy.updateFriendDiscoveryFlags(z2, z3); } public static final /* synthetic */ void access$updateFriendSourceFlags(WidgetSettingsPrivacy widgetSettingsPrivacy, int i, boolean z2) { widgetSettingsPrivacy.updateFriendSourceFlags(i, z2); } private final void configureContactSyncOptions(Model model) { LinearLayout linearLayout = getBinding().j; m.checkNotNullExpressionValue(linearLayout, "binding.settingsPrivacyContactSync"); int i = 8; linearLayout.setVisibility(model.getShowContactSync() ? 0 : 8); if (model.getShowContactSync()) { TextView textView = getBinding().d; m.checkNotNullExpressionValue(textView, "binding.contactSyncSettingInfo"); b.l(textView, 2131887571, new Object[0], new WidgetSettingsPrivacy$configureContactSyncOptions$1(this)); TextView textView2 = getBinding().d; m.checkNotNullExpressionValue(textView2, "binding.contactSyncSettingInfo"); textView2.setMovementMethod(LinkMovementMethod.getInstance()); CheckedSetting checkedSetting = getBinding().f1956c; m.checkNotNullExpressionValue(checkedSetting, "binding.contactSyncSettingEnabled"); ModelConnectedAccount contactSyncConnection = model.getContactSyncConnection(); checkedSetting.setChecked(contactSyncConnection != null && contactSyncConnection.isFriendSync()); CheckedSetting checkedSetting2 = getBinding().e; m.checkNotNullExpressionValue(checkedSetting2, "binding.contactSyncSettingPhone"); checkedSetting2.setChecked((model.getUserDiscoveryFlags() & 2) == 2); CheckedSetting checkedSetting3 = getBinding().b; m.checkNotNullExpressionValue(checkedSetting3, "binding.contactSyncSettingEmail"); checkedSetting3.setChecked((model.getUserDiscoveryFlags() & 4) == 4); getBinding().f1956c.e(new WidgetSettingsPrivacy$configureContactSyncOptions$2(this, model)); getBinding().e.e(new WidgetSettingsPrivacy$configureContactSyncOptions$3(this)); getBinding().b.e(new WidgetSettingsPrivacy$configureContactSyncOptions$4(this)); CheckedSetting checkedSetting4 = getBinding().f; m.checkNotNullExpressionValue(checkedSetting4, "binding.contactSyncSettingStaffOnly"); if (UserUtils.INSTANCE.isStaff(model.getMe())) { i = 0; } checkedSetting4.setVisibility(i); CheckedSetting checkedSetting5 = getBinding().f; m.checkNotNullExpressionValue(checkedSetting5, "binding.contactSyncSettingStaffOnly"); checkedSetting5.setChecked(true); getBinding().f.e(new WidgetSettingsPrivacy$configureContactSyncOptions$5(this, model)); } } private final void configureDefaultGuildsRestricted(Model model) { CheckedSetting checkedSetting = getBinding().m; m.checkNotNullExpressionValue(checkedSetting, "binding.settingsPrivacyDefaultRestrictedGuilds"); checkedSetting.setChecked(!model.getDefaultRestrictedGuilds()); getBinding().m.e(new WidgetSettingsPrivacy$configureDefaultGuildsRestricted$1(this, model)); } private final void configureExplicitContentRadio(Model model, CheckedSetting checkedSetting, int i) { RadioManager radioManager; checkedSetting.e(new WidgetSettingsPrivacy$configureExplicitContentRadio$1(this, i)); if (this.radioManagerExplicit != null && model.getExplicitContentFilter() == i && (radioManager = this.radioManagerExplicit) != null) { radioManager.a(checkedSetting); } } private final void configureFriendSourceRadio(Model model) { boolean z2 = false; getFriendSourceRadios().get(0).setOnCheckedListener(new WidgetSettingsPrivacy$configureFriendSourceRadio$1(this)); getFriendSourceRadios().get(1).setOnCheckedListener(new WidgetSettingsPrivacy$configureFriendSourceRadio$2(this)); getFriendSourceRadios().get(2).setOnCheckedListener(new WidgetSettingsPrivacy$configureFriendSourceRadio$3(this)); ModelUserSettings.FriendSourceFlags friendSourceFlags = model.getFriendSourceFlags(); boolean isAll = friendSourceFlags != null ? friendSourceFlags.isAll() : false; CheckedSetting checkedSetting = getFriendSourceRadios().get(0); m.checkNotNullExpressionValue(checkedSetting, "friendSourceRadios[0]"); checkedSetting.setChecked(isAll); CheckedSetting checkedSetting2 = getFriendSourceRadios().get(1); m.checkNotNullExpressionValue(checkedSetting2, "friendSourceRadios[1]"); CheckedSetting checkedSetting3 = checkedSetting2; ModelUserSettings.FriendSourceFlags friendSourceFlags2 = model.getFriendSourceFlags(); checkedSetting3.setChecked((friendSourceFlags2 != null ? friendSourceFlags2.isMutualFriends() : false) || isAll); CheckedSetting checkedSetting4 = getFriendSourceRadios().get(2); m.checkNotNullExpressionValue(checkedSetting4, "friendSourceRadios[2]"); CheckedSetting checkedSetting5 = checkedSetting4; ModelUserSettings.FriendSourceFlags friendSourceFlags3 = model.getFriendSourceFlags(); if ((friendSourceFlags3 != null ? friendSourceFlags3.isMutualGuilds() : false) || isAll) { z2 = true; } checkedSetting5.setChecked(z2); } private final void configurePrivacyControls(Model model) { Context context = getContext(); if (context != null) { m.checkNotNullExpressionValue(context, "context ?: return"); LinearLayout linearLayout = getBinding().k; m.checkNotNullExpressionValue(linearLayout, "binding.settingsPrivacyControls"); linearLayout.setVisibility(0); CheckedSetting checkedSetting = getBinding().f1960z; m.checkNotNullExpressionValue(checkedSetting, "binding.settingsPrivacyStatistics"); checkedSetting.setChecked(model.getConsents().getUsageStatistics().getConsented()); getBinding().f1960z.setOnCheckedListener(new WidgetSettingsPrivacy$configurePrivacyControls$1(this, context)); CheckedSetting checkedSetting2 = getBinding().v; m.checkNotNullExpressionValue(checkedSetting2, "binding.settingsPrivacyPersonalization"); checkedSetting2.setChecked(model.getConsents().getPersonalization().getConsented()); getBinding().v.setOnCheckedListener(new WidgetSettingsPrivacy$configurePrivacyControls$2(this, context)); } } private final void configureRequestDataButton(boolean z2, RestAPI.HarvestState harvestState) { getBinding().w.setOnClickListener(new WidgetSettingsPrivacy$configureRequestDataButton$1(this, z2, harvestState)); } private final void configureUI(Model model) { configureDefaultGuildsRestricted(model); configureFriendSourceRadio(model); configureContactSyncOptions(model); CheckedSetting checkedSetting = getExplicitContentRadios().get(0); m.checkNotNullExpressionValue(checkedSetting, "explicitContentRadios[0]"); configureExplicitContentRadio(model, checkedSetting, 0); CheckedSetting checkedSetting2 = getExplicitContentRadios().get(1); m.checkNotNullExpressionValue(checkedSetting2, "explicitContentRadios[1]"); configureExplicitContentRadio(model, checkedSetting2, 1); CheckedSetting checkedSetting3 = getExplicitContentRadios().get(2); m.checkNotNullExpressionValue(checkedSetting3, "explicitContentRadios[2]"); configureExplicitContentRadio(model, checkedSetting3, 2); configurePrivacyControls(model); configureRequestDataButton(model.getMe().isVerified(), model.getHarvestState()); } private final void confirmConsent(Context context, Function5 function5) { ViewDialogConfirmationBinding a = ViewDialogConfirmationBinding.a(getLayoutInflater().inflate(2131558748, (ViewGroup) null, false)); m.checkNotNullExpressionValue(a, "ViewDialogConfirmationBi…outInflater, null, false)"); AlertDialog create = new AlertDialog.Builder(context).setView(a.a).setCancelable(false).create(); m.checkNotNullExpressionValue(create, "AlertDialog.Builder(this…(false)\n .create()"); TextView textView = a.d; m.checkNotNullExpressionValue(textView, "binding.viewDialogConfirmationHeader"); TextView textView2 = a.e; m.checkNotNullExpressionValue(textView2, "binding.viewDialogConfirmationText"); MaterialButton materialButton = a.b; m.checkNotNullExpressionValue(materialButton, "binding.viewDialogConfirmationCancel"); MaterialButton materialButton2 = a.f1654c; m.checkNotNullExpressionValue(materialButton2, "binding.viewDialogConfirmationConfirm"); function5.invoke(create, textView, textView2, materialButton, materialButton2); create.show(); } private final void deleteContactSync() { StoreStream.Companion companion = StoreStream.Companion; companion.getContactSync().clearDismissStates(); companion.getUserConnections().deleteUserConnection("contacts", "@me"); } private final WidgetSettingsPrivacyBinding getBinding() { return (WidgetSettingsPrivacyBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]); } private final List getExplicitContentRadios() { return (List) this.explicitContentRadios$delegate.getValue(); } private final List getFriendSourceRadios() { return (List) this.friendSourceRadios$delegate.getValue(); } public static final void launch(Context context) { Companion.launch(context); } private final void onRequestDataClick(Context context, RestAPI.HarvestState harvestState) { WidgetSettingsPrivacy$onRequestDataClick$4 widgetSettingsPrivacy$onRequestDataClick$4 = new WidgetSettingsPrivacy$onRequestDataClick$4(this, context, new WidgetSettingsPrivacy$onRequestDataClick$3(this, context, new WidgetSettingsPrivacy$onRequestDataClick$2(this, context), new WidgetSettingsPrivacy$onRequestDataClick$1(this, context))); if (harvestState instanceof RestAPI.HarvestState.NeverRequested) { widgetSettingsPrivacy$onRequestDataClick$4.mo1invoke(); } else if (harvestState instanceof RestAPI.HarvestState.LastRequested) { Harvest data = ((RestAPI.HarvestState.LastRequested) harvestState).getData(); if (Harvest.canRequest$default(data, 0, 1, null)) { widgetSettingsPrivacy$onRequestDataClick$4.mo1invoke(); } else { showNextAvailableRequestAlert(data.nextAvailableRequestInMillis()); } } } private final void showDefaultGuildsRestrictedExistingServers(boolean z2) { View inflate = getLayoutInflater().inflate(2131559244, (ViewGroup) null, false); int i = 2131364983; MaterialButton materialButton = (MaterialButton) inflate.findViewById(2131364983); if (materialButton != null) { i = 2131364984; MaterialButton materialButton2 = (MaterialButton) inflate.findViewById(2131364984); if (materialButton2 != null) { LinearLayout linearLayout = (LinearLayout) inflate; m.checkNotNullExpressionValue(new o5(linearLayout, materialButton, materialButton2), "WidgetSettingsPrivacyDef…outInflater, null, false)"); materialButton.setOnClickListener(new WidgetSettingsPrivacy$showDefaultGuildsRestrictedExistingServers$$inlined$apply$lambda$1(this, z2)); materialButton2.setOnClickListener(new WidgetSettingsPrivacy$showDefaultGuildsRestrictedExistingServers$$inlined$apply$lambda$2(this, z2)); AlertDialog alertDialog = this.dialog; if (alertDialog != null) { alertDialog.dismiss(); } m.checkNotNullExpressionValue(linearLayout, "binding.root"); AlertDialog create = new AlertDialog.Builder(linearLayout.getContext()).setView(linearLayout).create(); this.dialog = create; if (create != null) { create.show(); return; } return; } } throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i))); } private final void showNextAvailableRequestAlert(long j) { Context context = getContext(); if (context != null) { m.checkNotNullExpressionValue(context, "context ?: return"); WidgetNoticeDialog.Builder positiveButton$default = WidgetNoticeDialog.Builder.setPositiveButton$default(new WidgetNoticeDialog.Builder(context).setTitle(2131888041).setMessage(b.g(context, 2131888018, new Object[]{TimeUtils.renderUtcDate$default(TimeUtils.INSTANCE, j, context, 0, 4, null)}, null, 4)), 2131891822, (Function1) null, 2, (Object) null); FragmentManager parentFragmentManager = getParentFragmentManager(); m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager"); positiveButton$default.show(parentFragmentManager); } } private final void toggleConsent(boolean z2, String str, CheckedSetting checkedSetting) { ObservableExtensionsKt.withDimmer(ObservableExtensionsKt.ui$default(RestAPI.Companion.getApi().setConsent(z2, str), this, null, 2, null), getBinding().g, 100).k(q.a.g(getContext(), new WidgetSettingsPrivacy$toggleConsent$1(checkedSetting), new WidgetSettingsPrivacy$toggleConsent$2(checkedSetting, z2))); } private final void toggleContactSync(ModelConnectedAccount modelConnectedAccount, boolean z2) { if (modelConnectedAccount != null) { StoreStream.Companion companion = StoreStream.Companion; StoreUserConnections userConnections = companion.getUserConnections(); boolean isShowActivity = modelConnectedAccount.isShowActivity(); boolean z3 = true; if (modelConnectedAccount.getVisibility() != 1) { z3 = false; } userConnections.updateUserConnection(modelConnectedAccount, z2, isShowActivity, z3); if (z2) { companion.getContactSync().backgroundUploadContacts(); } } } private final void updateDefaultGuildsRestricted(boolean z2, boolean z3) { Observable Z = (!z3 ? new j(null) : !z2 ? new j(n0.emptySet()) : StoreStream.Companion.getGuilds().observeGuilds().F(WidgetSettingsPrivacy$updateDefaultGuildsRestricted$1.INSTANCE)).Z(1); m.checkNotNullExpressionValue(Z, "when {\n !applyToExi… }\n }\n .take(1)"); ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.computationLatest(Z), this, null, 2, null), WidgetSettingsPrivacy.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetSettingsPrivacy$updateDefaultGuildsRestricted$2(this, z2), 62, (Object) null); AlertDialog alertDialog = this.dialog; if (alertDialog != null) { alertDialog.dismiss(); } } private final void updateFriendDiscoveryFlags(boolean z2, boolean z3) { int i = z2 ? 2 : 0; if (z3) { i |= 4; } StoreStream.Companion.getUserSettings().setFriendDiscoveryFlags(getAppActivity(), i); } private final void updateFriendSourceFlags(int i, boolean z2) { boolean z3 = false; CheckedSetting checkedSetting = getFriendSourceRadios().get(0); m.checkNotNullExpressionValue(checkedSetting, "friendSourceRadios[0]"); boolean isChecked = checkedSetting.isChecked(); CheckedSetting checkedSetting2 = getFriendSourceRadios().get(1); m.checkNotNullExpressionValue(checkedSetting2, "friendSourceRadios[1]"); boolean isChecked2 = checkedSetting2.isChecked(); CheckedSetting checkedSetting3 = getFriendSourceRadios().get(2); m.checkNotNullExpressionValue(checkedSetting3, "friendSourceRadios[2]"); boolean isChecked3 = checkedSetting3.isChecked(); if ((isChecked && isChecked2 && isChecked3) || (i == 0 && z2)) { z3 = true; } StoreStream.Companion.getUserSettings().setFriendSourceFlags(getAppActivity(), Boolean.valueOf(z3), Boolean.valueOf(isChecked3), Boolean.valueOf(isChecked2)); } @Override // com.discord.app.AppFragment, androidx.fragment.app.Fragment public void onPause() { super.onPause(); AlertDialog alertDialog = this.dialog; if (alertDialog != null) { alertDialog.dismiss(); } } @Override // com.discord.app.AppFragment @SuppressLint({"SetTextI18n"}) public void onViewBound(View view) { m.checkNotNullParameter(view, "view"); super.onViewBound(view); AppFragment.setActionBarDisplayHomeAsUpEnabled$default(this, false, 1, null); setActionBarSubtitle(2131894487); setActionBarTitle(2131892545); this.radioManagerExplicit = new RadioManager(getExplicitContentRadios()); CheckedSetting checkedSetting = getBinding().v; CheckedSetting checkedSetting2 = getBinding().v; m.checkNotNullExpressionValue(checkedSetting2, "binding.settingsPrivacyPersonalization"); f fVar = f.a; checkedSetting.h(b.i(checkedSetting2, 2131888025, new Object[]{fVar.a(360004109911L, null)}, null, 4), true); CheckedSetting checkedSetting3 = getBinding().f1959y; CheckedSetting checkedSetting4 = getBinding().f1959y; m.checkNotNullExpressionValue(checkedSetting4, "binding.settingsPrivacyScreenreaderDetection"); checkedSetting3.h(b.i(checkedSetting4, 2131888020, new Object[]{fVar.a(360035966492L, null)}, null, 4), true); CheckedSetting checkedSetting5 = getBinding().f1959y; checkedSetting5.setOnCheckedListener(new WidgetSettingsPrivacy$onViewBound$$inlined$apply$lambda$1(checkedSetting5, this)); getBinding().i.setButtonVisibility(false); CheckedSetting checkedSetting6 = getBinding().i; CheckedSetting checkedSetting7 = getBinding().i; m.checkNotNullExpressionValue(checkedSetting7, "binding.settingsPrivacyBasicService"); checkedSetting6.h(b.c(checkedSetting7, 2131888022, new Object[0], WidgetSettingsPrivacy$onViewBound$2.INSTANCE), true); getBinding().i.e(WidgetSettingsPrivacy$onViewBound$3.INSTANCE); String a = fVar.a(360004027692L, null); TextView textView = getBinding().h; m.checkNotNullExpressionValue(textView, "binding.requestDataLink"); StringBuilder sb = new StringBuilder(); sb.append('['); TextView textView2 = getBinding().h; m.checkNotNullExpressionValue(textView2, "binding.requestDataLink"); sb.append(b.i(textView2, 2131891672, new Object[0], null, 4)); sb.append("]("); sb.append(a); sb.append(')'); textView.setText(b.k(sb.toString(), new Object[0], null, 2)); getBinding().h.setOnClickListener(new WidgetSettingsPrivacy$onViewBound$4(a)); CheckedSetting checkedSetting8 = getBinding().f1960z; CheckedSetting checkedSetting9 = getBinding().f1960z; m.checkNotNullExpressionValue(checkedSetting9, "binding.settingsPrivacyStatistics"); checkedSetting8.h(b.i(checkedSetting9, 2131888039, new Object[]{fVar.a(360004109911L, null)}, null, 4), true); for (TextView textView3 : n.listOf((Object[]) new TextView[]{getBinding().f1958x, getBinding().n, getBinding().u, getBinding().l})) { AccessibilityUtils accessibilityUtils = AccessibilityUtils.INSTANCE; m.checkNotNullExpressionValue(textView3, "header"); accessibilityUtils.setViewIsHeading(textView3); } } @Override // com.discord.app.AppFragment public void onViewBoundOrOnResume() { super.onViewBoundOrOnResume(); ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(Model.Companion.get(), this, null, 2, null), WidgetSettingsPrivacy.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetSettingsPrivacy$onViewBoundOrOnResume$1(this), 62, (Object) null); ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(this.userSettings.observeIsAccessibilityDetectionAllowed(), this, null, 2, null), WidgetSettingsPrivacy.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetSettingsPrivacy$onViewBoundOrOnResume$2(this), 62, (Object) null); } }