203 lines
10 KiB
TypeScript
203 lines
10 KiB
TypeScript
/* Metro module 5266; source: modules/safety_hub/SafetyHubUtils.tsx; dependencies: [1226, 5267, 661, 4503, 3738, 4631, 1244, 5268, 566, 2] */
|
|
function _fun46833(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#46833, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5444:6, offset: 0x011b0031, size: 340 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const closure = parseMessageEmbedForProps;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
|
|
const safetyHubConstantsModule = require(5267) /* metro dependency 5267: SafetyHubConstants */;
|
|
const env0_4 = safetyHubConstantsModule.AppealIngestionSignal;
|
|
const env0_5 = safetyHubConstantsModule.SafetySystemNotificationCtaType;
|
|
const env0_6 = safetyHubConstantsModule.SafetySystemNotificationEmbedKeys;
|
|
const env0_7 = (require(661) /* metro dependency 661: Constants */).AbortCodes;
|
|
const env0_8 = (require(4503) /* metro dependency 4503: MessageConstants */).SPOILER_ATTACHMENT_PREFIX;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/safety_hub/SafetyHubUtils.tsx');
|
|
exports.getClassificationRelativeIncidentTime = getClassificationRelativeIncidentTime;
|
|
exports.getAttachmentFilename = getAttachmentFilename;
|
|
exports.parseMessageForProps = function(a0) {
|
|
return parseMessageEmbedForProps(a0.embeds[0]);
|
|
};
|
|
exports.parseMessageEmbedForProps = closure;
|
|
exports.mapCtaToNativeData = mapCtaToNativeData;
|
|
exports.isFlaggedContentEmpty = isFlaggedContentEmpty;
|
|
exports.getAppealSignalDisplayText = getAppealSignalDisplayText;
|
|
exports.capitalizeText = function(a0) {
|
|
var r1;
|
|
var r0;
|
|
var value = '';
|
|
if (a0 == null) {
|
|
r0 = value;
|
|
} else if (a0.length === 0) {
|
|
r0 = value;
|
|
} else {
|
|
if (a0.length === 1) {
|
|
r1 = a0.toUpperCase();
|
|
} else {
|
|
value = value + a0.charAt(0).toUpperCase() + a0.slice(1);
|
|
r1 = value;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
return r0;
|
|
};
|
|
exports.isGuildClassification = function(a0) {
|
|
return a0 != null && a0.guild_metadata != null;
|
|
};
|
|
exports.getRequestReviewErrorFromCode = getRequestReviewErrorFromCode;
|
|
exports.getClassificationExpiration = function({max_expiration_time}) {
|
|
var Date;
|
|
var prototype;
|
|
var value;
|
|
var value2;
|
|
var error;
|
|
if (max_expiration_time == null) {
|
|
return null;
|
|
}
|
|
try {
|
|
Date = global.Date;
|
|
prototype = Date.prototype;
|
|
value = Object.create(prototype, {constructor: {value: Date}});
|
|
value2 = new Date(max_expiration_time);
|
|
value = value2 instanceof Object ? value2 : value;
|
|
} catch (error) {
|
|
return null;
|
|
}
|
|
return value;
|
|
};
|
|
exports.useIsSuspendedUser = useIsSuspendedUser;
|
|
exports.isCurrentUserSuspended = isCurrentUserSuspended;
|
|
}
|
|
|
|
function parseMessageEmbedForProps(a0) { // fn#46834, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5444:273, offset: 0x011b0185, size: 298 bytes, params: 2, frame: 18
|
|
var r5;
|
|
var value;
|
|
var object2;
|
|
var property;
|
|
var value3;
|
|
var parseFloat;
|
|
if (a0.fields != null) {
|
|
value = a0.fields.reduce(function(a0, a1) {
|
|
a0[a1.rawName] = a1.rawValue;
|
|
return a0;
|
|
}, {});
|
|
object2 = {};
|
|
property = value[SafetySystemNotificationEmbedKeys.HEADER];
|
|
value3 = '';
|
|
r5 = property ?? value3;
|
|
object2.header = r5;
|
|
object2.icon = value[SafetySystemNotificationEmbedKeys.ICON_TYPE];
|
|
property = value[SafetySystemNotificationEmbedKeys.BODY];
|
|
r5 = property ?? value3;
|
|
object2.body = r5;
|
|
property = value[SafetySystemNotificationEmbedKeys.CTAS];
|
|
object2.ctas = (property ?? value3).split(',').filter(_fun46836);
|
|
parseFloat = global.parseFloat;
|
|
property = value[SafetySystemNotificationEmbedKeys.TIMESTAMP];
|
|
object2.timestamp = parseFloat(property ?? 0);
|
|
object2.theme = value[SafetySystemNotificationEmbedKeys.THEME];
|
|
object2.learn_more_link = value[SafetySystemNotificationEmbedKeys.LEARN_MORE_LINK];
|
|
object2.classification_id = value[SafetySystemNotificationEmbedKeys.CLASSIFICATION_ID];
|
|
return object2;
|
|
}
|
|
}
|
|
|
|
function getClassificationRelativeIncidentTime(a0) { // fn#46837, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5444:818, offset: 0x011b02c7, size: 58 bytes, params: 2, frame: 14
|
|
const value = (importDefault(3738) /* metro dependency 3738 */)();
|
|
return value.to((importDefault(3738) /* metro dependency 3738 */)(a0));
|
|
}
|
|
|
|
function getAttachmentFilename(a0) { // fn#46838, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5444:925, offset: 0x011b0301, size: 162 bytes, params: 2, frame: 16
|
|
var r0;
|
|
var moduleValue2;
|
|
var isVideoFile;
|
|
var value;
|
|
const mediaFormatTestersModule = require(4631) /* metro dependency 4631: MediaFormatTesters */;
|
|
const isImageFile = mediaFormatTestersModule.isImageFile;
|
|
let filename = a0.filename;
|
|
if (Reflect.apply(isImageFile, mediaFormatTestersModule, [filename])) {
|
|
filename = a0.filename;
|
|
value = '.png';
|
|
value = '' + SPOILER_ATTACHMENT_PREFIX + (filename ?? value);
|
|
r0 = value;
|
|
} else {
|
|
moduleValue2 = mediaFormatTestersModule;
|
|
isVideoFile = moduleValue2.isVideoFile;
|
|
filename = a0.filename;
|
|
if (Reflect.apply(isVideoFile, moduleValue2, [filename])) {
|
|
filename = a0.filename;
|
|
value = '.png';
|
|
value = '' + SPOILER_ATTACHMENT_PREFIX + (filename ?? value);
|
|
r0 = value;
|
|
} else {
|
|
r0 = a0.filename ?? '';
|
|
}
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function mapCtaToNativeData(a0, a1, a2) { // fn#46840, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5444:1283, offset: 0x011b03c2, size: 246 bytes, params: 4, frame: 18
|
|
var object2;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
|
|
const value = a1;
|
|
const value2 = a2;
|
|
const LEARN_MORE_LINK = SafetySystemNotificationCtaType.LEARN_MORE_LINK;
|
|
if (LEARN_MORE_LINK === a0) {
|
|
object2 = {};
|
|
object2.text = intl.string(t['8/GdRB']);
|
|
object2.type = SafetySystemNotificationCtaType.LEARN_MORE_LINK;
|
|
object2.key = value ?? '';
|
|
return object2;
|
|
}
|
|
const POLICY_VIOLATION_DETAIL = SafetySystemNotificationCtaType.POLICY_VIOLATION_DETAIL;
|
|
if (POLICY_VIOLATION_DETAIL === a0) {
|
|
return {text: intl.string(t.QsqdXC), type: SafetySystemNotificationCtaType.POLICY_VIOLATION_DETAIL,
|
|
key: value2 ?? ''};
|
|
}
|
|
}
|
|
|
|
function isFlaggedContentEmpty(a0) { // fn#46841, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5444:1616, offset: 0x011b04b8, size: 90 bytes, params: 2, frame: 13
|
|
const type = a0.type;
|
|
const ContentIdType = (require(5268) /* metro dependency 5268: SafetyHubModels */).ContentIdType;
|
|
const MESSAGE = ContentIdType.MESSAGE;
|
|
return type !== MESSAGE || a0.content === '' && a0.attachments.length === 0;
|
|
}
|
|
|
|
function getAppealSignalDisplayText(a0) { // fn#46842, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5444:1768, offset: 0x011b0512, size: 259 bytes, params: 2, frame: 18
|
|
const object2 = {};
|
|
const DIDNT_VIOLATE_POLICY = AppealIngestionSignal.DIDNT_VIOLATE_POLICY;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
let string = intl.string;
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
|
|
object2[DIDNT_VIOLATE_POLICY] = Reflect.apply(string, intl, [t.mZffAi]);
|
|
const TOO_STRICT_UNFAIR = AppealIngestionSignal.TOO_STRICT_UNFAIR;
|
|
object2[TOO_STRICT_UNFAIR] = intl.string(t.wgZVAn);
|
|
const DONT_AGREE_PENALTY = AppealIngestionSignal.DONT_AGREE_PENALTY;
|
|
object2[DONT_AGREE_PENALTY] = intl.string(t.eu8G4k);
|
|
const SOMETHING_ELSE = AppealIngestionSignal.SOMETHING_ELSE;
|
|
string = intl.string;
|
|
const XU3s6r = t.XU3s6r;
|
|
object2[SOMETHING_ELSE] = Reflect.apply(string, intl, [XU3s6r]);
|
|
return object2[a0];
|
|
}
|
|
|
|
function getRequestReviewErrorFromCode(a0) { // fn#46845, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5444:2267, offset: 0x011b069d, size: 142 bytes, params: 2, frame: 15
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
|
|
const DSA_APPEAL_REQUEST_DEFLECTION = AbortCodes.DSA_APPEAL_REQUEST_DEFLECTION;
|
|
return a0 === DSA_APPEAL_REQUEST_DEFLECTION ? intl.string(t['0qyXXH']) : intl.string(t.aPmsx3);
|
|
}
|
|
|
|
function useIsSuspendedUser() { // fn#46847, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5444:2573, offset: 0x011b0766, size: 63 bytes, params: 1, frame: 13
|
|
const fluxModule = require(566) /* metro dependency 566: flux */;
|
|
const useStateFromStores = fluxModule.useStateFromStores;
|
|
return Reflect.apply(useStateFromStores, fluxModule, [[AuthenticationStore], function() {
|
|
return AuthenticationStore.getSuspendedUserToken();
|
|
}]) != null;
|
|
}
|
|
|
|
function isCurrentUserSuspended() { // fn#46849, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5444:2672, offset: 0x011b07b8, size: 25 bytes, params: 1, frame: 9
|
|
return AuthenticationStore.getSuspendedUserToken() != null;
|
|
}
|
|
|