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

205 lines
12 KiB
TypeScript

/* Metro module 9837; source: modules/reactions/native/ReactionUtils.tsx; dependencies: [1379, 4814, 3969, 1878, 661, 1881, 33, 3795, 4081, 4082, 7151, 3802, 4080, 8565, 1962, 4015, 8529, 7152, 4863, 9838, 9846, 9847, 9848, 7950, 7952, 4647, 1244, 4573, 2] */
import ChannelStore from '../../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import UserStore from '../../../stores/UserStore.tsx'; /* Metro dependency 1878 */
import SelectedGuildStore from '../../../stores/SelectedGuildStore.tsx'; /* Metro dependency 3969 */
import AlertActionCreators from '../../../actions/AlertActionCreators.tsx'; /* Metro dependency 4647 */
import MessageStore from '../../../stores/MessageStore.tsx'; /* Metro dependency 4814 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as EmojiConstantsModule from '../../emojis/EmojiConstants.tsx'; /* Metro dependency 1881 */
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
import * as MessageReactionsTypesModule from '../../messages/MessageReactionsTypes.tsx'; /* Metro dependency 7152 */
import * as ReactionIconModule from '../../../design/components/Icon/native/redesign/generated/ReactionIcon.tsx'; /* Metro dependency 7950 */
import * as SuperReactionIconModule from '../../../design/components/Icon/native/redesign/generated/SuperReactionIcon.tsx'; /* Metro dependency 7952 */
function _fun77068(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#77068, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10023:6, offset: 0x01def736, size: 492 bytes, params: 8, frame: 21
const env0_0 = require;
const handleOutOfSuperReactions2 = handleOutOfSuperReactions;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
object = {};
const ReactionTypes = (MessageReactionsTypesModule).ReactionTypes;
let NORMAL = ReactionTypes.NORMAL;
object[NORMAL] = importDefault(9847) /* metro dependency 9847 */;
let BURST = ReactionTypes.BURST;
object[BURST] = importDefault(9848) /* metro dependency 9848 */;
const object2 = {};
NORMAL = ReactionTypes.NORMAL;
const ReactionIcon = (ReactionIconModule).ReactionIcon;
object2[NORMAL] = ReactionIcon;
BURST = ReactionTypes.BURST;
const SuperReactionIcon = (SuperReactionIconModule).SuperReactionIcon;
object2[BURST] = SuperReactionIcon;
(FileImportTrackerModule).fileFinishedImporting('modules/reactions/native/ReactionUtils.tsx');
exports.handleOutOfSuperReactions = handleOutOfSuperReactions2;
exports.handleAddNewReactions = handleAddNewReactions;
exports.handleViewReactions = handleViewReactions;
exports.handleViewPreviewReactions = handleViewPreviewReactions;
exports.ADD_REACTION_ICONS = object;
exports.ADD_REACTION_ICON_COMPONENTS = object2;
exports.handleRemoveAllReactions = handleRemoveAllReactions;
function handleOutOfSuperReactions(a0) { // fn#77069, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10023:245, offset: 0x01def922, size: 149 bytes, params: 2, frame: 17
var r0;
var value3;
var moduleValue;
var defaultImport;
var openLazy;
var value;
const currentUser = UserStore.getCurrentUser();
if (currentUser != null) {
value3 = undefined;
moduleValue = require(dependencyMap[11]);
if (moduleValue.isPremium(currentUser)) {
r0 = value3;
} else {
defaultImport = importDefault(dependencyMap[12]);
openLazy = defaultImport.openLazy;
value = require(dependencyMap[14]);
value = value(dependencyMap[13], dependencyMap.paths);
value = Reflect.apply(openLazy, defaultImport, [value, 'SuperReactionUpsellActionSheet', {onDismiss: a0}]);
r0 = value;
}
return r0;
}
}
function handleAddNewReactions(a0, a1) { // fn#77070, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10023:805, offset: 0x01def9b7, size: 366 bytes, params: 3, frame: 20
var isPremium2;
var moduleValue2;
var value6;
var moduleValue3;
const ReactionTypes = (MessageReactionsTypesModule).ReactionTypes;
let value = a2;
const env0_0 = a0;
const env0_1 = a1;
const value2 = undefined;
const r5 = value !== value2 ? value : (require(7151) /* metro dependency 7151: ReactionActionCreators */).ReactionLocations.MESSAGE;
value = (a3 == null ? value2 : a3.burst) === true;
const currentUser = UserStore.getCurrentUser();
if (currentUser != null) {
isPremium2 = (require(3802) /* metro dependency 3802: PremiumUtils */).isPremium(currentUser);
if (value && !isPremium2) {
handleOutOfSuperReactions();
}
moduleValue2 = require(4015) /* metro dependency 4015: ChatInputUtils */;
value6 = moduleValue2.getBestActiveInputForChannelId(a0.id);
if (value6 != null) {
value6.closeCustomKeyboard();
}
moduleValue3 = require(8529) /* metro dependency 8529: openEmojiPickerActionSheet */;
moduleValue3.openEmojiPickerActionSheet({onPressEmoji: onPressEmoji_77071, channel: a0,
pickerIntention: EmojiIntention.REACTION,
reactionType: value && isPremium2 ? ReactionTypes.BURST : ReactionTypes.NORMAL, analyticsObject: r5,
messageId: a1});
}
return value2;
function handleAddNewReactionsOnPressEmoji(a0, a1) { // fn#77071, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10023:1145, owner: handleAddNewReactions.onPressEmoji, offset: 0x01defb25, size: 199 bytes, params: 3, frame: 24
var value2;
var moduleValue2;
var value;
const id = env0_0.id;
const binding = env0_2;
const object = {burst: a1};
if (a0 != null) {
value = environment.__proto__;
value2 = (require(3795) /* metro dependency 3795: ReactionUtils */).toReactionEmoji(a0);
if (!(object != null && object.burst)) {
moduleValue2 = require(4081) /* metro dependency 4081: HapticUtilsNative */;
moduleValue2.triggerHapticFeedback((importDefault(4082) /* metro dependency 4082: HapticFeedbackTypes */).IMPACT_LIGHT);
}
value = require(7151) /* metro dependency 7151: ReactionActionCreators */;
value.addReaction(id, require, value2, binding, object);
}
}
}
function handleViewReactions(a0) { // fn#77072, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10023:1531, offset: 0x01defbec, size: 430 bytes, params: 2, frame: 28
var r12;
var message;
const messageId = a0.messageId;
const channelId = a0.channelId;
const location = a0.location;
const value = undefined;
const r13 = location !== value ? location : {};
const isPoll = a0.isPoll;
const emoji = a0.emoji;
const object = {'messageId': 0, 'channelId': 0, 'location': 0, 'isPoll': 0, 'emoji': 0};
silentSetPrototypeOf(object, null, undefined);
const value2 = copyDataProperties({}, a0, object, undefined);
const channel = ChannelStore.getChannel(channelId);
const r15 = channel == null ? AnalyticsPages.GUILD_CHANNEL : channel.isPrivate() ? AnalyticsPages.DM_CHANNEL : AnalyticsPages.GUILD_CHANNEL;
const r14 = channel == null ? channel == null ? AnalyticsSections.CHANNEL : channel.isForumPost() ? AnalyticsSections.FORUM_CHANNEL_POST : AnalyticsSections.CHANNEL : channel.isForumLikeChannel() ? AnalyticsSections.FORUM_CHANNEL_POST : channel == null ? AnalyticsSections.CHANNEL : channel.isForumPost() ? AnalyticsSections.FORUM_CHANNEL_POST : AnalyticsSections.CHANNEL;
if (isPoll != null) {
r12 = isPoll;
} else {
message = MessageStore.getMessage(channelId, messageId);
r12 = (message == null ? value : message.isPoll()) === true;
}
const defaultImport = importDefault(dependencyMap[18]);
const trackWithMetadata = defaultImport.trackWithMetadata;
const REACTION_ACTION_SHEET_OPENED = AnalyticEvents.REACTION_ACTION_SHEET_OPENED;
const object2 = {};
object2.guild_id = SelectedGuildStore.getGuildId();
object2.channel_id = channelId;
object2.location_message_id = messageId;
object2.location_message_is_poll = r12;
const object3 = {page: r15, section: r14};
copyDataProperties(object3, r13, object);
object2.location = object3;
Reflect.apply(trackWithMetadata, defaultImport, [REACTION_ACTION_SHEET_OPENED, object2]);
const defaultImport2 = importDefault(dependencyMap[12]);
const openLazy = defaultImport2.openLazy;
const value7 = require(dependencyMap[14])(dependencyMap[19], dependencyMap.paths);
const object4 = {messageId: messageId, channelId: channelId, emoji: emoji};
copyDataProperties(object4, value2, object);
Reflect.apply(openLazy, defaultImport2, [value7, 'MessageReactions', object4]);
return value;
}
function handleViewPreviewReactions(a0, a1, a2) { // fn#77073, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10023:2168, offset: 0x01defd9a, size: 104 bytes, params: 4, frame: 16
const defaultImport = importDefault(dependencyMap[12]);
const openLazy = defaultImport.openLazy;
let value = require(dependencyMap[14]);
value = value(dependencyMap[20], dependencyMap.paths);
Reflect.apply(openLazy, defaultImport, [value, 'MessagePreviewReactions', {messageId: a0, channelId: a1,
emoji: a2}]);
}
function handleRemoveAllReactions(a0, a1) { // fn#77074, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10023:2398, offset: 0x01defe02, size: 314 bytes, params: 3, frame: 23
const env0_0 = a0;
const env0_1 = a1;
const defaultImport = AlertActionCreators;
const show = defaultImport.show;
const object = {};
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
let string = intl.string;
const ZbtGBm = (require(1244) /* metro dependency 1244: indexNative */).t.ZbtGBm;
object.title = Reflect.apply(string, intl, [ZbtGBm]);
const Text = (TextModule).Text;
string = intl.string;
const VpjOCo = (require(1244) /* metro dependency 1244: indexNative */).t.VpjOCo;
object.children = (
<Text variant="text-md/normal">
{Reflect.apply(string, intl, [VpjOCo])}
</Text>
);
object.cancelText = intl.string((require(1244) /* metro dependency 1244: indexNative */).t['ETE/oC']);
object.confirmText = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.oyYWHE);
object.onConfirm = onConfirm_77075;
Reflect.apply(show, defaultImport, [object]);
function handleRemoveAllReactionsOnConfirm() { // fn#77075, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10023:2716, owner: handleRemoveAllReactions.onConfirm, offset: 0x01deff3c, size: 50 bytes, params: 1, frame: 13
let value = environment.__proto__;
value = require(7151) /* metro dependency 7151: ReactionActionCreators */;
return value.removeAllReactions(env0_0, require);
}
}
}
global.__d(_fun77068, 9837, [1379, 4814, 3969, 1878, 661, 1881, 33, 3795, 4081, 4082, 7151, 3802, 4080, 8565, 1962,
4015, 8529, 7152, 4863, 9838, 9846, 9847, 9848, 7950, 7952, 4647, 1244, 4573,
2]) /* metro module 9837, dependencies: [1379, 4814, 3969, 1878, 661, 1881, 33, 3795, 4081, 4082, 7151, 3802, 4080, 8565, 1962, 4015, 8529, 7152, 4863, 9838, 9846, 9847, 9848, 7950, 7952, 4647, 1244, 4573, 2] */;