345 lines
16 KiB
TypeScript
345 lines
16 KiB
TypeScript
/* Metro module 1937; source: modules/impersonate/ImpersonateStore.tsx; dependencies: [6, 7, 15, 17, 18, 1938, 1867, 661, 670, 21, 1943, 1391, 1944, 566, 694, 2] */
|
|
function _fun21484(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#21484, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:6, offset: 0x00ef1d89, size: 410 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_4 = importDefault(6) /* metro dependency 6 */;
|
|
const env0_5 = importDefault(7) /* metro dependency 7 */;
|
|
const env0_6 = importDefault(15) /* metro dependency 15 */;
|
|
const env0_7 = importDefault(17) /* metro dependency 17 */;
|
|
const env0_8 = importDefault(18) /* metro dependency 18 */;
|
|
const guildRoleStore = importDefault(1938) /* metro dependency 1938: GuildRoleStore */;
|
|
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
|
|
const env0_11 = (require(661) /* metro dependency 661: Constants */).GuildSettingsSections;
|
|
const env0_12 = (require(670) /* metro dependency 670: UserSettingsConstants */).ChannelNotificationSettingsFlags;
|
|
const env0_13 = {};
|
|
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
|
|
let value = _fun21488(Store);
|
|
value.displayName = 'ImpersonateStore';
|
|
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
|
|
{IMPERSONATE_UPDATE: IMPERSONATE_UPDATE, IMPERSONATE_STOP: IMPERSONATE_STOP,
|
|
GUILD_ROLE_DELETE: GUILD_ROLE_DELETE,
|
|
USER_GUILD_SETTINGS_CHANNEL_UPDATE_BULK: USER_GUILD_SETTINGS_CHANNEL_UPDATE_BULK,
|
|
GUILD_ONBOARDING_SELECT_OPTION: GUILD_ONBOARDING_SELECT_OPTION,
|
|
GUILD_MEMBER_UPDATE_LOCAL: GUILD_MEMBER_UPDATE_LOCAL});
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/impersonate/ImpersonateStore.tsx');
|
|
exports.default = value;
|
|
}
|
|
|
|
function _isNativeReflectConstruct_21485() { // fn#21485, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:243, offset: 0x00ef1f23, 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_21485_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _fun21488(a0) { // fn#21488, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:451, offset: 0x00ef1f81, size: 425 bytes, params: 2, frame: 16
|
|
const closure = ImpersonateStore;
|
|
env0_8(closure, a0);
|
|
return env0_5(closure, [{key: 'initialize', value: function() {
|
|
this.waitFor(GuildStore, GuildRoleStore);
|
|
}}, {key: 'hasViewingRoles', value: value_21491}, {key: 'isViewingRoles', value: value_21492},
|
|
{key: 'getViewingRoles', value: value_21493}, {key: 'getViewingRolesTimestamp', value: value_21494},
|
|
{key: 'getData', value: value_21495}, {key: 'isFullServerPreview', value: value_21496}, {key: 'isOptInEnabled',
|
|
value: value_21497}, {key: 'isOnboardingEnabled', value: value_21498}, {key: 'getViewingChannels',
|
|
value: value_21499}, {key: 'getOnboardingResponses', value: value_21500}, {key: 'getMemberOptions',
|
|
value: value_21501}, {key: 'isChannelOptedIn', value: function(a0, a1) {
|
|
var r0;
|
|
var value = this.getViewingChannels(a0);
|
|
var value2 = value != null;
|
|
if (value2) {
|
|
value = value.has(a1);
|
|
r0 = value;
|
|
} else {
|
|
r0 = value2;
|
|
}
|
|
return r0;
|
|
}}, {key: 'isViewingServerShop', value: value_21503}, {key: 'getImpersonateType', value: value_21504},
|
|
{key: 'getBackNavigationSection', value: value_21505}]);
|
|
}
|
|
|
|
function IMPERSONATE_UPDATE({guildId, data}) { // fn#21506, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:2770, offset: 0x00ef2591, size: 107 bytes, params: 2, frame: 16
|
|
const roles = data.roles;
|
|
const defaultImport = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
|
|
delete roles[defaultImport.castGuildIdAsEveryoneGuildRoleId(guildId)];
|
|
const binding = env0_13;
|
|
const object2 = {};
|
|
copyDataProperties(object2, data, defaultImport);
|
|
const Date = global.Date;
|
|
object2['timestamp'] = Date.now();
|
|
binding[guildId] = object2;
|
|
}
|
|
|
|
function IMPERSONATE_STOP({guildId}) { // fn#21507, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:2934, offset: 0x00ef25fc, size: 41 bytes, params: 2, frame: 4
|
|
if (env0_13[guildId] == null) {
|
|
return false;
|
|
}
|
|
delete env0_13[guildId];
|
|
}
|
|
|
|
function GUILD_ROLE_DELETE({guildId, roleId}) { // fn#21508, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:3032, offset: 0x00ef2625, size: 57 bytes, params: 2, frame: 5
|
|
if (env0_13[guildId] == null) {
|
|
return false;
|
|
}
|
|
delete env0_13[guildId].roles[roleId];
|
|
}
|
|
|
|
function USER_GUILD_SETTINGS_CHANNEL_UPDATE_BULK({guildId, overrides}) { // fn#21509, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:3170, offset: 0x00ef265e, size: 214 bytes, params: 2, frame: 18
|
|
var r0;
|
|
var set;
|
|
if (guildId == null) {
|
|
return false;
|
|
}
|
|
if (env0_13[guildId] == null) {
|
|
return false;
|
|
}
|
|
const property = env0_13[guildId];
|
|
if (property == null) {
|
|
return false;
|
|
}
|
|
const type = property.type;
|
|
const ImpersonateType = (require(1943) /* metro dependency 1943: ImpersonateTypes */).ImpersonateType;
|
|
const NEW_MEMBER = ImpersonateType.NEW_MEMBER;
|
|
if (type !== NEW_MEMBER) {
|
|
return false;
|
|
}
|
|
const optInChannels = property.optInChannels;
|
|
if (optInChannels != null) {
|
|
r0 = optInChannels;
|
|
} else {
|
|
set = new global.Set();
|
|
}
|
|
let value = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
|
|
value = value.keys(overrides);
|
|
value.forEach(_fun21510);
|
|
property.optInChannels = r0;
|
|
return true;
|
|
}
|
|
|
|
function GUILD_ONBOARDING_SELECT_OPTION({guildId, optionId, selected, removedOptionIds}) { // fn#21511, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:3585, offset: 0x00ef27a3, size: 238 bytes, params: 2, frame: 19
|
|
if (guildId == null) {
|
|
return false;
|
|
}
|
|
if (env0_13[guildId] == null) {
|
|
return false;
|
|
}
|
|
const property = env0_13[guildId];
|
|
if (property == null) {
|
|
return false;
|
|
}
|
|
const type = property.type;
|
|
const ImpersonateType = (require(1943) /* metro dependency 1943: ImpersonateTypes */).ImpersonateType;
|
|
const NEW_MEMBER = ImpersonateType.NEW_MEMBER;
|
|
if (type !== NEW_MEMBER) {
|
|
return false;
|
|
}
|
|
const r0 = property.onboardingResponses ?? new global.Set();
|
|
if (removedOptionIds != null && removedOptionIds.length > 0) {
|
|
removedOptionIds.forEach(_fun21512);
|
|
}
|
|
if (selected) {
|
|
r0.add(optionId);
|
|
} else {
|
|
r0.delete(optionId);
|
|
}
|
|
property.onboardingResponses = r0;
|
|
return true;
|
|
}
|
|
|
|
function GUILD_MEMBER_UPDATE_LOCAL({guildId, roles, flags}) { // fn#21513, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:3963, offset: 0x00ef28a7, size: 153 bytes, params: 2, frame: 18
|
|
var r4;
|
|
var r0;
|
|
if (guildId == null) {
|
|
return false;
|
|
}
|
|
var value;
|
|
const property = env0_13[guildId];
|
|
const value2 = property != null;
|
|
if (value2) {
|
|
if (roles != null) {
|
|
property.roles = roles.reduce(_fun21514, {});
|
|
}
|
|
r4 = flags != null && property.type === (require(1943) /* metro dependency 1943: ImpersonateTypes */).ImpersonateType.NEW_MEMBER;
|
|
value = true;
|
|
if (r4) {
|
|
property.memberOptions.flags = flags;
|
|
r0 = value;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
} else {
|
|
r0 = value2;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function ImpersonateStore() { // fn#21489, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:463, offset: 0x00ef212a, size: 113 bytes, params: 1, frame: 20
|
|
const value = environment.__proto__;
|
|
env1_4(this, ImpersonateStore);
|
|
const value3 = env1_7(ImpersonateStore);
|
|
return env1_6(this, _isNativeReflectConstruct_21485() ? global.Reflect.construct(value3, arguments,
|
|
env1_7(this).constructor) : value3.apply(this, arguments));
|
|
}
|
|
|
|
function value_21491() { // fn#21491, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:821, offset: 0x00ef21b9, size: 45 bytes, params: 1, frame: 12
|
|
const functionUtilsModule = require(1944) /* metro dependency 1944: FunctionUtils */;
|
|
return !functionUtilsModule.isPlainObjectEmpty(env1_13);
|
|
}
|
|
|
|
function value_21492(a0) { // fn#21492, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:900, offset: 0x00ef21e6, size: 29 bytes, params: 2, frame: 4
|
|
var r0;
|
|
let value = a0 != null;
|
|
if (value) {
|
|
value = environment.__proto__;
|
|
value = env1_13[a0] != null;
|
|
r0 = value;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function value_21493(a0) { // fn#21493, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:970, offset: 0x00ef2203, size: 33 bytes, params: 2, frame: 3
|
|
const value = environment.__proto__;
|
|
return env1_13[a0]?.roles;
|
|
}
|
|
|
|
function value_21494(a0) { // fn#21494, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:1065, offset: 0x00ef2224, size: 45 bytes, params: 2, frame: 4
|
|
const value = null;
|
|
return value != a0 ? env1_13[a0] == undefined ? undefined : env1_13[a0].timestamp : value;
|
|
}
|
|
|
|
function value_21496(a0) { // fn#21496, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:1219, offset: 0x00ef2261, size: 70 bytes, params: 2, frame: 13
|
|
const type = env1_13[a0]?.type;
|
|
const ImpersonateType = (require(1943) /* metro dependency 1943: ImpersonateTypes */).ImpersonateType;
|
|
const NEW_MEMBER = ImpersonateType.NEW_MEMBER;
|
|
return type === NEW_MEMBER;
|
|
}
|
|
|
|
function value_21497(a0) { // fn#21497, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:1342, offset: 0x00ef22a7, size: 77 bytes, params: 2, frame: 14
|
|
const value = environment.__proto__;
|
|
const property = env1_13[a0];
|
|
return property != null && property.type === (require(1943) /* metro dependency 1943: ImpersonateTypes */).ImpersonateType.NEW_MEMBER && property.optInEnabled;
|
|
}
|
|
|
|
function value_21498(a0) { // fn#21498, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:1477, offset: 0x00ef22f4, size: 79 bytes, params: 2, frame: 14
|
|
const value = environment.__proto__;
|
|
const property = env1_13[a0];
|
|
return property != null && property.type === (require(1943) /* metro dependency 1943: ImpersonateTypes */).ImpersonateType.NEW_MEMBER && property.onboardingEnabled;
|
|
}
|
|
|
|
function value_21499(a0) { // fn#21499, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:1616, offset: 0x00ef2343, size: 78 bytes, params: 2, frame: 15
|
|
const property = env1_13[a0];
|
|
const value2 = null;
|
|
return value2 == property || property.type !== (require(1943) /* metro dependency 1943: ImpersonateTypes */).ImpersonateType.NEW_MEMBER ? value2 : property.optInChannels;
|
|
}
|
|
|
|
function value_21500(a0) { // fn#21500, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:1759, offset: 0x00ef2391, size: 78 bytes, params: 2, frame: 15
|
|
const property = env1_13[a0];
|
|
const value2 = null;
|
|
return value2 == property || property.type !== (require(1943) /* metro dependency 1943: ImpersonateTypes */).ImpersonateType.NEW_MEMBER ? value2 : property.onboardingResponses;
|
|
}
|
|
|
|
function value_21501(a0) { // fn#21501, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:1902, offset: 0x00ef23df, size: 78 bytes, params: 2, frame: 15
|
|
const property = env1_13[a0];
|
|
const value2 = null;
|
|
return value2 == property || property.type !== (require(1943) /* metro dependency 1943: ImpersonateTypes */).ImpersonateType.NEW_MEMBER ? value2 : property.memberOptions;
|
|
}
|
|
|
|
function value_21503(a0) { // fn#21503, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:2146, offset: 0x00ef2456, size: 77 bytes, params: 2, frame: 14
|
|
var r0;
|
|
let value = a0 != null;
|
|
if (value) {
|
|
value = environment.__proto__;
|
|
value = env1_13[a0]?.type === (require(1943) /* metro dependency 1943: ImpersonateTypes */).ImpersonateType.SERVER_SHOP;
|
|
r0 = value;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function value_21504(a0) { // fn#21504, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:2284, offset: 0x00ef24a3, size: 38 bytes, params: 2, frame: 4
|
|
const value = null;
|
|
if (value == a0) {
|
|
return value;
|
|
}
|
|
const property = env1_13[a0];
|
|
return value == property ? value : property.type;
|
|
}
|
|
|
|
function value_21505(a0) { // fn#21505, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:2397, offset: 0x00ef24c9, size: 200 bytes, params: 2, frame: 15
|
|
var value;
|
|
if (a0 == null) {
|
|
value = environment.__proto__;
|
|
} else {
|
|
var property = env1_13[a0];
|
|
if (property == null) {
|
|
return GuildSettingsSections.ROLES;
|
|
}
|
|
var type = property.type;
|
|
var ImpersonateType = (require(1943) /* metro dependency 1943: ImpersonateTypes */).ImpersonateType;
|
|
var ROLES = ImpersonateType.ROLES;
|
|
if (ROLES === type) {
|
|
return property.returnToSection;
|
|
}
|
|
var SERVER_SHOP = ImpersonateType.SERVER_SHOP;
|
|
if (SERVER_SHOP === type) {
|
|
return property.returnToSection;
|
|
}
|
|
var NEW_MEMBER = ImpersonateType.NEW_MEMBER;
|
|
if (NEW_MEMBER === type) {
|
|
return GuildSettingsSections.ONBOARDING;
|
|
}
|
|
}
|
|
return GuildSettingsSections.ROLES;
|
|
}
|
|
|
|
function _fun21510(a0) { // fn#21510, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:3434, offset: 0x00ef2734, size: 111 bytes, params: 2, frame: 18
|
|
const property = overrides[a0];
|
|
const flagUtilsModule = importAll(1391) /* metro dependency 1391: FlagUtils */;
|
|
const hasFlag = flagUtilsModule.hasFlag;
|
|
const r4 = property.flags ?? 0;
|
|
const OPT_IN_ENABLED = ChannelNotificationSettingsFlags.OPT_IN_ENABLED;
|
|
const hasFlag2 = Reflect.apply(hasFlag, flagUtilsModule, [r4, OPT_IN_ENABLED]);
|
|
const binding = env0_1;
|
|
if (hasFlag2) {
|
|
binding.add(a0);
|
|
} else {
|
|
binding.delete(a0);
|
|
}
|
|
}
|
|
|
|
function _fun21514(a0, a1) { // fn#21514, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2064:4106, offset: 0x00ef2940, size: 44 bytes, params: 3, frame: 14
|
|
let value = environment.__proto__;
|
|
value = GuildRoleStore.getRole(guildId, a1);
|
|
if (value != null) {
|
|
a0[a1] = value;
|
|
}
|
|
return a0;
|
|
}
|
|
|