// Metro module 13519 (f13520). import ChannelStore from "../../stores/ChannelStore"; import { ChannelNoticeTypes } from "../../Constants"; import { MULTIACCOUNT_TOOLTIP_SEEN_KEY } from "../multi_account/Constants"; import { UserContentSettings, InboxSettings, InboxTab, TextAndImagesSettings, NotificationSettings, PrivacySettings, VoiceAndVideoSettings, GameLibrarySettings, DebugSettings, UIDensity } from "../../_bundle/Module1306"; import * as _Uint8ArrayUtils from "../../utils/Uint8ArrayUtils"; import { addBit } from "../../utils/Uint8ArrayUtils"; import { HotspotStore, HotspotLocations } from "../hotspot/index"; import { Storage } from "../../_bundle/Module595"; import { mutateUserChannelSettings } from "./UserSettingsUtils"; import Module589 from "../../_bundle/Module589"; import { StringValue, BoolValue } from "../../_bundle/Module1337"; import { DismissibleContent } from "../../_bundle/Module1358"; import { isSnowflake } from "../application_commands/ApplicationCommandUtils"; const migrateHotspotLocation = function migrateHotspotLocation(a0, a1, a2) { let r17 = !!HotspotStore.hasHiddenHotspot(a1); if (r17) { if (a0.userContent == null) { a0.userContent = UserContentSettings.create(); } if (a0.userContent.dismissedContents == null) { a0.userContent.dismissedContents = new Uint8Array(); } const hasBit = _Uint8ArrayUtils.hasBit(a0.userContent.dismissedContents, a2); let r38 = false; if (!hasBit) { a0.userContent.dismissedContents = addBit(a0.userContent.dismissedContents, a2); r38 = true; } r17 = r38; } return r17; }; const r24 = [{ version: 2, run: (a0) => { let r3; const r10 = { Mentions: "Recent Mentions", Unreads: "Inbox" }; if (a0.inbox != null) { return false; } const inbox = InboxSettings.create(); a0.inbox = inbox; let r4 = false; if (Storage.get("seenInboxTutorial", false)) { inbox.viewedTutorial = true; r4 = true; } const r40 = Storage.get("recentsButtonTab2"); if (r40 != null) { inbox.currentTab = r40 === r10.Mentions ? InboxTab.MENTIONS : InboxTab.UNREADS; r4 = true; } let r54 = Storage.get("unread-messages-collapsed-channels"); if (r54 == null) { r54 = {}; } const r55 = r54; let r57 = r4; let r58 = r57; for (const key in r55) { r3 = r57; r58 = r3; const r61 = r54[key]; r57 = r3; if (r61) { const channel = ChannelStore.getChannel(key); r57 = r3; if (channel != null) { let guild_id = channel.guild_id; if (guild_id == null) { guild_id = "0"; } mutateUserChannelSettings(a0, guild_id, channel.id, (a0) => { a0.collapsedInInbox = true; }); r57 = true; } } } r3 = r57; r58 = r3; return r58; }, cleanup: () => { Storage.remove("seenInboxTutorial"); Storage.remove("recentsButtonTab2"); Storage.remove("unread-messages-collapsed-channels"); } }, { version: 3, run: (a0) => { const state = Module589.PersistedStore.migrateAndReadStoreState("EmojiStore", [() => ({ diversitySurrogate: Storage.get("EmojiDiversitySurrogate") || "" })]).state; if (state == null) { return false; } const r1 = state.diversitySurrogate != null && state.diversitySurrogate !== ""; let r0 = false; if (r1) { if (a0.textAndImages == null) { a0.textAndImages = TextAndImagesSettings.create(); } if (a0.textAndImages.diversitySurrogate == null) { a0.textAndImages.diversitySurrogate = StringValue.create(); } a0.textAndImages.diversitySurrogate.value = state.diversitySurrogate; r0 = true; } return r0; }, cleanup: () => {} }, { version: 4, run: (a0) => { const r19 = Storage.get("HAS_SEEN_HUB_UPSELL") === true || HotspotStore.hasHiddenHotspot(HotspotLocations.HUB_SECOND_EMAIL_CONNECTION_UPSELL); let r2 = false; if (r19) { const HUB_WAITLIST_UPSELL = DismissibleContent.HUB_WAITLIST_UPSELL; if (a0.userContent == null) { a0.userContent = UserContentSettings.create(); } if (a0.userContent.dismissedContents == null) { a0.userContent.dismissedContents = new Uint8Array(); } const hasBit = _Uint8ArrayUtils.hasBit(a0.userContent.dismissedContents, HUB_WAITLIST_UPSELL); let r0 = false; if (!hasBit) { a0.userContent.dismissedContents = addBit(a0.userContent.dismissedContents, HUB_WAITLIST_UPSELL); r0 = true; } r2 = r0; } return r2; }, cleanup: () => { Storage.remove("HAS_SEEN_HUB_UPSELL"); } }, { version: 5, run: (a0) => { let textAndImages = a0.textAndImages; if (textAndImages == null) { textAndImages = TextAndImagesSettings.create(); } a0.textAndImages = textAndImages; let notifications = a0.notifications; if (notifications == null) { notifications = NotificationSettings.create(); } a0.notifications = notifications; let privacy = a0.privacy; if (privacy == null) { privacy = PrivacySettings.create(); } a0.privacy = privacy; let voiceAndVideo = a0.voiceAndVideo; if (voiceAndVideo == null) { voiceAndVideo = VoiceAndVideoSettings.create(); } a0.voiceAndVideo = voiceAndVideo; let gameLibrary = a0.gameLibrary; if (gameLibrary == null) { gameLibrary = GameLibrarySettings.create(); } a0.gameLibrary = gameLibrary; let debug = a0.debug; if (debug == null) { debug = DebugSettings.create(); } a0.debug = debug; let r63 = Storage.get("UserSettingsStore"); if (r63 == null) { r63 = {}; } const useRichChatTextBox = r63.useRichChatTextBox; let r65 = false; if (typeof useRichChatTextBox === "boolean") { a0.textAndImages.useRichChatInput = BoolValue.create({ value: r63.useRichChatTextBox }); r65 = true; } if (typeof r63.renderSpoilers === "string") { a0.textAndImages.renderSpoilers = StringValue.create({ value: r63.renderSpoilers }); r65 = true; } if (typeof r63.useThreadSidebar === "boolean") { a0.textAndImages.useThreadSidebar = BoolValue.create({ value: r63.useThreadSidebar }); r65 = true; } if (typeof r63.showInAppNotifications === "boolean") { a0.notifications.showInAppNotifications = BoolValue.create({ value: r63.showInAppNotifications }); r65 = true; } if (r63.emojiPickerCollapsedSections instanceof Array) { a0.textAndImages.emojiPickerCollapsedSections = r63.emojiPickerCollapsedSections; r65 = true; } if (r63.stickerPickerCollapsedSections instanceof Array) { a0.textAndImages.stickerPickerCollapsedSections = r63.stickerPickerCollapsedSections; r65 = true; } if (typeof r63.viewImageDescriptions === "boolean") { a0.textAndImages.viewImageDescriptions = BoolValue.create({ value: r63.viewImageDescriptions }); r65 = true; } if (typeof r63.showCommandSuggestions === "boolean") { a0.textAndImages.showCommandSuggestions = BoolValue.create({ value: r63.showCommandSuggestions }); r65 = true; } if (typeof r63.alwaysPreviewVideo === "boolean") { a0.voiceAndVideo.alwaysPreviewVideo = BoolValue.create({ value: r63.alwaysPreviewVideo }); r65 = true; } if (typeof r63.notifyFriendsOnGoLive === "boolean") { a0.notifications.notifyFriendsOnGoLive = BoolValue.create({ value: r63.notifyFriendsOnGoLive }); r65 = true; } if (typeof r63.installShortcutDesktop === "boolean") { a0.gameLibrary.installShortcutDesktop = BoolValue.create({ value: r63.installShortcutDesktop }); r65 = true; } if (typeof r63.installShortcutStartMenu === "boolean") { a0.gameLibrary.installShortcutStartMenu = BoolValue.create({ value: r63.installShortcutStartMenu }); r65 = true; } if (typeof r63.allowActivityPartyPrivacyFriends === "boolean") { a0.privacy.allowActivityPartyPrivacyFriends = BoolValue.create({ value: r63.allowActivityPartyPrivacyFriends }); r65 = true; } if (typeof r63.allowActivityPartyPrivacyVoiceChannel === "boolean") { a0.privacy.allowActivityPartyPrivacyVoiceChannel = BoolValue.create({ value: r63.allowActivityPartyPrivacyVoiceChannel }); r65 = true; } if (typeof r63.rtcPanelShowVoiceStates === "boolean") { a0.debug.rtcPanelShowVoiceStates = BoolValue.create({ value: r63.rtcPanelShowVoiceStates }); r65 = true; } return r65; }, cleanup: () => {} }, { version: 7, run: (a0) => migrateHotspotLocation(a0, HotspotLocations.APPLICATION_COMMAND_TOOLTIP, DismissibleContent.APPLICATION_COMMAND_TOOLTIP), cleanup: () => {} }, { version: 8, run: (a0) => migrateHotspotLocation(a0, HotspotLocations.CHANNEL_BANNER_MEMBER_LIST_NOTICE, DismissibleContent.CHANNELINFO_CHANNELBANNER_NOTICE), cleanup: () => {} }, { version: 9, run: (a0) => { if (HotspotStore.hasHiddenHotspot(HotspotLocations.MULTI_ACCOUNT_TOOLTIP)) { Storage.set(MULTIACCOUNT_TOOLTIP_SEEN_KEY, "true"); } return migrateHotspotLocation(a0, HotspotLocations.MULTI_ACCOUNT_TOOLTIP, DismissibleContent.ACCOUNT_MULTIACCOUNT_TOOLTIP); }, cleanup: () => {} }, { version: 10, run: (a0) => { let r2 = migrateHotspotLocation(a0, HotspotLocations.HUB_LINK_CHANNEL_NOTICE, DismissibleContent.CHANNEL_NOTICE_HUBLINK); let r33 = Storage.get("channelNotices"); if (r33 == null) { r33 = {}; } let r1 = r33[ChannelNoticeTypes.INVITE] === false; if (r1) { const CHANNEL_NOTICE_INVITE = DismissibleContent.CHANNEL_NOTICE_INVITE; if (a0.userContent == null) { a0.userContent = UserContentSettings.create(); } if (a0.userContent.dismissedContents == null) { a0.userContent.dismissedContents = new Uint8Array(); } const hasBit = _Uint8ArrayUtils.hasBit(a0.userContent.dismissedContents, CHANNEL_NOTICE_INVITE); let r5 = false; if (!hasBit) { a0.userContent.dismissedContents = addBit(a0.userContent.dismissedContents, CHANNEL_NOTICE_INVITE); r5 = true; } r1 = r5; } if (r1) { r2 = true; } let r67 = r33[ChannelNoticeTypes.QUICKSWITCHER] === false; if (r67) { const CHANNEL_NOTICE_QUICKSWITCHER = DismissibleContent.CHANNEL_NOTICE_QUICKSWITCHER; if (a0.userContent == null) { a0.userContent = UserContentSettings.create(); } if (a0.userContent.dismissedContents == null) { a0.userContent.dismissedContents = new Uint8Array(); } const hasBit2 = _Uint8ArrayUtils.hasBit(a0.userContent.dismissedContents, CHANNEL_NOTICE_QUICKSWITCHER); let r93 = false; if (!hasBit2) { a0.userContent.dismissedContents = addBit(a0.userContent.dismissedContents, CHANNEL_NOTICE_QUICKSWITCHER); r93 = true; } r67 = r93; } if (r67) { r2 = true; } let r103 = r33[ChannelNoticeTypes.GUILD_BOOSTING] === false; if (r103) { const CHANNEL_NOTICE_PREMIUM_GUILD_SUBSCRIPTION = DismissibleContent.CHANNEL_NOTICE_PREMIUM_GUILD_SUBSCRIPTION; if (a0.userContent == null) { a0.userContent = UserContentSettings.create(); } if (a0.userContent.dismissedContents == null) { a0.userContent.dismissedContents = new Uint8Array(); } const hasBit3 = _Uint8ArrayUtils.hasBit(a0.userContent.dismissedContents, CHANNEL_NOTICE_PREMIUM_GUILD_SUBSCRIPTION); let r129 = false; if (!hasBit3) { a0.userContent.dismissedContents = addBit(a0.userContent.dismissedContents, CHANNEL_NOTICE_PREMIUM_GUILD_SUBSCRIPTION); r129 = true; } r103 = r129; } if (r103) { r2 = true; } return r2; }, cleanup: () => { Storage.remove("channelNotices"); } }, { version: 11, run: (a0) => { let r1 = migrateHotspotLocation(a0, HotspotLocations.GUILD_EVENT_UPSELL, DismissibleContent.GUILD_HEADER_EVENT_UPSELL) ? true : false; if (migrateHotspotLocation(a0, HotspotLocations.ANIMATED_GUILD_BANNER_GUILD_HEADER_TOOLTIP, DismissibleContent.GUILD_HEADER_ANIMATED_GUILD_BANNER)) { r1 = true; } return r1; }, cleanup: () => {} }, { version: 12, run: (a0) => { let r20 = Storage.get("hideNag"); if (r20) { const NAGBAR_NOTICE_DOWNLOAD = DismissibleContent.NAGBAR_NOTICE_DOWNLOAD; if (a0.userContent == null) { a0.userContent = UserContentSettings.create(); } if (a0.userContent.dismissedContents == null) { a0.userContent.dismissedContents = new Uint8Array(); } const hasBit = _Uint8ArrayUtils.hasBit(a0.userContent.dismissedContents, NAGBAR_NOTICE_DOWNLOAD); let r43 = false; if (!hasBit) { a0.userContent.dismissedContents = addBit(a0.userContent.dismissedContents, NAGBAR_NOTICE_DOWNLOAD); r43 = true; } r20 = r43; } let r50 = r20 ? true : false; let r56 = Storage.get("hideConnectSpotify"); if (r56) { const NAGBAR_NOTICE_CONNECT_SPOTIFY = DismissibleContent.NAGBAR_NOTICE_CONNECT_SPOTIFY; if (a0.userContent == null) { a0.userContent = UserContentSettings.create(); } if (a0.userContent.dismissedContents == null) { a0.userContent.dismissedContents = new Uint8Array(); } const hasBit2 = _Uint8ArrayUtils.hasBit(a0.userContent.dismissedContents, NAGBAR_NOTICE_CONNECT_SPOTIFY); let r82 = false; if (!hasBit2) { a0.userContent.dismissedContents = addBit(a0.userContent.dismissedContents, NAGBAR_NOTICE_CONNECT_SPOTIFY); r82 = true; } r56 = r82; } if (r56) { r50 = true; } let r95 = Storage.get("hideConnectPlayStation"); if (r95) { const NAGBAR_NOTICE_CONNECT_PLAYSTATION = DismissibleContent.NAGBAR_NOTICE_CONNECT_PLAYSTATION; if (a0.userContent == null) { a0.userContent = UserContentSettings.create(); } if (a0.userContent.dismissedContents == null) { a0.userContent.dismissedContents = new Uint8Array(); } const hasBit3 = _Uint8ArrayUtils.hasBit(a0.userContent.dismissedContents, NAGBAR_NOTICE_CONNECT_PLAYSTATION); let r2 = false; if (!hasBit3) { a0.userContent.dismissedContents = addBit(a0.userContent.dismissedContents, NAGBAR_NOTICE_CONNECT_PLAYSTATION); r2 = true; } r95 = r2; } if (r95) { r50 = true; } return r50; }, cleanup: () => { Storage.remove("hideNag"); Storage.remove("hideConnectSpotify"); Storage.remove("hideConnectPlayStation"); } }, { version: 13, run: (a0) => { let r20 = Storage.get("hidePremiumPromo"); if (r20) { const NAGBAR_NOTICE_PREMIUM_PROMO = DismissibleContent.NAGBAR_NOTICE_PREMIUM_PROMO; if (a0.userContent == null) { a0.userContent = UserContentSettings.create(); } if (a0.userContent.dismissedContents == null) { a0.userContent.dismissedContents = new Uint8Array(); } const hasBit = _Uint8ArrayUtils.hasBit(a0.userContent.dismissedContents, NAGBAR_NOTICE_PREMIUM_PROMO); let r43 = false; if (!hasBit) { a0.userContent.dismissedContents = addBit(a0.userContent.dismissedContents, NAGBAR_NOTICE_PREMIUM_PROMO); r43 = true; } r20 = r43; } let r50 = r20 ? true : false; let r56 = Storage.get("hidePremiumTier2TrialEnding"); if (r56) { const NAGBAR_NOTICE_PREMIUM_TIER_TWO_TRIAL_ENDING = DismissibleContent.NAGBAR_NOTICE_PREMIUM_TIER_TWO_TRIAL_ENDING; if (a0.userContent == null) { a0.userContent = UserContentSettings.create(); } if (a0.userContent.dismissedContents == null) { a0.userContent.dismissedContents = new Uint8Array(); } const hasBit2 = _Uint8ArrayUtils.hasBit(a0.userContent.dismissedContents, NAGBAR_NOTICE_PREMIUM_TIER_TWO_TRIAL_ENDING); let r82 = false; if (!hasBit2) { a0.userContent.dismissedContents = addBit(a0.userContent.dismissedContents, NAGBAR_NOTICE_PREMIUM_TIER_TWO_TRIAL_ENDING); r82 = true; } r56 = r82; } if (r56) { r50 = true; } let r95 = Storage.get("hidePremiumReactivateNotice"); if (r95) { const NAGBAR_NOTICE_PREMIUM_REACTIVATE = DismissibleContent.NAGBAR_NOTICE_PREMIUM_REACTIVATE; if (a0.userContent == null) { a0.userContent = UserContentSettings.create(); } if (a0.userContent.dismissedContents == null) { a0.userContent.dismissedContents = new Uint8Array(); } const hasBit3 = _Uint8ArrayUtils.hasBit(a0.userContent.dismissedContents, NAGBAR_NOTICE_PREMIUM_REACTIVATE); let r2 = false; if (!hasBit3) { a0.userContent.dismissedContents = addBit(a0.userContent.dismissedContents, NAGBAR_NOTICE_PREMIUM_REACTIVATE); r2 = true; } r95 = r2; } if (r95) { r50 = true; } return r50; }, cleanup: () => { Storage.remove("hidePremiumPromo"); Storage.remove("hidePremiumTier2TrialEnding"); Storage.remove("hidePremiumReactivateNotice"); } }, { version: 14, run: (a0) => migrateHotspotLocation(a0, HotspotLocations.ACTIVITY_BEB_TUTORIAL, DismissibleContent.ACTIVITIES_TUTORIAL_COACH_MARK), cleanup: () => {} }, { version: 15, run: (a0) => migrateHotspotLocation(a0, HotspotLocations.NOW_PLAYING_CONSENT_CARD, DismissibleContent.NOW_PLAYING_CONSENT_CARD), cleanup: () => {} }, { version: 16, run: (a0) => { const r12 = Storage.get("PromotionsPersistedStore"); if (r12 == null) { return false; } const lastDismissedOutboundPromotionStartDate = r12._state.lastDismissedOutboundPromotionStartDate; let r0 = lastDismissedOutboundPromotionStartDate != null; if (r0) { if (a0.userContent == null) { a0.userContent = UserContentSettings.create(); } r0 = a0.userContent.lastDismissedOutboundPromotionStartDate == null; } if (r0) { a0.userContent.lastDismissedOutboundPromotionStartDate = StringValue.create({ value: lastDismissedOutboundPromotionStartDate }); r0 = true; } return r0; }, cleanup: () => {} }, { version: 17, run: (a0) => { const state = Module589.PersistedStore.migrateAndReadStoreState("ExpressionSuggestionsPersistedStore", null).state; if (state == null) { return false; } const expressionSuggestionsEnabled = state.expressionSuggestionsEnabled; let r0 = expressionSuggestionsEnabled != null; if (r0) { if (a0.textAndImages == null) { a0.textAndImages = TextAndImagesSettings.create(); } r0 = a0.textAndImages.expressionSuggestionsEnabled == null; } if (r0) { a0.textAndImages.expressionSuggestionsEnabled = BoolValue.create({ value: expressionSuggestionsEnabled }); r0 = true; } return r0; }, cleanup: () => { Storage.remove("ExpressionSuggestionsPersistedStore"); } }, { version: 18, run: (a0) => { let r1 = migrateHotspotLocation(a0, HotspotLocations.GUILD_DELETE_FEEDBACK, DismissibleContent.GUILD_DELETE_FEEDBACK) ? true : false; if (migrateHotspotLocation(a0, HotspotLocations.GUILD_LEAVE_FEEDBACK, DismissibleContent.GUILD_LEAVE_FEEDBACK)) { r1 = true; } return r1; }, cleanup: () => {} }, { version: 19, run: (a0) => { let r17 = Storage.get("forumHelperCardStorageKey"); if (r17 == null) { r17 = false; } let r1 = false; if (r17) { const FORUM_CHANNEL_HELPER_CARD = DismissibleContent.FORUM_CHANNEL_HELPER_CARD; if (a0.userContent == null) { a0.userContent = UserContentSettings.create(); } if (a0.userContent.dismissedContents == null) { a0.userContent.dismissedContents = new Uint8Array(); } const hasBit = _Uint8ArrayUtils.hasBit(a0.userContent.dismissedContents, FORUM_CHANNEL_HELPER_CARD); let r0 = false; if (!hasBit) { a0.userContent.dismissedContents = addBit(a0.userContent.dismissedContents, FORUM_CHANNEL_HELPER_CARD); r0 = true; } r1 = r0; } return r1; }, cleanup: () => { Storage.remove("forumHelperCardStorageKey"); } }, { version: 20, run: (a0) => { const lastReceivedChangelogId = Storage.get("lastChangeLogId"); if (lastReceivedChangelogId == null) { return false; } if (isSnowflake(lastReceivedChangelogId)) { if (a0.userContent == null) { a0.userContent = UserContentSettings.create(); } else if (a0.userContent != null && a0.userContent.lastReceivedChangelogId != null && a0.userContent.lastReceivedChangelogId !== "0") { Storage.remove("lastChangeLogId"); return false; } a0.userContent.lastReceivedChangelogId = lastReceivedChangelogId; return true; } Storage.remove("lastChangeLogId"); return false; }, cleanup: () => { Storage.remove("lastChangeLogId"); } }, { version: 21, run: (a0) => { let r13 = a0.appearance?.uiDensity === UIDensity.COMPACT; if (r13) { a0.appearance.uiDensity = UIDensity.DEFAULT; r13 = true; } return r13; }, cleanup: () => {} }]; export default r24;