225 lines
11 KiB
TypeScript
225 lines
11 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] */
|
|
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 closure = CLIENT_THEMES_EDITOR_CLOSE;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(6) /* metro dependency 6 */;
|
|
const env0_4 = importDefault(7) /* metro dependency 7 */;
|
|
const env0_5 = importDefault(15) /* metro dependency 15 */;
|
|
const env0_6 = importDefault(17) /* metro dependency 17 */;
|
|
const env0_7 = importDefault(18) /* metro dependency 18 */;
|
|
const selectivelySyncedUserSettingsStore = importDefault(1311) /* metro dependency 1311: SelectivelySyncedUserSettingsStore */;
|
|
const themeStore = importDefault(1310) /* metro dependency 1310: ThemeStore */;
|
|
const unsyncedUserSettingsStore = importDefault(1312) /* metro dependency 1312: UnsyncedUserSettingsStore */;
|
|
const userSettingsProtoStore = importDefault(1348) /* metro dependency 1348: UserSettingsProtoStore */;
|
|
const env0_12 = (require(1383) /* metro dependency 1383: ChannelRecord */).isGuildTextChannelType;
|
|
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
|
|
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
|
|
const env0_15 = (require(3965) /* metro dependency 3965: ClientThemesConstants */).BACKGROUND_GRADIENT_PRESETS_MAP;
|
|
const env0_16 = (require(1313) /* metro dependency 1313: ThemeConstants */).SystemThemeState;
|
|
const closure2 = CACHE_LOADED_32455;
|
|
const PersistedStore = (importDefault(566) /* metro dependency 566: 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: closure, CHANNEL_SELECT: CHANNEL_SELECT_32469, LOGOUT: closure,
|
|
CACHE_LOADED: closure2, CONNECTION_OPEN: closure2, OVERLAY_INITIALIZE: closure2,
|
|
SELECTIVELY_SYNCED_USER_SETTINGS_UPDATE: closure2, UNSYNCED_USER_SETTINGS_UPDATE: closure2,
|
|
USER_SETTINGS_PROTO_UPDATE: closure2});
|
|
(require(2) /* metro dependency 2 */).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 = importDefault(3802) /* metro dependency 3802: PremiumUtils */;
|
|
const canUseClientThemes = defaultImport.canUseClientThemes;
|
|
const getCurrentUser = UserStore.getCurrentUser;
|
|
if (!Reflect.apply(canUseClientThemes, defaultImport, [Reflect.apply(getCurrentUser, UserStore, [])]) === 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;
|
|
if (SelectivelySyncedUserSettingsStore.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;
|
|
if (SelectivelySyncedUserSettingsStore.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 closure = ClientThemesBackgroundStore;
|
|
env0_7(closure, a0);
|
|
return env0_4(closure, [{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 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)) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
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__;
|
|
Reflect.apply(waitFor, this, [ChannelStore, SelectivelySyncedUserSettingsStore, ThemeStore,
|
|
UnsyncedUserSettingsStore, UserSettingsProtoStore, UserStore]);
|
|
this.syncWith([UserStore], handleUserStoreChange);
|
|
this.syncWith([SelectivelySyncedUserSettingsStore], 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 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;
|
|
}
|
|
|