decord/source/modules/reactions/ReactionUtils.tsx

123 lines
4 KiB
TypeScript
Raw Normal View History

2026-07-25 08:10:48 +00:00
// Module ID: 3770
2026-07-27 11:26:19 +00:00
// Function ID: 28962
2026-07-20 16:05:17 +00:00
// Name: getReactionEmojiName
2026-07-25 08:10:48 +00:00
// Dependencies: [1194, 653, 3771, 3772, 1212, 3804, 675, 2]
2026-07-20 16:05:17 +00:00
// Exports: emojiEquals, getAccessibleEmojiDisplayName, getBurstAnalyticsSection, isCustomReactionEmojiId, shouldApplyReaction, toReactionEmoji, updateReactionNotificationsSetting
2026-07-25 08:10:48 +00:00
// Module 3770 (getReactionEmojiName)
2026-07-23 10:11:24 +00:00
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import ME from "ME";
import { NotificationSettingsUpdateType as closure_6 } from "AccountNotificationFlags";
let closure_4;
let closure_5;
const require = arg1;
2026-07-20 16:05:17 +00:00
function getReactionEmojiName(emoji) {
if (null == emoji.id) {
2026-07-25 08:10:48 +00:00
let result = importDefault(3772).convertSurrogateToName(emoji.name);
const obj = importDefault(3772);
2026-07-20 16:05:17 +00:00
} else {
const _HermesInternal = HermesInternal;
result = ":" + emoji.name + ":";
}
return result;
}
2026-07-23 10:11:24 +00:00
({ AnalyticsSections: closure_4, AnalyticEvents: closure_5 } = ME);
let result = require("AccountNotificationFlags").fileFinishedImporting("modules/reactions/ReactionUtils.tsx");
2026-07-20 16:05:17 +00:00
export const MAX_REACTIONS = 20;
export { getReactionEmojiName };
export const getAccessibleEmojiDisplayName = function getAccessibleEmojiDisplayName(me, count, emoji, arg3) {
2026-07-23 10:11:24 +00:00
const t = require(1212) /* getSystemLocale */.t;
2026-07-20 16:05:17 +00:00
if (!arg3) {
2026-07-23 10:11:24 +00:00
const intl = require(1212) /* getSystemLocale */.intl;
2026-07-20 16:05:17 +00:00
const obj = { reactions: count };
const str = getReactionEmojiName(emoji);
let trimmed;
if (null != str) {
const str3 = str.replace(/[:_]/g, " ");
if (null != str3) {
trimmed = str3.trim();
}
}
let str4 = "";
if (null != trimmed) {
str4 = trimmed;
}
obj.emojiName = str4;
return intl.formatToPlainString(me ? t.CLuzw5 : t.PirBBE, obj);
}
};
export const toReactionEmoji = function toReactionEmoji(byName) {
const obj = {};
const id = byName.id;
let tmp = null;
if (null != id) {
tmp = id;
}
obj.id = tmp;
let name = null != byName.id ? byName.name : byName.optionallyDiverseSequence;
if (null == name) {
name = byName.name;
}
let str = "";
if (null != name) {
str = name;
}
obj.name = str;
obj.animated = Boolean(byName.animated);
return obj;
};
export const isCustomReactionEmojiId = function isCustomReactionEmojiId(emojiId) {
let tmp = null != emojiId;
if (tmp) {
tmp = "" !== emojiId;
}
if (!tmp) {
return tmp;
} else if ("number" === typeof emojiId) {
let tmp3 = 0 !== emojiId;
} else {
const _String = String;
tmp3 = "0" !== String(emojiId);
}
};
2026-07-23 10:11:24 +00:00
export const emojiEquals = function emojiEquals(emoji, closure_0) {
if (null != closure_0.id) {
2026-07-20 16:05:17 +00:00
if (null != emoji.id) {
const _HermesInternal = HermesInternal;
let id = "" + emoji.id;
} else {
id = emoji.id;
}
const _HermesInternal2 = HermesInternal;
2026-07-23 10:11:24 +00:00
return "" + closure_0.id === id;
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
return null == emoji.id && closure_0.name === emoji.name;
2026-07-20 16:05:17 +00:00
}
};
export const getBurstAnalyticsSection = function getBurstAnalyticsSection(isThread) {
if (isThread.isThread()) {
let FORUM_CHANNEL_TEXT_AREA = constants.THREAD_TEXT_AREA;
} else if (isThread.isForumPost()) {
FORUM_CHANNEL_TEXT_AREA = constants.FORUM_CHANNEL_TEXT_AREA;
} else {
FORUM_CHANNEL_TEXT_AREA = isThread.isGuildVocal() ? tmp.TEXT_IN_VOICE : tmp.CHANNEL_TEXT_AREA;
}
return FORUM_CHANNEL_TEXT_AREA;
};
export const shouldApplyReaction = function shouldApplyReaction(optimistic) {
optimistic = optimistic.optimistic;
if (optimistic) {
optimistic = id.getId() !== optimistic.userId;
}
return !optimistic;
};
export const updateReactionNotificationsSetting = function updateReactionNotificationsSetting(NumberResult, setting) {
2026-07-25 08:10:48 +00:00
const ReactionNotifications = require(3804) /* explicitContentFromProto */.ReactionNotifications;
2026-07-20 16:05:17 +00:00
ReactionNotifications.updateSetting(NumberResult);
2026-07-23 10:11:24 +00:00
let obj = importDefault(675);
2026-07-20 16:05:17 +00:00
obj = { update_type: constants3.ACCOUNT, reaction_notifications: NumberResult, reaction_notifications_old: setting };
obj.track(constants2.NOTIFICATION_SETTINGS_UPDATED, obj);
};