decord/beta/source/modules/reactions/native/ReactionUtils.tsx
github-actions 30c0bb2ec3 chore: update source for beta 347.10
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4975.js (118.4 MB)
2026-09-24 16:03:38 +00:00

180 lines
7.7 KiB
TypeScript

// Module ID: 10464
// Function ID: 10465
// Name: reactions/ReactionUtils
// Dependencies: [2045, 5010, 4612, 1376, 1078, 1379, 21, 4443, 4758, 4759, 8043, 4450, 4757, 10465, 1984, 4657, 10475, 8042, 4970, 10579, 10591, 10592, 10593, 9067, 9517, 5142, 1119, 4786, 2]
// Exports: handleAddNewReactions, handleOutOfSuperReactions, handleRemoveAllReactions, handleViewPreviewReactions, handleViewReactions
// Module 10464 (reactions/ReactionUtils)
import asyncRequireImpl from "asyncRequireImpl" /* 1984 */;
import ReactionUtils from "ReactionUtils" /* 4443 */;
import ActionSheetActionCreatorsDefault from "ActionSheetActionCreators" /* 4757 */;
import haptics_HapticFeedbackTypesDefault from "haptics/HapticFeedbackTypes" /* 4759 */;
import AppAnalyticsUtilsDefault from "AppAnalyticsUtils" /* 4970 */;
import AlertActionCreatorsDefault from "AlertActionCreators" /* 5142 */;
import ReactionActionCreators from "ReactionActionCreators" /* 8043 */;
import _modDef10592 from "module_10592" /* 10592 */;
import _modDef10593 from "module_10593" /* 10593 */;
import ChannelStore from "ChannelStore" /* 2045 */;
import MessageStore from "MessageStore" /* 5010 */;
import SelectedGuildStore from "SelectedGuildStore" /* 4612 */;
import UserStore from "UserStore" /* 1376 */;
const require = globalThis.__r;
require = fn;
const Constants = fn(1078);
({ AnalyticEvents: closure_7, AnalyticsPages: closure_8, AnalyticsSections: closure_9 } = Constants);
const EmojiIntention = fn(1379).EmojiIntention;
const jsx = fn(21).jsx;
let obj = {};
obj[fn(8042).ReactionTypes.NORMAL] = _modDef10592;
obj[fn(8042).ReactionTypes.BURST] = _modDef10593;
let obj2 = {};
obj2[fn(8042).ReactionTypes.NORMAL] = fn(9067).ReactionIcon;
obj2[fn(8042).ReactionTypes.BURST] = fn(9517).SuperReactionIcon;
const size = fn(2);
let result = size.fileFinishedImporting("modules/reactions/native/ReactionUtils.tsx");
export const handleOutOfSuperReactions = function handleOutOfSuperReactions(onDismiss) {
const currentUser = UserStore.getCurrentUser();
if (null != currentUser) {
let openLazyResult;
if (!obj.isPremium(currentUser)) {
const obj3 = { onDismiss };
openLazyResult = ActionSheetActionCreatorsDefault.openLazy(asyncRequireImpl(10465, dependencyMap.paths), "SuperReactionUpsellActionSheet", obj3);
}
return openLazyResult;
}
};
export const handleAddNewReactions = function handleAddNewReactions(channel, id, MESSAGE, burst) {
_require = channel;
importDefault = id;
if (MESSAGE === undefined) {
MESSAGE = require("ReactionActionCreators").ReactionLocations.MESSAGE;
}
if (burst != null) {
burst = burst.burst;
}
const currentUser = UserStore.getCurrentUser();
if (null != currentUser) {
let ReactionTypes = MESSAGE;
const isPremiumResult = require("PremiumUtils").isPremium(currentUser);
let tmp4 = tmp12;
if (true === burst) {
tmp4 = !isPremiumResult;
}
if (tmp4) {
const currentUser1 = UserStore.getCurrentUser();
if (null != currentUser1) {
if (!tmp13Result.isPremium(currentUser1)) {
require("ActionSheetActionCreators").openLazy(tmp13(ReactionTypes[14])(ReactionTypes[13], ReactionTypes.paths), "SuperReactionUpsellActionSheet", { onDismiss: "emoji" });
const obj3 = require("ActionSheetActionCreators");
}
tmp13Result = tmp13(ReactionTypes[11]);
}
}
const obj7 = require("PremiumUtils");
const bestActiveInputForChannelId = require("ChatInputUtils").getBestActiveInputForChannelId(channel.id);
if (bestActiveInputForChannelId != null) {
bestActiveInputForChannelId.closeCustomKeyboard();
}
require("openEmojiPickerActionSheet");
let obj2 = {
onPressEmoji(byName, burst) {
id = id.id;
const obj = { burst };
if (null != byName) {
const toReactionEmojiResult = ReactionUtils.toReactionEmoji(byName);
if (!obj.burst) {
const result = tmp3(4758).triggerHapticFeedback(haptics_HapticFeedbackTypesDefault.IMPACT_LIGHT);
const tmp3Result = tmp3(4758);
}
const tmp3Result2 = ReactionActionCreators;
tmp3Result2.addReaction(id, tmp, toReactionEmojiResult, tmp2, obj);
}
},
channel,
pickerIntention: EmojiIntention.REACTION,
reactionType: null,
analyticsObject: null,
messageId: null
};
if (true !== burst) {
obj2.reactionType = tmp13(ReactionTypes[17]).ReactionTypes.NORMAL;
obj2.analyticsObject = MESSAGE;
obj2.messageId = id;
obj2 = tmp10(obj2);
}
ReactionTypes = tmp13(ReactionTypes[17]).ReactionTypes;
const BURST = ReactionTypes.BURST;
const tmp13Result3 = require("ChatInputUtils");
}
};
export const handleViewReactions = function handleViewReactions(isPoll) {
({ messageId, channelId, location: _location } = isPoll);
if (_location === undefined) {
_location = {};
}
isPoll = isPoll.isPoll;
const merged = Object.assign(isPoll, Object.assign({ messageId: 0, channelId: 0, location: 0, isPoll: 0, emoji: 0 }));
const channel = ChannelStore.getChannel(channelId);
let isPrivateResult;
if (channel != null) {
isPrivateResult = channel.isPrivate();
}
let isForumLikeChannelResult;
if (channel != null) {
isForumLikeChannelResult = channel.isForumLikeChannel();
}
if (!isForumLikeChannelResult) {
let isForumPostResult;
if (channel != null) {
isForumPostResult = channel.isForumPost();
}
if (!isForumPostResult) {
let FORUM_CHANNEL_POST = constants2.CHANNEL;
}
if (isPoll == null) {
const message = MessageStore.getMessage(channelId, messageId);
let isPollResult;
if (message != null) {
isPollResult = message.isPoll();
}
isPoll = true === isPollResult;
}
const obj = { guild_id: SelectedGuildStore.getGuildId(), channel_id: channelId, location_message_id: messageId, location_message_is_poll: isPoll, location: null };
const obj2 = { page: tmp4, section: FORUM_CHANNEL_POST };
const merged1 = Object.assign(_location);
obj.location = obj2;
AppAnalyticsUtilsDefault.trackWithMetadata(constants.REACTION_ACTION_SHEET_OPENED, obj);
const obj4 = { messageId, channelId, emoji: isPoll.emoji };
const obj6 = ActionSheetActionCreatorsDefault;
const merged2 = Object.assign(merged);
obj6.openLazy(asyncRequireImpl(10579, dependencyMap.paths), "MessageReactions", obj4);
}
FORUM_CHANNEL_POST = constants2.FORUM_CHANNEL_POST;
};
export const handleViewPreviewReactions = function handleViewPreviewReactions(id2, id, emoji) {
ActionSheetActionCreatorsDefault.openLazy(asyncRequireImpl(10591, dependencyMap.paths), "MessagePreviewReactions", { messageId: id2, channelId: id, emoji });
};
export const ADD_REACTION_ICONS = obj;
export const ADD_REACTION_ICON_COMPONENTS = obj2;
export const handleRemoveAllReactions = function handleRemoveAllReactions(arg0, arg1) {
_require = arg0;
importDefault = arg1;
const obj2 = { title: null, children: null, cancelText: null, confirmText: null, onConfirm: null };
const intl = require("util").intl;
obj2.title = intl.string(require("util").t.ZbtGBm);
const obj3 = { variant: "text-md/normal", children: null };
const intl2 = require("util").intl;
obj3.children = intl2.string(require("util").t.VpjOCo);
obj2.children = jsx(require("Text/Text").Text, { variant: "text-md/normal", children: null });
const intl3 = require("util").intl;
obj2.cancelText = intl3.string(require("util").t["ETE/oC"]);
const intl4 = require("util").intl;
obj2.confirmText = intl4.string(require("util").t.oyYWHE);
obj2.onConfirm = function onConfirm() {
return ReactionActionCreators.removeAllReactions(closure_0, closure_1);
};
AlertActionCreatorsDefault.show(obj2);
};