Files
discord-decomp/sources/modules/reactions/ReactionUtils.tsx
T
2026-07-28 01:06:53 +03:00

106 lines
5.1 KiB
TypeScript

/* Metro module 3795; source: modules/reactions/ReactionUtils.tsx; dependencies: [1226, 661, 3796, 3797, 1244, 3829, 683, 2] */
import AuthenticationStore from '../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as NotificationConstantsModule from '../notifications/NotificationConstants.tsx'; /* Metro dependency 3796 */
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 getReactionEmojiName2 = getReactionEmojiName;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/reactions/ReactionUtils.tsx');
exports.MAX_REACTIONS = 20;
exports.getReactionEmojiName = getReactionEmojiName2;
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 = (IndexNativeModule).t;
const r3 = a3 ? a0 ? t.i9DXqM : t['Z/l+qu'] : a0 ? t.CLuzw5 : t.PirBBE;
const intl = (IndexNativeModule).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));
}
}
global.__d(_fun28930, 3795, [1226, 661, 3796, 3797, 1244, 3829, 683,
2]) /* metro module 3795, dependencies: [1226, 661, 3796, 3797, 1244, 3829, 683, 2] */;