103 lines
4.8 KiB
TypeScript
103 lines
4.8 KiB
TypeScript
/* Metro module 3795; source: modules/reactions/ReactionUtils.tsx; dependencies: [1226, 661, 3796, 3797, 1244, 3829, 683, 2] */
|
|
function _fun28930(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#28930, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3922:6, offset: 0x00f87539, size: 262 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const closure = getReactionEmojiName;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
|
|
const constantsModule = require(661) /* metro dependency 661: Constants */;
|
|
const env0_4 = constantsModule.AnalyticsSections;
|
|
const env0_5 = constantsModule.AnalyticEvents;
|
|
const env0_6 = (require(3796) /* metro dependency 3796: NotificationConstants */).NotificationSettingsUpdateType;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/reactions/ReactionUtils.tsx');
|
|
exports.MAX_REACTIONS = 20;
|
|
exports.getReactionEmojiName = closure;
|
|
exports.getAccessibleEmojiDisplayName = getAccessibleEmojiDisplayName;
|
|
exports.toReactionEmoji = function(a0) {
|
|
var object = {};
|
|
var property = a0.id;
|
|
var value = null;
|
|
var r3 = value != property ? property : value;
|
|
object.id = r3;
|
|
r3 = value != a0.id ? a0.name : a0.optionallyDiverseSequence;
|
|
r3 = value == r3 ? a0.name : r3;
|
|
value = '';
|
|
object.name = value != r3 ? r3 : value;
|
|
object.animated = global.Boolean(a0.animated);
|
|
return object;
|
|
};
|
|
exports.isCustomReactionEmojiId = function(a0) {
|
|
var r0;
|
|
var r1;
|
|
var value = a0 != null;
|
|
r0 = value && a0 !== '';
|
|
if (r0) {
|
|
if (typeof a0 === 'number') {
|
|
r1 = a0 !== 0;
|
|
} else {
|
|
value = (0, global.String)(a0);
|
|
value = value !== '0';
|
|
r1 = value;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
return r0;
|
|
};
|
|
exports.emojiEquals = function(a0, a1) {
|
|
if (a1.id != null) {
|
|
return '' + a1.id === (a0.id != null ? '' + a0.id : a0.id);
|
|
}
|
|
return a0.id == null && a1.name === a0.name;
|
|
};
|
|
exports.getBurstAnalyticsSection = function(a0) {
|
|
return a0.isThread() ? AnalyticsSections.THREAD_TEXT_AREA : a0.isForumPost() ? AnalyticsSections.FORUM_CHANNEL_TEXT_AREA : a0.isGuildVocal() ? AnalyticsSections.TEXT_IN_VOICE : AnalyticsSections.CHANNEL_TEXT_AREA;
|
|
};
|
|
exports.shouldApplyReaction = shouldApplyReaction;
|
|
exports.updateReactionNotificationsSetting = function(a0, a1) {
|
|
require(dependencyMap[5]).ReactionNotifications.updateSetting(a0);
|
|
importDefault(dependencyMap[6]).track(AnalyticEvents.NOTIFICATION_SETTINGS_UPDATED,
|
|
{update_type: NotificationSettingsUpdateType.ACCOUNT, reaction_notifications: a0,
|
|
reaction_notifications_old: a1});
|
|
};
|
|
}
|
|
|
|
function getReactionEmojiName(a0) { // fn#28931, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3922:198, offset: 0x00f8763f, size: 87 bytes, params: 2, frame: 14
|
|
var r0;
|
|
var value;
|
|
if (a0.id == null) {
|
|
value = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */;
|
|
value = value.convertSurrogateToName(a0.name);
|
|
r0 = value;
|
|
} else {
|
|
r0 = ':' + a0.name + ':';
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function getAccessibleEmojiDisplayName(a0, a1, a2, a3) { // fn#28932, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3922:466, offset: 0x00f87696, size: 223 bytes, params: 5, frame: 20
|
|
var r5;
|
|
const value2 = undefined;
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
|
|
const r3 = a3 ? a0 ? t.i9DXqM : t['Z/l+qu'] : a0 ? t.CLuzw5 : t.PirBBE;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const formatToPlainString = intl.formatToPlainString;
|
|
let value = getReactionEmojiName(a2);
|
|
if (value == null) {
|
|
r5 = value2;
|
|
} else {
|
|
value = value.replace(RegExp('[:_]', 'g'), ' ');
|
|
if (value == null) {
|
|
r5 = value2;
|
|
} else {
|
|
value = value.trim();
|
|
r5 = value;
|
|
}
|
|
}
|
|
return Reflect.apply(formatToPlainString, intl, [r3, {reactions: a1, emojiName: r5 ?? ''}]);
|
|
}
|
|
|
|
function shouldApplyReaction({userId, optimistic}) { // fn#28937, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3922:1468, offset: 0x00f878f8, size: 46 bytes, params: 2, frame: 11
|
|
return !(optimistic && !(AuthenticationStore.getId() === userId));
|
|
}
|
|
|