discord-jadx/app/src/main/java/com/discord/stores/StoreUserSettings.java

574 lines
30 KiB
Java

package com.discord.stores;
import android.content.Context;
import android.content.SharedPreferences;
import com.discord.R;
import com.discord.app.AppActivity;
import com.discord.models.domain.Consents;
import com.discord.models.domain.ModelCustomStatusSetting;
import com.discord.models.domain.ModelGuildFolder;
import com.discord.models.domain.ModelPayload;
import com.discord.models.domain.ModelUserSettings;
import com.discord.restapi.RestAPIParams;
import com.discord.utilities.analytics.AnalyticsTracker;
import com.discord.utilities.persister.Persister;
import com.discord.utilities.rest.RestAPI;
import com.discord.utilities.rx.ObservableExtensionsKt;
import com.discord.utilities.time.ClockFactory;
import com.discord.utilities.time.TimeUtils;
import d0.d0.f;
import d0.z.d.m;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.TimeUnit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import rx.Observable;
import rx.Subscription;
import rx.subjects.BehaviorSubject;
import rx.subjects.SerializedSubject;
/* compiled from: StoreUserSettings.kt */
public final class StoreUserSettings extends Store {
public static final Companion Companion = new Companion(null);
private final StoreAccessibility accessibilityStore;
private final Persister<Boolean> allowAccessibilityDetectionPublisher;
private final Persister<Boolean> allowAnimatedEmojisPublisher;
private final Persister<Boolean> autoPlayGifsPublisher;
private Boolean contactSyncUpsellShown;
private final SerializedSubject<ModelCustomStatusSetting, ModelCustomStatusSetting> customStatusSubject = new SerializedSubject<>(BehaviorSubject.k0());
private final SerializedSubject<Boolean, Boolean> defaultGuildsRestrictedSubject = new SerializedSubject<>(BehaviorSubject.k0());
private final Dispatcher dispatcher;
private Subscription expireCustomStatusSubscription;
private final SerializedSubject<Integer, Integer> explicitContentFilterSubject = new SerializedSubject<>(BehaviorSubject.k0());
private final SerializedSubject<Integer, Integer> friendDiscoveryFlagsSubject = new SerializedSubject<>(BehaviorSubject.l0(0));
private final SerializedSubject<ModelUserSettings.FriendSourceFlags, ModelUserSettings.FriendSourceFlags> friendSourceFlagsSubject = new SerializedSubject<>(BehaviorSubject.k0());
private final Persister<List<ModelGuildFolder>> guildFoldersPublisher = new Persister<>("STORE_SETTINGS_FOLDERS_V1", new ArrayList());
private final Persister<List<Long>> restrictedGuildIdsPublisher = new Persister<>("RESTRICTED_GUILD_IDS", new ArrayList());
private final SerializedSubject<Boolean, Boolean> shouldRenderEmbedsSubject = new SerializedSubject<>(BehaviorSubject.k0());
private final Persister<Boolean> showCurrentGame;
private final Persister<Integer> stickerAnimationSettingsPublisher;
private final Persister<Boolean> stickerSuggestionsPublisher;
/* compiled from: StoreUserSettings.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public static final /* synthetic */ void access$updateUserSettings(Companion companion, AppActivity appActivity, RestAPIParams.UserSettings userSettings, Integer num) {
companion.updateUserSettings(appActivity, userSettings, num);
}
private final void updateUserSettings(AppActivity appActivity, RestAPIParams.UserSettings userSettings, Integer num) {
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(RestAPI.Companion.getApi().updateUserSettings(userSettings), false, 1, null), appActivity, null, 2, null), StoreUserSettings.class, appActivity, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new StoreUserSettings$Companion$updateUserSettings$1(appActivity, num), 60, (Object) null);
}
public static /* synthetic */ void updateUserSettings$default(Companion companion, AppActivity appActivity, RestAPIParams.UserSettings userSettings, Integer num, int i, Object obj) {
if ((i & 2) != 0) {
num = null;
}
companion.updateUserSettings(appActivity, userSettings, num);
}
}
public StoreUserSettings(Dispatcher dispatcher, StoreAccessibility storeAccessibility) {
m.checkNotNullParameter(dispatcher, "dispatcher");
m.checkNotNullParameter(storeAccessibility, "accessibilityStore");
this.dispatcher = dispatcher;
this.accessibilityStore = storeAccessibility;
Boolean bool = Boolean.TRUE;
this.allowAnimatedEmojisPublisher = new Persister<>("STORE_SETTINGS_ALLOW_ANIMATED_EMOJIS", bool);
this.stickerAnimationSettingsPublisher = new Persister<>("CACHE_KEY_STICKER_ANIMATION_SETTINGS_V1", 0);
this.showCurrentGame = new Persister<>("STORE_SETTINGS_ALLOW_GAME_STATUS", bool);
this.stickerSuggestionsPublisher = new Persister<>("CACHE_KEY_STICKER_SUGGESTIONS", bool);
this.allowAccessibilityDetectionPublisher = new Persister<>("STORE_SETTINGS_ALLOW_ACCESSIBILITY_DETECTION", Boolean.FALSE);
this.autoPlayGifsPublisher = new Persister<>("STORE_SETTINGS_AUTO_PLAY_GIFS", bool);
}
public static final /* synthetic */ void access$expireCustomStatus(StoreUserSettings storeUserSettings) {
storeUserSettings.expireCustomStatus();
}
public static final /* synthetic */ StoreAccessibility access$getAccessibilityStore$p(StoreUserSettings storeUserSettings) {
return storeUserSettings.accessibilityStore;
}
public static final /* synthetic */ Subscription access$getExpireCustomStatusSubscription$p(StoreUserSettings storeUserSettings) {
return storeUserSettings.expireCustomStatusSubscription;
}
public static final /* synthetic */ void access$setExpireCustomStatusSubscription$p(StoreUserSettings storeUserSettings, Subscription subscription) {
storeUserSettings.expireCustomStatusSubscription = subscription;
}
public static final /* synthetic */ void access$updateAllowAccessibilityDetectionInternal(StoreUserSettings storeUserSettings, boolean z2) {
storeUserSettings.updateAllowAccessibilityDetectionInternal(z2);
}
private final void expireCustomStatus() {
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.restSubscribeOn$default(updateCustomStatus(null), false, 1, null), StoreUserSettings.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, StoreUserSettings$expireCustomStatus$1.INSTANCE, 62, (Object) null);
}
private final void handleUserSettings(ModelUserSettings modelUserSettings) {
List<ModelGuildFolder> guildFolders = modelUserSettings.getGuildFolders();
List<Long> restrictedGuilds = modelUserSettings.getRestrictedGuilds();
if (getIsSyncTextAndImagesEnabled()) {
if (modelUserSettings.getInlineEmbedMedia() != null) {
Boolean inlineEmbedMedia = modelUserSettings.getInlineEmbedMedia();
m.checkNotNullExpressionValue(inlineEmbedMedia, "userSettings.inlineEmbedMedia");
setIsEmbedMediaInlined(null, inlineEmbedMedia.booleanValue());
}
if (modelUserSettings.getInlineAttachmentMedia() != null) {
Boolean inlineAttachmentMedia = modelUserSettings.getInlineAttachmentMedia();
m.checkNotNullExpressionValue(inlineAttachmentMedia, "userSettings.inlineAttachmentMedia");
setIsAttachmentMediaInline(null, inlineAttachmentMedia.booleanValue());
}
if (modelUserSettings.getRenderEmbeds() != null) {
Boolean renderEmbeds = modelUserSettings.getRenderEmbeds();
m.checkNotNullExpressionValue(renderEmbeds, "userSettings.renderEmbeds");
setIsRenderEmbedsEnabled(null, renderEmbeds.booleanValue());
}
if (modelUserSettings.getAnimateEmoji() != null) {
Boolean animateEmoji = modelUserSettings.getAnimateEmoji();
m.checkNotNullExpressionValue(animateEmoji, "userSettings.animateEmoji");
setIsAnimatedEmojisEnabled(null, animateEmoji.booleanValue());
}
if (modelUserSettings.getAnimateStickers() != null) {
Integer animateStickers = modelUserSettings.getAnimateStickers();
m.checkNotNullExpressionValue(animateStickers, "userSettings.animateStickers");
setStickerAnimationSettings(null, animateStickers.intValue());
}
}
if (guildFolders != null) {
Persister.set$default(this.guildFoldersPublisher, guildFolders, false, 2, null);
}
if (restrictedGuilds != null) {
Persister.set$default(this.restrictedGuildIdsPublisher, restrictedGuilds, false, 2, null);
}
if (modelUserSettings.getDeveloperMode() != null) {
Boolean developerMode = modelUserSettings.getDeveloperMode();
m.checkNotNullExpressionValue(developerMode, "userSettings.developerMode");
setDeveloperModeInternal(developerMode.booleanValue());
}
if (modelUserSettings.getShowCurrentGame() != null) {
Persister<Boolean> persister = this.showCurrentGame;
Boolean showCurrentGame = modelUserSettings.getShowCurrentGame();
m.checkNotNullExpressionValue(showCurrentGame, "userSettings.showCurrentGame");
Persister.set$default(persister, showCurrentGame, false, 2, null);
}
if (modelUserSettings.getExplicitContentFilter() != null) {
SerializedSubject<Integer, Integer> serializedSubject = this.explicitContentFilterSubject;
serializedSubject.j.onNext(modelUserSettings.getExplicitContentFilter());
}
if (modelUserSettings.getFriendSourceFlags() != null) {
SerializedSubject<ModelUserSettings.FriendSourceFlags, ModelUserSettings.FriendSourceFlags> serializedSubject2 = this.friendSourceFlagsSubject;
serializedSubject2.j.onNext(modelUserSettings.getFriendSourceFlags());
}
if (modelUserSettings.getDefaultGuildsRestricted() != null) {
SerializedSubject<Boolean, Boolean> serializedSubject3 = this.defaultGuildsRestrictedSubject;
serializedSubject3.j.onNext(modelUserSettings.getDefaultGuildsRestricted());
}
if (modelUserSettings.getCustomStatus() != null) {
updateLocalCustomStatus(modelUserSettings.getCustomStatus());
}
if (modelUserSettings.getFriendDiscoveryFlags() != null) {
SerializedSubject<Integer, Integer> serializedSubject4 = this.friendDiscoveryFlagsSubject;
serializedSubject4.j.onNext(modelUserSettings.getFriendDiscoveryFlags());
}
if (modelUserSettings.getContactSyncUpsellShown() != null) {
this.contactSyncUpsellShown = modelUserSettings.getContactSyncUpsellShown();
}
}
public static /* synthetic */ Observable observeIsAnimatedEmojisEnabled$default(StoreUserSettings storeUserSettings, boolean z2, int i, Object obj) {
if ((i & 1) != 0) {
z2 = true;
}
return storeUserSettings.observeIsAnimatedEmojisEnabled(z2);
}
public static /* synthetic */ Observable observeIsAutoPlayGifsEnabled$default(StoreUserSettings storeUserSettings, boolean z2, int i, Object obj) {
if ((i & 1) != 0) {
z2 = true;
}
return storeUserSettings.observeIsAutoPlayGifsEnabled(z2);
}
public static /* synthetic */ Observable observeStickerAnimationSettings$default(StoreUserSettings storeUserSettings, boolean z2, int i, Object obj) {
if ((i & 1) != 0) {
z2 = true;
}
return storeUserSettings.observeStickerAnimationSettings(z2);
}
private final void setDeveloperModeInternal(boolean z2) {
getPrefs().edit().putBoolean("CACHE_KEY_DEVELOPER_MODE", z2).apply();
}
private final void updateAllowAccessibilityDetectionInternal(boolean z2) {
Persister.set$default(this.allowAccessibilityDetectionPublisher, Boolean.valueOf(z2), false, 2, null);
this.dispatcher.schedule(new StoreUserSettings$updateAllowAccessibilityDetectionInternal$1(this, z2));
}
private final synchronized void updateLocalCustomStatus(ModelCustomStatusSetting modelCustomStatusSetting) {
Subscription subscription = this.expireCustomStatusSubscription;
if (subscription != null) {
m.checkNotNull(subscription);
subscription.unsubscribe();
}
this.customStatusSubject.j.onNext(modelCustomStatusSetting);
if (!m.areEqual(modelCustomStatusSetting, ModelCustomStatusSetting.Companion.getCLEAR())) {
m.checkNotNull(modelCustomStatusSetting);
if (modelCustomStatusSetting.getExpiresAt() != null) {
Observable<Long> d02 = Observable.d0(f.coerceAtLeast(TimeUtils.parseUTCDate(modelCustomStatusSetting.getExpiresAt()) - ClockFactory.get().currentTimeMillis(), 0), TimeUnit.MILLISECONDS);
m.checkNotNullExpressionValue(d02, "Observable\n .…l, TimeUnit.MILLISECONDS)");
ObservableExtensionsKt.appSubscribe$default(d02, getClass(), (Context) null, new StoreUserSettings$updateLocalCustomStatus$1(this), (Function1) null, (Function0) null, (Function0) null, new StoreUserSettings$updateLocalCustomStatus$2(this), 58, (Object) null);
}
}
}
public final Boolean getContactSyncUpsellShown() {
return this.contactSyncUpsellShown;
}
public final boolean getIsAttachmentMediaInline() {
return getPrefs().getBoolean("CACHE_KEY_INLINE_ATTACHMENT_MEDIA", true);
}
public final boolean getIsAutoImageCompressionEnabled() {
return getPrefs().getBoolean("CACHE_KEY_IMAGE_COMPRESSION", false);
}
public final boolean getIsAutoPlayGifsEnabled() {
return getPrefs().getBoolean("STORE_SETTINGS_AUTO_PLAY_GIFS", true);
}
public final boolean getIsChromeCustomTabsEnabled() {
return getPrefs().getBoolean("CACHE_KEY_USE_CHROME_CUSTOM_TABS", true);
}
public final boolean getIsDeveloperMode() {
return getPrefs().getBoolean("CACHE_KEY_DEVELOPER_MODE", false);
}
public final boolean getIsEmbedMediaInlined() {
return getPrefs().getBoolean("CACHE_KEY_INLINE_EMBED_MEDIA", true);
}
public final boolean getIsMobileOverlayEnabled() {
return getPrefs().getBoolean("CACHE_KEY_MOBILE_OVERLAY", false);
}
public final boolean getIsRenderEmbedsEnabled() {
return getPrefs().getBoolean("CACHE_KEY_RENDER_EMBEDS", true);
}
public final boolean getIsShiftEnterToSendEnabled() {
return getPrefs().getBoolean("CACHE_KEY_SHIFT_ENTER_TO_SEND", false);
}
public final boolean getIsStickerSuggestionsEnabled() {
return this.stickerSuggestionsPublisher.get().booleanValue();
}
public final void getIsSyncTextAndImagesEnabled(boolean z2) {
SharedPreferences.Editor edit = getPrefs().edit();
m.checkNotNullExpressionValue(edit, "editor");
if (getIsSyncTextAndImagesEnabled() != z2) {
edit.putBoolean("CACHE_KEY_SYNC_TEXT_AND_IMAGES", z2);
}
edit.apply();
}
public final boolean getIsSyncTextAndImagesEnabled() {
return getPrefs().getBoolean("CACHE_KEY_SYNC_TEXT_AND_IMAGES", true);
}
public final int getStickerAnimationSettings() {
return this.stickerAnimationSettingsPublisher.get().intValue();
}
public final void handleConnectionOpen(ModelPayload modelPayload) {
m.checkNotNullParameter(modelPayload, "payload");
ModelUserSettings userSettings = modelPayload.getUserSettings();
m.checkNotNullExpressionValue(userSettings, "userSettings");
handleUserSettings(userSettings);
}
@StoreThread
public final void handleUserSettingsUpdate(ModelUserSettings modelUserSettings) {
m.checkNotNullParameter(modelUserSettings, "userSettings");
handleUserSettings(modelUserSettings);
}
@Override // com.discord.stores.Store
@StoreThread
public void init(Context context) {
m.checkNotNullParameter(context, "context");
super.init(context);
SerializedSubject<Boolean, Boolean> serializedSubject = this.shouldRenderEmbedsSubject;
serializedSubject.j.onNext(Boolean.valueOf(getIsRenderEmbedsEnabled()));
}
public final Observable<Consents> observeConsents() {
Observable<Consents> L = RestAPI.Companion.getApi().getConsents().L(StoreUserSettings$observeConsents$1.INSTANCE);
m.checkNotNullExpressionValue(L, "RestAPI\n .api\n …turn { Consents.DEFAULT }");
return ObservableExtensionsKt.restSubscribeOn$default(L, false, 1, null);
}
public final Observable<ModelCustomStatusSetting> observeCustomStatus() {
Observable<ModelCustomStatusSetting> q = ObservableExtensionsKt.computationLatest(this.customStatusSubject).q();
m.checkNotNullExpressionValue(q, "customStatusSubject\n … .distinctUntilChanged()");
return q;
}
public final Observable<Integer> observeExplicitContentFilter() {
Observable<Integer> q = ObservableExtensionsKt.computationLatest(this.explicitContentFilterSubject).q();
m.checkNotNullExpressionValue(q, "explicitContentFilterSub… .distinctUntilChanged()");
return q;
}
public final Observable<Integer> observeFriendDiscoveryFlags() {
Observable<Integer> q = ObservableExtensionsKt.computationLatest(this.friendDiscoveryFlagsSubject).q();
m.checkNotNullExpressionValue(q, "friendDiscoveryFlagsSubj… .distinctUntilChanged()");
return q;
}
public final Observable<ModelUserSettings.FriendSourceFlags> observeFriendSourceFlags() {
Observable<ModelUserSettings.FriendSourceFlags> q = ObservableExtensionsKt.computationLatest(this.friendSourceFlagsSubject).q();
m.checkNotNullExpressionValue(q, "friendSourceFlagsSubject… .distinctUntilChanged()");
return q;
}
public final Observable<List<ModelGuildFolder>> observeGuildFolders() {
Observable<List<ModelGuildFolder>> q = ObservableExtensionsKt.computationLatest(this.guildFoldersPublisher.getObservable()).q();
m.checkNotNullExpressionValue(q, "guildFoldersPublisher\n … .distinctUntilChanged()");
return q;
}
public final Observable<Boolean> observeIsAccessibilityDetectionAllowed() {
Observable<Boolean> q = this.allowAccessibilityDetectionPublisher.getObservable().q();
m.checkNotNullExpressionValue(q, "allowAccessibilityDetect… .distinctUntilChanged()");
return q;
}
public final Observable<Boolean> observeIsAnimatedEmojisEnabled(boolean z2) {
Observable<Boolean> observable = this.allowAnimatedEmojisPublisher.getObservable();
if (z2) {
observable = Observable.j(observable, this.accessibilityStore.observeReducedMotionEnabled(), StoreUserSettings$observeIsAnimatedEmojisEnabled$1$1.INSTANCE);
}
Observable<Boolean> q = observable.q();
m.checkNotNullExpressionValue(q, "allowAnimatedEmojisPubli… .distinctUntilChanged()");
return q;
}
public final Observable<Boolean> observeIsAutoPlayGifsEnabled(boolean z2) {
Observable<Boolean> observable = this.autoPlayGifsPublisher.getObservable();
if (z2) {
observable = Observable.j(observable, this.accessibilityStore.observeReducedMotionEnabled(), StoreUserSettings$observeIsAutoPlayGifsEnabled$1$1.INSTANCE);
}
Observable<Boolean> q = observable.q();
m.checkNotNullExpressionValue(q, "autoPlayGifsPublisher\n … .distinctUntilChanged()");
return q;
}
public final Observable<Boolean> observeIsDefaultGuildsRestricted() {
Observable<Boolean> q = ObservableExtensionsKt.computationLatest(this.defaultGuildsRestrictedSubject).q();
m.checkNotNullExpressionValue(q, "defaultGuildsRestrictedS… .distinctUntilChanged()");
return q;
}
public final Observable<Boolean> observeIsRenderEmbedsEnabled() {
Observable<Boolean> q = ObservableExtensionsKt.computationLatest(this.shouldRenderEmbedsSubject).q();
m.checkNotNullExpressionValue(q, "shouldRenderEmbedsSubjec… .distinctUntilChanged()");
return q;
}
public final Observable<Boolean> observeIsShowCurrentGameEnabled() {
return this.showCurrentGame.getObservable();
}
public final Observable<Boolean> observeIsStickerSuggestionsEnabled() {
return this.stickerSuggestionsPublisher.getObservable();
}
public final Observable<List<Long>> observeRestrictedGuildIds() {
Observable<List<Long>> q = ObservableExtensionsKt.computationLatest(this.restrictedGuildIdsPublisher.getObservable()).q();
m.checkNotNullExpressionValue(q, "restrictedGuildIdsPublis… .distinctUntilChanged()");
return q;
}
public final Observable<Integer> observeStickerAnimationSettings(boolean z2) {
Observable<Integer> observable = this.stickerAnimationSettingsPublisher.getObservable();
if (z2) {
observable = Observable.j(observable, this.accessibilityStore.observeReducedMotionEnabled(), StoreUserSettings$observeStickerAnimationSettings$1$1.INSTANCE);
}
Observable<Integer> q = observable.q();
m.checkNotNullExpressionValue(q, "stickerAnimationSettings… .distinctUntilChanged()");
return q;
}
public final void setContactSyncUpsellShown(Boolean bool) {
this.contactSyncUpsellShown = bool;
}
public final void setDefaultGuildsRestricted(AppActivity appActivity, boolean z2, Collection<Long> collection) {
if (appActivity != null) {
Companion.updateUserSettings$default(Companion, appActivity, RestAPIParams.UserSettings.Companion.createWithRestrictedGuilds(Boolean.valueOf(z2), collection), null, 2, null);
}
}
public final void setExplicitContentFilter(AppActivity appActivity, int i) {
if (appActivity != null) {
Companion.updateUserSettings$default(Companion, appActivity, RestAPIParams.UserSettings.Companion.createWithExplicitContentFilter(i), null, 2, null);
}
}
public final void setFriendDiscoveryFlags(AppActivity appActivity, int i) {
if (appActivity != null) {
Companion.updateUserSettings$default(Companion, appActivity, RestAPIParams.UserSettings.Companion.createWithFriendDiscoveryFlags(Integer.valueOf(i)), null, 2, null);
}
}
public final void setFriendSourceFlags(AppActivity appActivity, Boolean bool, Boolean bool2, Boolean bool3) {
if (appActivity != null) {
Companion.updateUserSettings$default(Companion, appActivity, RestAPIParams.UserSettings.Companion.createWithFriendSourceFlags(bool, bool2, bool3), null, 2, null);
}
}
public final Observable<ModelUserSettings> setIsAccessibilityDetectionAllowed(boolean z2) {
Observable<ModelUserSettings> t = RestAPI.Companion.getApi().updateUserSettings(RestAPIParams.UserSettings.Companion.createWithAllowAccessibilityDetection(Boolean.valueOf(z2))).t(new StoreUserSettings$setIsAccessibilityDetectionAllowed$1(this, z2));
m.checkNotNullExpressionValue(t, "RestAPI\n .api\n …AccessibilityDetection) }");
return t;
}
public final void setIsAnimatedEmojisEnabled(AppActivity appActivity, boolean z2) {
Persister.set$default(this.allowAnimatedEmojisPublisher, Boolean.valueOf(z2), false, 2, null);
if (getIsSyncTextAndImagesEnabled() && appActivity != null) {
Companion.updateUserSettings$default(Companion, appActivity, RestAPIParams.UserSettings.Companion.createWithAllowAnimatedEmojis(Boolean.valueOf(z2)), null, 2, null);
}
}
public final void setIsAttachmentMediaInline(AppActivity appActivity, boolean z2) {
if (getIsAttachmentMediaInline() != z2) {
getPrefs().edit().putBoolean("CACHE_KEY_INLINE_ATTACHMENT_MEDIA", z2).apply();
}
if (getIsSyncTextAndImagesEnabled() && appActivity != null) {
Companion.updateUserSettings$default(Companion, appActivity, RestAPIParams.UserSettings.Companion.createWithInlineAttachmentMedia(z2), null, 2, null);
}
}
public final void setIsAutoImageCompressionEnabled(boolean z2) {
if (getIsAutoImageCompressionEnabled() != z2) {
getPrefs().edit().putBoolean("CACHE_KEY_IMAGE_COMPRESSION", z2).apply();
}
}
public final boolean setIsAutoPlayGifsEnabled(boolean z2) {
return ((Boolean) Persister.set$default(this.autoPlayGifsPublisher, Boolean.valueOf(z2), false, 2, null)).booleanValue();
}
public final void setIsChromeCustomTabsEnabled(boolean z2) {
SharedPreferences.Editor edit = getPrefs().edit();
m.checkNotNullExpressionValue(edit, "editor");
edit.putBoolean("CACHE_KEY_USE_CHROME_CUSTOM_TABS", z2);
edit.apply();
}
public final void setIsDeveloperMode(AppActivity appActivity, boolean z2) {
if (getIsDeveloperMode() != z2) {
if (appActivity != null) {
Companion.access$updateUserSettings(Companion, appActivity, RestAPIParams.UserSettings.Companion.createWithDeveloperMode(z2), Integer.valueOf((int) R.string.theme_updated));
}
setDeveloperModeInternal(z2);
}
}
public final void setIsEmbedMediaInlined(AppActivity appActivity, boolean z2) {
if (getIsEmbedMediaInlined() != z2) {
getPrefs().edit().putBoolean("CACHE_KEY_INLINE_EMBED_MEDIA", z2).apply();
}
if (getIsSyncTextAndImagesEnabled() && appActivity != null) {
Companion.updateUserSettings$default(Companion, appActivity, RestAPIParams.UserSettings.Companion.createWithInlineEmbedMedia(z2), null, 2, null);
}
}
public final void setIsMobileOverlayEnabled(boolean z2) {
SharedPreferences.Editor edit = getPrefs().edit();
m.checkNotNullExpressionValue(edit, "editor");
if (getIsMobileOverlayEnabled() != z2) {
edit.putBoolean("CACHE_KEY_MOBILE_OVERLAY", z2);
AnalyticsTracker.overlayToggled(z2);
}
edit.apply();
}
public final void setIsRenderEmbedsEnabled(AppActivity appActivity, boolean z2) {
if (getIsRenderEmbedsEnabled() != z2) {
getPrefs().edit().putBoolean("CACHE_KEY_RENDER_EMBEDS", z2).apply();
SerializedSubject<Boolean, Boolean> serializedSubject = this.shouldRenderEmbedsSubject;
serializedSubject.j.onNext(Boolean.valueOf(z2));
}
if (getIsSyncTextAndImagesEnabled() && appActivity != null) {
Companion.updateUserSettings$default(Companion, appActivity, RestAPIParams.UserSettings.Companion.createWithRenderEmbeds(z2), null, 2, null);
}
}
public final void setIsShiftEnterToSendEnabled(boolean z2) {
SharedPreferences.Editor edit = getPrefs().edit();
m.checkNotNullExpressionValue(edit, "editor");
if (getIsShiftEnterToSendEnabled() != z2) {
edit.putBoolean("CACHE_KEY_SHIFT_ENTER_TO_SEND", z2);
}
edit.apply();
}
public final void setIsShowCurrentGameEnabled(AppActivity appActivity, boolean z2) {
Persister.set$default(this.showCurrentGame, Boolean.valueOf(z2), false, 2, null);
if (appActivity != null) {
Companion.updateUserSettings$default(Companion, appActivity, RestAPIParams.UserSettings.Companion.createWithShowCurrentGame(z2), null, 2, null);
}
}
public final boolean setIsStickerSuggestionsEnabled(boolean z2) {
return this.stickerSuggestionsPublisher.set(Boolean.valueOf(z2), true).booleanValue();
}
public final void setRestrictedGuildId(AppActivity appActivity, long j, boolean z2) {
setRestrictedGuildIds(appActivity, this.restrictedGuildIdsPublisher.get(), j, z2);
}
public final void setRestrictedGuildIds(AppActivity appActivity, Collection<Long> collection, long j, boolean z2) {
ArrayList arrayList = new ArrayList(collection);
if (z2 && !arrayList.contains(Long.valueOf(j))) {
arrayList.add(Long.valueOf(j));
}
if (!z2) {
arrayList.remove(Long.valueOf(j));
}
if (appActivity != null) {
Companion.updateUserSettings$default(Companion, appActivity, RestAPIParams.UserSettings.Companion.createWithRestrictedGuilds(null, arrayList), null, 2, null);
}
}
public final void setStickerAnimationSettings(AppActivity appActivity, int i) {
Persister.set$default(this.stickerAnimationSettingsPublisher, Integer.valueOf(i), false, 2, null);
if (getIsSyncTextAndImagesEnabled() && appActivity != null) {
Companion.updateUserSettings$default(Companion, appActivity, RestAPIParams.UserSettings.Companion.createWithStickerAnimationSettings(Integer.valueOf(i)), null, 2, null);
}
}
public final void updateContactSyncShown() {
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.restSubscribeOn$default(RestAPI.Companion.getApi().updateUserSettings(RestAPIParams.UserSettings.Companion.createWithContactSyncUpsellShown()), false, 1, null), StoreUserSettings.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, StoreUserSettings$updateContactSyncShown$1.INSTANCE, 62, (Object) null);
}
public final Observable<ModelUserSettings> updateCustomStatus(ModelCustomStatusSetting modelCustomStatusSetting) {
return RestAPI.Companion.getApiSerializeNulls().updateUserSettingsCustomStatus(new RestAPIParams.UserSettingsCustomStatus(modelCustomStatusSetting));
}
}