Files
2026-07-28 01:06:53 +03:00

259 lines
14 KiB
TypeScript

/* Metro module 3964; source: modules/client_themes/ClientThemesBackgroundStore.tsx; dependencies: [6, 7, 15, 17, 18, 1311, 1310, 1312, 1348, 1383, 1379, 1878, 3965, 1313, 3968, 1365, 3995, 3802, 3829, 3998, 3999, 566, 694, 2] */
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import ThemeStore from '../user_settings/ThemeStore.tsx'; /* Metro dependency 1310 */
import SelectivelySyncedUserSettingsStore from '../user_settings/SelectivelySyncedUserSettingsStore.tsx'; /* Metro dependency 1311 */
import UnsyncedUserSettingsStore from '../user_settings/UnsyncedUserSettingsStore.tsx'; /* Metro dependency 1312 */
import UserSettingsProtoStore from '../user_settings/UserSettingsProtoStore.tsx'; /* Metro dependency 1348 */
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */
import PremiumUtils from '../../utils/PremiumUtils.tsx'; /* Metro dependency 3802 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ThemeConstantsModule from '../user_settings/ThemeConstants.tsx'; /* Metro dependency 1313 */
import * as ChannelRecordModule from '../../records/ChannelRecord.tsx'; /* Metro dependency 1383 */
import * as ClientThemesConstantsModule from './ClientThemesConstants.tsx'; /* Metro dependency 3965 */
function _fun32448(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#32448, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4113:6, offset: 0x0101608a, size: 553 bytes, params: 8, frame: 21
const env0_0 = require;
const CLIENT_THEMES_EDITOR_CLOSE2 = CLIENT_THEMES_EDITOR_CLOSE;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const CACHE_LOADED_324552 = CACHE_LOADED_32455;
const PersistedStore = (Flux).PersistedStore;
let value = _fun32456(PersistedStore);
value.displayName = 'ClientThemesBackgroundStore';
value.persistKey = 'ClientThemesBackgroundStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
{UPDATE_BACKGROUND_GRADIENT_PRESET: function({presetId}) {
var value = undefined;
env0_17 = presetId != null ? BACKGROUND_GRADIENT_PRESETS_MAP[presetId] : value;
return value;
}, UPDATE_MOBILE_PENDING_THEME_INDEX: function({mobileThemesIndex}) {
var value = undefined;
env0_18 = mobileThemesIndex ?? value;
return value;
}, RESET_PREVIEW_CLIENT_THEME: function() {
env0_17 = undefined;
}, CLIENT_THEMES_EDITOR_CLOSE: CLIENT_THEMES_EDITOR_CLOSE2, CHANNEL_SELECT: CHANNEL_SELECT_32469,
LOGOUT: CLIENT_THEMES_EDITOR_CLOSE2, CACHE_LOADED: CACHE_LOADED_324552, CONNECTION_OPEN: CACHE_LOADED_324552,
OVERLAY_INITIALIZE: CACHE_LOADED_324552, SELECTIVELY_SYNCED_USER_SETTINGS_UPDATE: CACHE_LOADED_324552,
UNSYNCED_USER_SETTINGS_UPDATE: CACHE_LOADED_324552, USER_SETTINGS_PROTO_UPDATE: CACHE_LOADED_324552});
(FileImportTrackerModule).fileFinishedImporting('modules/client_themes/ClientThemesBackgroundStore.tsx');
exports.default = value;
function _isNativeReflectConstruct_32449() { // fn#32449, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4113:314, offset: 0x010162b3, size: 94 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_32449_isNativeReflectConstruct = function() {
return !!result;
})();
}
function CLIENT_THEMES_EDITOR_CLOSE() { // fn#32452, offset: 0x01016311, size: 26 bytes, params: 1, frame: 2
if (env0_19) {
}
}
function handleUserStoreChange() { // fn#32453, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4113:587, offset: 0x0101632b, size: 70 bytes, params: 1, frame: 14
const defaultImport = PremiumUtils;
const canUseClientThemes = defaultImport.canUseClientThemes;
const userStoreBinding = UserStore;
const getCurrentUser = userStoreBinding.getCurrentUser;
if (!Reflect.apply(canUseClientThemes, defaultImport, [Reflect.apply(getCurrentUser, userStoreBinding,
[])]) === env0_19) {
return false;
}
}
function handleSelectivelySyncedStoreChange() { // fn#32454, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4113:705, offset: 0x01016371, size: 123 bytes, params: 1, frame: 13
var ClientThemeSettings;
var backgroundGradientPresetId;
const selectivelySyncedUserSettingsStoreBinding = SelectivelySyncedUserSettingsStore;
if (selectivelySyncedUserSettingsStoreBinding.shouldSync('appearance')) {
ClientThemeSettings = (require(3829) /* metro dependency 3829: UserSettings */).ClientThemeSettings;
backgroundGradientPresetId = ClientThemeSettings.getSetting().backgroundGradientPresetId;
if (backgroundGradientPresetId == null) {
if (env0_17 == null) {
return false;
}
env0_17 = undefined;
return undefined;
}
if (BACKGROUND_GRADIENT_PRESETS_MAP[backgroundGradientPresetId] === env0_17) {
return false;
}
return undefined;
}
return false;
}
function CACHE_LOADED_32455() { // fn#32455, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4113:941, offset: 0x010163ec, size: 233 bytes, params: 1, frame: 15
var value2;
var ClientThemeSettings;
var backgroundGradientPresetId;
var moduleValue;
var property;
var binding;
const selectivelySyncedUserSettingsStoreBinding = SelectivelySyncedUserSettingsStore;
if (selectivelySyncedUserSettingsStoreBinding.shouldSync('appearance')) {
value2 = undefined;
ClientThemeSettings = (require(3829) /* metro dependency 3829: UserSettings */).ClientThemeSettings;
backgroundGradientPresetId = ClientThemeSettings.getSetting().backgroundGradientPresetId;
if (UnsyncedUserSettingsStore.useSystemTheme === SystemThemeState.ON && backgroundGradientPresetId != null) {
moduleValue = require(3998) /* metro dependency 3998: ThemeActionCreators */;
moduleValue.setUseSystemTheme(SystemThemeState.OFF);
}
if (backgroundGradientPresetId != null) {
property = BACKGROUND_GRADIENT_PRESETS_MAP[backgroundGradientPresetId];
binding = env0_17;
if (property == null || (binding == null ? value2 : binding.id) === (property == null ? value2 : property.id)) {
}
} else if (env0_17 == null) {
}
return value2;
}
return false;
}
function _fun32456(a0) { // fn#32456, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4113:1256, offset: 0x010164d5, size: 212 bytes, params: 2, frame: 16
const ClientThemesBackgroundStore2 = ClientThemesBackgroundStore;
Inherits(ClientThemesBackgroundStore2, a0);
return CreateClass(ClientThemesBackgroundStore2, [{key: 'initialize', value: value_32459}, {key: 'getState',
value: value_32460}, {key: 'gradientPreset', get: get_32461}, {key: 'getLinearGradient', value: value_32462},
{key: 'isPreview', get: get_32463}, {key: 'isCoachmark', get: get_32464}, {key: 'mobilePendingThemeIndex',
get: get_32465}]);
function ClientThemesBackgroundStore(a0) { // fn#32457, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4113:1268, offset: 0x010165a9, size: 147 bytes, params: 2, frame: 19
var r0;
var Reflect;
let value = copyRestArgs(0, undefined);
let binding = env1_3;
binding(this, ClientThemesBackgroundStore);
const items2 = [];
arraySpread(items2, value, 0, items2);
value = env1_6(ClientThemesBackgroundStore);
binding = env1_5;
if (_isNativeReflectConstruct_32449()) {
Reflect = global.Reflect;
value = Reflect.construct(value, items2, env1_6(this).constructor);
r0 = value;
} else {
value = value.apply(this, items2);
r0 = value;
}
value = binding(this, r0);
value.migrations = [function(a0) {
return {gradientPresetId: a0 == null || a0.gradientPreset == null ? undefined : a0.gradientPreset.id};
}];
return value;
}
function value_32459(a0) { // fn#32459, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4113:1731, offset: 0x01016667, size: 158 bytes, params: 2, frame: 22
var r1;
var value;
if (a0 != null) {
value = undefined;
r1 = (a0 == null ? value : a0.gradientPresetId) != null ? BACKGROUND_GRADIENT_PRESETS_MAP[a0.gradientPresetId] : value;
value = environment.__proto__;
}
const waitFor = this.waitFor;
value = environment.__proto__;
const channelStoreBinding = ChannelStore;
const selectivelySyncedUserSettingsStoreBinding = SelectivelySyncedUserSettingsStore;
const themeStoreBinding = ThemeStore;
const unsyncedUserSettingsStoreBinding = UnsyncedUserSettingsStore;
const userSettingsProtoStoreBinding = UserSettingsProtoStore;
const userStoreBinding = UserStore;
Reflect.apply(waitFor, this, [channelStoreBinding, selectivelySyncedUserSettingsStoreBinding, themeStoreBinding,
unsyncedUserSettingsStoreBinding, userSettingsProtoStoreBinding, userStoreBinding]);
this.syncWith([userStoreBinding], handleUserStoreChange);
this.syncWith([selectivelySyncedUserSettingsStoreBinding], handleSelectivelySyncedStoreChange);
}
function value_32460() { // fn#32460, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4113:1972, offset: 0x01016705, size: 43 bytes, params: 1, frame: 4
const value = environment.__proto__;
return env1_19 ? {} : {gradientPresetId: env1_17?.id};
}
function get_32461() { // fn#32461, offset: 0x00e07553, size: 9 bytes, params: 1, frame: 1
return env1_17;
}
function value_32462() { // fn#32462, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4113:2125, offset: 0x01016730, size: 62 bytes, params: 1, frame: 13
var r0;
const gradientPreset = this.gradientPreset;
let value = null;
if (value == gradientPreset) {
r0 = value;
} else {
value = environment.__proto__;
value = require(3999) /* metro dependency 3999: ClientThemesUtils */;
value = value.getLinearGradientForBackgroundGradient(this.gradientPreset);
r0 = value;
}
return r0;
}
function get_32463() { // fn#32463, offset: 0x00d406a2, size: 9 bytes, params: 1, frame: 1
return env1_19;
}
function get_32464() { // fn#32464, offset: 0x00e4253a, size: 9 bytes, params: 1, frame: 1
return env1_20;
}
function get_32465() { // fn#32465, offset: 0x00df0e82, size: 9 bytes, params: 1, frame: 1
return env1_18;
}
}
function CHANNEL_SELECT_32469({channelId, guildId}) { // fn#32469, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4113:2771, offset: 0x010167c5, size: 187 bytes, params: 2, frame: 18
var moduleValue;
var moduleValue2;
var channel;
if (channelId != null) {
if (guildId != null) {
moduleValue = require(3968) /* metro dependency 3968: DismissibleContentUnsafeUtils */;
if (!moduleValue.UNSAFE_isDismissibleContentDismissed((require(1365) /* metro dependency 1365: dismissible_content */).DismissibleContent.CLIENT_THEMES_COACHMARK)) {
moduleValue2 = require(3995) /* metro dependency 3995: UserUtils */;
if (moduleValue2.ageEligibleForPremiumUpsell(UserStore.getCurrentUser())) {
channel = ChannelStore.getChannel(channelId);
if (channel != null && isGuildTextChannelType(channel.type)) {
}
}
}
}
}
}
}
global.__d(_fun32448, 3964, [6, 7, 15, 17, 18, 1311, 1310, 1312, 1348, 1383, 1379, 1878, 3965, 1313, 3968, 1365,
3995, 3802, 3829, 3998, 3999, 566, 694,
2]) /* metro module 3964, dependencies: [6, 7, 15, 17, 18, 1311, 1310, 1312, 1348, 1383, 1379, 1878, 3965, 1313, 3968, 1365, 3995, 3802, 3829, 3998, 3999, 566, 694, 2] */;