128 lines
5.5 KiB
TypeScript
128 lines
5.5 KiB
TypeScript
// Module ID: 7857
|
|
// Function ID: 7858
|
|
// Name: MessageAccessibilityAction
|
|
// Dependencies: [5083, 3883, 676, 3928, 7858, 1236, 7865, 2]
|
|
// Exports: createMessageAccessibilityActions, getMessageAccessibilityActionFromLabel
|
|
|
|
// Module 7857 (MessageAccessibilityAction)
|
|
import recomputeGuild from "recomputeGuild";
|
|
import getUncachedChannelPermissions from "getUncachedChannelPermissions";
|
|
import { Permissions } from "ME";
|
|
|
|
const require = arg1;
|
|
let obj = { VIEW_PROFILE: "view_profile", ADD_REACTION: "add_reaction", ADD_QUICK_REACTION: "add_quick_reaction", REPLY: "reply", MESSAGE_ACTIONS_MENU: "message_actions_menu", EDIT_GDM: "edit_gdm", OPEN_PINS: "open_pins", JUMP_TO_MESSAGE: "jump_to_message" };
|
|
let result = require("ME").fileFinishedImporting("modules/messages/native/MessageAccessibilityActions.tsx");
|
|
|
|
export const MessageAccessibilityAction = obj;
|
|
export const getMessageAccessibilityActionFromLabel = function getMessageAccessibilityActionFromLabel(action) {
|
|
let obj = {};
|
|
const intl = require(1236) /* getSystemLocale */.intl;
|
|
obj[intl.string(require(1236) /* getSystemLocale */.t.iXAna6)] = obj.VIEW_PROFILE;
|
|
const intl2 = require(1236) /* getSystemLocale */.intl;
|
|
obj[intl2.string(require(1236) /* getSystemLocale */.t.lfIHs4)] = obj.ADD_REACTION;
|
|
const intl3 = require(1236) /* getSystemLocale */.intl;
|
|
obj[intl3.string(require(1236) /* getSystemLocale */.t["5IEsGx"])] = obj.REPLY;
|
|
const intl4 = require(1236) /* getSystemLocale */.intl;
|
|
obj[intl4.string(require(1236) /* getSystemLocale */.t.ChPNkN)] = obj.MESSAGE_ACTIONS_MENU;
|
|
const intl5 = require(1236) /* getSystemLocale */.intl;
|
|
obj[intl5.string(require(1236) /* getSystemLocale */.t["5Q9+/L"])] = obj.EDIT_GDM;
|
|
const intl6 = require(1236) /* getSystemLocale */.intl;
|
|
obj[intl6.string(require(1236) /* getSystemLocale */.t["mp1N/2"])] = obj.OPEN_PINS;
|
|
const intl7 = require(1236) /* getSystemLocale */.intl;
|
|
obj[intl7.string(require(1236) /* getSystemLocale */.t["+TSRGD"])] = obj.JUMP_TO_MESSAGE;
|
|
const DoubleTapReactionEmoji = require(3928) /* explicitContentFromProto */.DoubleTapReactionEmoji;
|
|
const setting = DoubleTapReactionEmoji.getSetting();
|
|
let disableDoubleTap;
|
|
if (setting != null) {
|
|
disableDoubleTap = setting.disableDoubleTap;
|
|
}
|
|
let formatToPlainStringResult = null;
|
|
if (true !== disableDoubleTap) {
|
|
if (null != setting) {
|
|
const result = tmp(7858).disambiguatedEmojiFromSettingsValue(setting);
|
|
if (null != result) {
|
|
const intl9 = tmp(1236).intl;
|
|
obj = { emojiName: null };
|
|
obj[0] = result.name;
|
|
formatToPlainStringResult = intl9.formatToPlainString(tmp(1236).t.eQIttH, obj);
|
|
}
|
|
const tmpResult = tmp(7858);
|
|
}
|
|
const intl8 = tmp(1236).intl;
|
|
formatToPlainStringResult = intl8.formatToPlainString(tmp(1236).t.eQIttH, { emojiName: "heart" });
|
|
}
|
|
if (null != formatToPlainStringResult) {
|
|
obj[formatToPlainStringResult] = obj.ADD_QUICK_REACTION;
|
|
}
|
|
return obj[action];
|
|
};
|
|
export const createMessageAccessibilityActions = function createMessageAccessibilityActions(message, channel) {
|
|
if (null == channel) {
|
|
return [];
|
|
} else {
|
|
const guildId = channel.getGuildId();
|
|
let canChatInGuildResult = null != guildId;
|
|
if (canChatInGuildResult) {
|
|
canChatInGuildResult = recomputeGuild.canChatInGuild(guildId);
|
|
}
|
|
if (canChatInGuildResult) {
|
|
canChatInGuildResult = getUncachedChannelPermissions.can(Permissions.ADD_REACTIONS, channel);
|
|
}
|
|
if (!canChatInGuildResult) {
|
|
canChatInGuildResult = channel.isPrivate();
|
|
}
|
|
let obj = { label: null, name: null };
|
|
const intl = require(1236) /* getSystemLocale */.intl;
|
|
obj[0] = intl.string(require(1236) /* getSystemLocale */.t.iXAna6);
|
|
obj[1] = obj.VIEW_PROFILE;
|
|
const items = [obj];
|
|
if (canChatInGuildResult) {
|
|
obj = { label: null, name: null };
|
|
const intl2 = tmp5(1236).intl;
|
|
obj[0] = intl2.string(tmp5(1236).t.lfIHs4);
|
|
obj[1] = tmp7.ADD_REACTION;
|
|
items.push(obj);
|
|
const DoubleTapReactionEmoji = tmp5(3928).DoubleTapReactionEmoji;
|
|
const setting = DoubleTapReactionEmoji.getSetting();
|
|
let disableDoubleTap;
|
|
if (setting != null) {
|
|
disableDoubleTap = setting.disableDoubleTap;
|
|
}
|
|
let formatToPlainStringResult = null;
|
|
if (true !== disableDoubleTap) {
|
|
if (null != setting) {
|
|
let tmp5Result = tmp5(7858);
|
|
const result = tmp5Result.disambiguatedEmojiFromSettingsValue(setting);
|
|
if (null != result) {
|
|
const intl4 = tmp5(1236).intl;
|
|
obj = { emojiName: null };
|
|
obj[0] = result.name;
|
|
formatToPlainStringResult = intl4.formatToPlainString(tmp5(1236).t.eQIttH, obj);
|
|
}
|
|
}
|
|
const intl3 = tmp5(1236).intl;
|
|
formatToPlainStringResult = intl3.formatToPlainString(tmp5(1236).t.eQIttH, { emojiName: "heart" });
|
|
}
|
|
if (null != formatToPlainStringResult) {
|
|
const obj1 = { label: null, name: null };
|
|
obj1[0] = formatToPlainStringResult;
|
|
obj1[1] = tmp7.ADD_QUICK_REACTION;
|
|
items.push(obj1);
|
|
}
|
|
}
|
|
tmp5Result = tmp5(7865);
|
|
if (tmp5Result.canReplyToMessage(channel, message)) {
|
|
const obj2 = { label: null, name: null };
|
|
const intl5 = tmp5(1236).intl;
|
|
obj2[0] = intl5.string(tmp5(1236).t["5IEsGx"]);
|
|
obj2[1] = tmp7.REPLY;
|
|
items.push(obj2);
|
|
}
|
|
const obj3 = { label: null, name: null };
|
|
const intl6 = tmp5(1236).intl;
|
|
obj3[0] = intl6.string(require(1236) /* getSystemLocale */.t.ChPNkN);
|
|
obj3[1] = obj.MESSAGE_ACTIONS_MENU;
|
|
items.push(obj3);
|
|
return items;
|
|
}
|
|
};
|