134 lines
5.6 KiB
TypeScript
134 lines
5.6 KiB
TypeScript
// Metro module 9312 (f9313).
|
|
import ChannelStore from "../../../stores/ChannelStore";
|
|
import MessageStore from "../../../stores/MessageStore";
|
|
import SelectedGuildStore from "../../../stores/SelectedGuildStore";
|
|
import UserStore from "../../../stores/UserStore";
|
|
import { AnalyticEvents, AnalyticsPages, AnalyticsSections } from "../../../Constants";
|
|
import { EmojiIntention } from "../../emojis/EmojiConstants";
|
|
import { toReactionEmoji } from "../ReactionUtils";
|
|
import { triggerHapticFeedback } from "../../haptics/HapticUtils.native";
|
|
import HapticFeedbackTypes from "../../haptics/HapticFeedbackTypes";
|
|
import { ReactionLocations, addReaction, removeAllReactions } from "../ReactionActionCreators";
|
|
import * as _PremiumUtils from "../../../utils/PremiumUtils";
|
|
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
|
|
import { getBestActiveInputForChannelId } from "../../../utils/native/ChatInputUtils";
|
|
import { openEmojiPickerActionSheet } from "../../emoji_picker/native/openEmojiPickerActionSheet";
|
|
import { ReactionTypes } from "../../messages/MessageReactionsTypes";
|
|
import AppAnalyticsUtils from "../../app_analytics/AppAnalyticsUtils";
|
|
import Module9462 from "../../../_bundle/Module9462";
|
|
import Module9463 from "../../../_bundle/Module9463";
|
|
import { ReactionIcon } from "../../../design/components/Icon/native/redesign/generated/ReactionIcon";
|
|
import { SuperReactionIcon } from "../../../design/components/Icon/native/redesign/generated/SuperReactionIcon";
|
|
import AlertActionCreators from "../../../actions/AlertActionCreators";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import { Text } from "../../../design/components/Text/native/Text";
|
|
const r31 = {};
|
|
r31[ReactionTypes.NORMAL] = Module9462;
|
|
r31[ReactionTypes.BURST] = Module9463;
|
|
const r44 = {};
|
|
r44[ReactionTypes.NORMAL] = ReactionIcon;
|
|
r44[ReactionTypes.BURST] = SuperReactionIcon;
|
|
export function handleOutOfSuperReactions(a0) {
|
|
const currentUser = UserStore.getCurrentUser();
|
|
if (currentUser != null) {
|
|
return _PremiumUtils.isPremium(currentUser) ? void 0 : ActionSheetActionCreators.openLazy(import("../../messages/native/burst_reactions/SuperReactionUpsellActionSheet"), "SuperReactionUpsellActionSheet", {
|
|
onDismiss: a0
|
|
});
|
|
}
|
|
}
|
|
export function handleAddNewReactions(a0, a1) {
|
|
let c17140_0 = a0;
|
|
let c17140_1 = a1;
|
|
let r9 = arguments[2];
|
|
if (r9 === void 0) {
|
|
r9 = ReactionLocations.MESSAGE;
|
|
}
|
|
const MESSAGE = r9;
|
|
const burst = arguments[3]?.burst;
|
|
const currentUser = UserStore.getCurrentUser();
|
|
if (currentUser != null) {
|
|
const r25 = burst === true;
|
|
const isPremium = _PremiumUtils.isPremium(currentUser);
|
|
if (r25 && !isPremium) {
|
|
const currentUser2 = UserStore.getCurrentUser();
|
|
if (currentUser2 != null && !_PremiumUtils.isPremium(currentUser2)) {
|
|
ActionSheetActionCreators.openLazy(import("../../messages/native/burst_reactions/SuperReactionUpsellActionSheet"), "SuperReactionUpsellActionSheet", {
|
|
onDismiss: void 0
|
|
});
|
|
}
|
|
}
|
|
const bestActiveInputForChannelId = getBestActiveInputForChannelId(a0.id);
|
|
if (bestActiveInputForChannelId != null) {
|
|
bestActiveInputForChannelId.closeCustomKeyboard();
|
|
}
|
|
openEmojiPickerActionSheet({
|
|
onPressEmoji: function onPressEmoji(a0, a1) {
|
|
const id = c17140_0.id;
|
|
const r4 = {
|
|
burst: a1
|
|
};
|
|
if (a0 != null) {
|
|
const r23 = toReactionEmoji(a0);
|
|
if (!r4.burst) {
|
|
triggerHapticFeedback(HapticFeedbackTypes.IMPACT_LIGHT);
|
|
}
|
|
addReaction(id, c17140_1, r23, MESSAGE, r4);
|
|
}
|
|
},
|
|
channel: a0,
|
|
pickerIntention: EmojiIntention.REACTION,
|
|
reactionType: r25 && isPremium ? ReactionTypes.BURST : ReactionTypes.NORMAL,
|
|
analyticsObject: MESSAGE,
|
|
messageId: a1
|
|
});
|
|
}
|
|
}
|
|
export function handleViewReactions(a0) {
|
|
const { messageId, channelId, location: location2 = {}, isPoll: _isPoll, emoji, ...rest } = a0;
|
|
let isPoll = a0.isPoll;
|
|
const channel = ChannelStore.getChannel(channelId);
|
|
const page = (channel == null ? void 0 : channel.isPrivate()) ? AnalyticsPages.DM_CHANNEL : AnalyticsPages.GUILD_CHANNEL;
|
|
const section = (channel == null ? void 0 : channel.isForumLikeChannel()) ? AnalyticsSections.FORUM_CHANNEL_POST : (channel == null ? void 0 : channel.isForumPost()) ? AnalyticsSections.FORUM_CHANNEL_POST : AnalyticsSections.CHANNEL;
|
|
if (isPoll == null) {
|
|
const message = MessageStore.getMessage(channelId, messageId);
|
|
isPoll = (message == null ? void 0 : message.isPoll()) === true;
|
|
}
|
|
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.REACTION_ACTION_SHEET_OPENED, {
|
|
guild_id: SelectedGuildStore.getGuildId(),
|
|
channel_id: channelId,
|
|
location_message_id: messageId,
|
|
location_message_is_poll: isPoll,
|
|
location: {
|
|
page,
|
|
section,
|
|
...location2
|
|
}
|
|
});
|
|
ActionSheetActionCreators.openLazy(import("./MessageReactions"), "MessageReactions", {
|
|
messageId,
|
|
channelId,
|
|
emoji,
|
|
...rest
|
|
});
|
|
}
|
|
export function handleViewPreviewReactions(a0, a1, a2) {
|
|
ActionSheetActionCreators.openLazy(import("./MessagePreviewReactions"), "MessagePreviewReactions", {
|
|
messageId: a0,
|
|
channelId: a1,
|
|
emoji: a2
|
|
});
|
|
}
|
|
export { r31 as ADD_REACTION_ICONS };
|
|
export { r44 as ADD_REACTION_ICON_COMPONENTS };
|
|
export function handleRemoveAllReactions(c17141_0, c17141_1) {
|
|
AlertActionCreators.show({
|
|
title: intl.string(t.ZbtGBm),
|
|
children: <Text variant="text-md/normal">
|
|
{intl.string(t.VpjOCo)}
|
|
</Text>,
|
|
cancelText: intl.string(t["ETE/oC"]),
|
|
confirmText: intl.string(t.oyYWHE),
|
|
onConfirm: () => removeAllReactions(c17141_0, c17141_1)
|
|
});
|
|
}
|