201 lines
8.9 KiB
TypeScript
201 lines
8.9 KiB
TypeScript
/* Metro module 15661; source: modules/age_assurance/AgeVerificationManager.tsx; dependencies: [7, 6, 15, 17, 18, 1379, 4814, 1934, 1878, 661, 6263, 3, 7067, 6896, 1909, 3835, 4861, 4816, 4860, 2] */
|
|
function _fun120055(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#120055, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15869:6, offset: 0x0251f87b, size: 416 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const handleMessageCreate_120059 = function({channelId, message}) {
|
|
MessageStore.getMessage(channelId, message.id);
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(7) /* metro dependency 7 */;
|
|
const env0_4 = importDefault(6) /* metro dependency 6 */;
|
|
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 channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
|
|
const messageStore = importDefault(4814) /* metro dependency 4814: MessageStore */;
|
|
const selectedChannelStore = importDefault(1934) /* metro dependency 1934: SelectedChannelStore */;
|
|
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
|
|
const env0_12 = (require(1878) /* metro dependency 1878: UserStore */).transformUser;
|
|
let value = require(661) /* metro dependency 661: Constants */;
|
|
const env0_13 = value.ChannelTypes;
|
|
const env0_14 = value.MAX_MESSAGES_PER_CHANNEL;
|
|
(require(6263) /* metro dependency 6263: Constants */).SafetyToastType;
|
|
value = importDefault(3) /* metro dependency 3: Logger */;
|
|
value = new value('AgeVerificationManager');
|
|
value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
|
|
value = _fun120060(value);
|
|
value = new value();
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/age_assurance/AgeVerificationManager.tsx');
|
|
exports.default = value;
|
|
}
|
|
|
|
function _isNativeReflectConstruct_120056() { // fn#120056, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15869:293, offset: 0x0251fa1b, size: 98 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_120056_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _fun120060(a0) { // fn#120060, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15869:617, offset: 0x0251faa6, size: 42 bytes, params: 2, frame: 14
|
|
const closure = AgeVerificationManager;
|
|
env0_7(closure, a0);
|
|
return env0_3(closure);
|
|
}
|
|
|
|
function AgeVerificationManager(a0) { // fn#120061, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15869:629, offset: 0x0251fad0, size: 205 bytes, params: 2, frame: 21
|
|
var r0;
|
|
var Reflect;
|
|
let value = copyRestArgs(0, undefined);
|
|
let binding = env1_4;
|
|
binding(this, AgeVerificationManager);
|
|
const items = [];
|
|
arraySpread(items, value, 0, items);
|
|
value = env1_6(AgeVerificationManager);
|
|
binding = env1_5;
|
|
if (_isNativeReflectConstruct_120056()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value, items, env1_6(this).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value.apply(this, items);
|
|
r0 = value;
|
|
}
|
|
value = binding(this, r0);
|
|
value._previousAgeVerificationStatus = null;
|
|
value.handlePostConnectionOpen = handlePostConnectionOpen_120062;
|
|
value.handleCurrentUserUpdate = handleCurrentUserUpdate_120063;
|
|
value.actions = {POST_CONNECTION_OPEN: value.handlePostConnectionOpen,
|
|
CURRENT_USER_UPDATE: value.handleCurrentUserUpdate, MESSAGE_CREATE: handleMessageCreate_120059};
|
|
return value;
|
|
}
|
|
|
|
function AgeVerificationManagerHandlePostConnectionOpen() { // fn#120062, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15869:946, owner: AgeVerificationManager.handlePostConnectionOpen, offset: 0x0251fb9d, size: 62 bytes, params: 1, frame: 13
|
|
const binding = env0_0;
|
|
let value = environment.__proto__.__proto__;
|
|
value = UserStore.getCurrentUser();
|
|
const value2 = null;
|
|
const value3 = undefined;
|
|
const ageVerificationStatus = value2 == value ? value3 : value.ageVerificationStatus;
|
|
binding._previousAgeVerificationStatus = value2 != ageVerificationStatus ? ageVerificationStatus : value2;
|
|
return value3;
|
|
}
|
|
|
|
function AgeVerificationManagerHandleCurrentUserUpdate({user}) { // fn#120063, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15869:1096, owner: AgeVerificationManager.handleCurrentUserUpdate, offset: 0x0251fbdb, size: 486 bytes, params: 2, frame: 23
|
|
var r8;
|
|
var r6;
|
|
var type;
|
|
var r4;
|
|
var moduleValue;
|
|
var channelId;
|
|
var property;
|
|
var defaultImport;
|
|
var closure;
|
|
var binding;
|
|
var value8;
|
|
var defaultImport2;
|
|
var channel;
|
|
var value10;
|
|
var GUILD_FORUM;
|
|
var value11;
|
|
var value12;
|
|
var GUILD_MEDIA;
|
|
var value13;
|
|
var moduleValue2;
|
|
var error;
|
|
let env0_0 = undefined;
|
|
let env0_1 = undefined;
|
|
const r10 = transformUser(user).ageVerificationStatus ?? null;
|
|
const r9 = env0_0._previousAgeVerificationStatus !== r10 && r10 === require(dependencyMap[14]).AgeVerificationStatusUkAndAusOnly.VERIFIED_ADULT;
|
|
if (r9) {
|
|
moduleValue = require(dependencyMap[15]);
|
|
r8 = moduleValue.isFeatureAgeGated(require(dependencyMap[16]).AgeGatedFeature.AGE_GATED_SPACES);
|
|
} else {
|
|
r8 = r9;
|
|
}
|
|
try {
|
|
try {
|
|
if (r8) {
|
|
channelId = SelectedChannelStore.getChannelId();
|
|
env0_0 = channelId;
|
|
env0_1 = false;
|
|
property = dependencyMap[17];
|
|
defaultImport = importDefault(property);
|
|
closure = _fun120064;
|
|
defaultImport.forEach(closure);
|
|
binding = env0_1;
|
|
if (binding) {
|
|
value8 = channelId != null;
|
|
r6 = value8;
|
|
} else {
|
|
r6 = binding;
|
|
}
|
|
if (r6) {
|
|
property = dependencyMap[12];
|
|
defaultImport2 = importDefault(property);
|
|
defaultImport2.fetchMessages({channelId: channelId, limit: MAX_MESSAGES_PER_CHANNEL});
|
|
channel = ChannelStore.getChannel(channelId);
|
|
value10 = channel == null;
|
|
type = value10 ? undefined : channel.type;
|
|
GUILD_FORUM = ChannelTypes.GUILD_FORUM;
|
|
value11 = type !== GUILD_FORUM;
|
|
if (value11) {
|
|
value12 = channel == null;
|
|
type = value12 ? undefined : channel.type;
|
|
GUILD_MEDIA = ChannelTypes.GUILD_MEDIA;
|
|
value13 = type !== GUILD_MEDIA;
|
|
r4 = value13;
|
|
} else {
|
|
r4 = value11;
|
|
}
|
|
if (!r4) {
|
|
property = dependencyMap[13];
|
|
moduleValue2 = require(property);
|
|
moduleValue2.preloadForumThreads(channel);
|
|
}
|
|
}
|
|
}
|
|
} catch (error) {
|
|
binding = env2_15;
|
|
binding.warn('Error clearing cache and refetching messages', error);
|
|
}
|
|
} catch (error) {
|
|
env0_0._previousAgeVerificationStatus = r10;
|
|
throw error;
|
|
}
|
|
env0_0._previousAgeVerificationStatus = r10;
|
|
}
|
|
|
|
function _fun120064({channelId}) { // fn#120064, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15869:1390, offset: 0x0251fdc1, size: 97 bytes, params: 2, frame: 13
|
|
const value = environment.__proto__.__proto__.__proto__;
|
|
const channel = ChannelStore.getChannel(channelId);
|
|
if (channel != null && channel.nsfw) {
|
|
(importDefault(4816) /* metro dependency 4816: ChannelMessages */).clear(channelId);
|
|
if (channelId !== env0_0) {
|
|
}
|
|
}
|
|
}
|
|
|