Files
discord-decomp/modules/instant_invite/native/components/InstantInviteConstants.tsx
T
2026-11-01 12:12:55 +02:00

225 lines
7.6 KiB
TypeScript

// Metro module 12237 (f12238).
import { Linking } from "react-native";
import { SHARE_APPS_KEY, SHARE_URLS } from "../InstantInviteConstants";
import { InviteOptionsType, SendTypes } from "../../../../Constants";
import Share from "../../../icons/native/Share";
import Module12238 from "../../../../_bundle/Module12238";
import Module712 from "../../../../_bundle/Module712";
import { intl, t } from "../../../../intl/index.native";
import { handleOpenShareSheet, handleCopy, trackOptionClicked, isAppInstalled } from "../InstantInviteUtils";
import Module10200 from "../../../../_bundle/Module10200";
import Module4134 from "../../../../_bundle/Module4134";
import Module12239 from "../../../../_bundle/Module12239";
import { isMetaQuest } from "../../../device/MetaQuestUtils.android";
import Module12240 from "../../../../_bundle/Module12240";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import getInviteURL from "../../getInviteURL";
import { isIOS, isAndroid } from "../../../../utils/PlatformUtils";
import Module12258 from "../../../../_bundle/Module12258";
import Module12259 from "../../../../_bundle/Module12259";
import { canSendSMS, sendSMS, canSendMail, sendMail } from "../DCDSendUtils";
import MessageActionCreators from "../../../../actions/MessageActionCreators";
import AlertActionCreators from "../../../../actions/native/AlertActionCreators";
import Module12260 from "../../../../_bundle/Module12260";
import Module11841 from "../../../../_bundle/Module11841";
import Module12261 from "../../../../_bundle/Module12261";
import Module12262 from "../../../../_bundle/Module12262";
import Module12263 from "../../../../_bundle/Module12263";
import Module12264 from "../../../../_bundle/Module12264";
import Module12265 from "../../../../_bundle/Module12265";
import Module12266 from "../../../../_bundle/Module12266";
const r28 = {
SHARE: 0,
0: "SHARE",
COPY: 1,
1: "COPY",
QR_CODE: 2,
2: "QR_CODE",
MESSAGES: 3,
3: "MESSAGES",
MAIL: 4,
4: "MAIL",
FB_MESSENGER: 5,
5: "FB_MESSENGER",
GMAIL: 6,
6: "GMAIL",
TELEGRAM: 7,
7: "TELEGRAM",
TWITTER: 8,
8: "TWITTER",
WHATSAPP: 9,
9: "WHATSAPP",
LINE: 10,
10: "LINE"
};
const r64 = [{
type: r28.SHARE,
icon: Share,
isAvailable: Promise.resolve(true),
IconComponent: Module12238,
backgroundColor: Module712.unsafe_rawColors.BRAND_500,
getLabel: () => intl.string(t.wPadMa),
onPress: (a0) => handleOpenShareSheet(a0.code, a0.channel, a0.message, a0.location)
}, {
type: r28.COPY,
icon: Module10200,
isAvailable: Promise.resolve(true),
IconComponent: Module4134,
getLabel: () => intl.string(t.WqhZss),
onPress: (a0) => handleCopy(a0.code, a0.channel, a0.location)
}, {
type: r28.QR_CODE,
icon: Module12239,
isAvailable: Promise.resolve(!isMetaQuest()),
IconComponent: Module12240,
getLabel: () => intl.string(t.rriLm1),
onPress: ({ code: code3, channel: channel3, location: location2 }) => {
ActionSheetActionCreators.openLazy(import("./InstantInviteQRCodeActionSheet"), `InstantInviteQRCodeActionSheet-${code3}`, {
link: getInviteURL(code3),
location: location2,
channel: channel3
}, "stack");
}
}, {
type: r28.MESSAGES,
fullIcon: isIOS() ? Module12258 : void 0,
icon: isAndroid() ? Module12259 : void 0,
isAvailable: canSendSMS(),
getLabel: () => intl.string(t.AQKfCj),
onPress: (a0) => {
const { channel, code, message } = a0;
trackOptionClicked(code, channel, InviteOptionsType.SMS, a0.location);
if (isIOS()) {
ActionSheetActionCreators.hideActionSheet();
}
sendSMS({
body: message
}, (a0, a1, a2) => {
if (a0) {
let channelId = channel?.id;
if (channelId == null) {
channelId = null;
}
MessageActionCreators.trackInvite({
inviteKey: code,
channelId,
messageId: null,
location: "SMS Option",
overrideProperties: {
send_type: SendTypes.SMS
}
});
}
if (a2) {
AlertActionCreators.show({
body: intl.string(t["1ieAR5"]),
isDismissable: true
});
}
});
}
}, {
type: r28.MAIL,
fullIcon: isIOS() ? Module12260 : void 0,
icon: isAndroid() ? Module11841 : void 0,
isAvailable: canSendMail(),
getLabel: () => intl.string(t.QaAypP),
onPress: (a0) => {
const { channel: channel2, code: code2, message } = a0;
trackOptionClicked(code2, channel2, InviteOptionsType.EMAIL, a0.location);
if (isIOS()) {
ActionSheetActionCreators.hideActionSheet();
}
sendMail({
subject: "",
body: message
}, (a0, a1, a2) => {
if (a0) {
let channelId = channel2?.id;
if (channelId == null) {
channelId = null;
}
MessageActionCreators.trackInvite({
inviteKey: code2,
channelId,
messageId: null,
location: "Email Option",
overrideProperties: {
send_type: SendTypes.EMAIL
}
});
}
if (a2) {
AlertActionCreators.show({
body: intl.string(t["1ieAR5"]),
isDismissable: true
});
}
});
}
}, {
type: r28.FB_MESSENGER,
fullIcon: Module12261,
isAvailable: isAppInstalled(SHARE_APPS_KEY.MESSENGER),
getLabel: () => intl.string(t.P0R3ZF),
onPress: ({ channel: channel3, code: code3, location: location2 }) => {
const inviteURL = getInviteURL(code3);
trackOptionClicked(code3, channel3, InviteOptionsType.MESSENGER, location2);
Linking.openURL(SHARE_URLS[SHARE_APPS_KEY.MESSENGER](inviteURL));
}
}, {
type: r28.GMAIL,
fullIcon: Module12262,
isAvailable: isAppInstalled(SHARE_APPS_KEY.GMAIL),
getLabel: () => intl.string(t["14o9ZT"]),
onPress: (a0) => {
const { channel: channel3, code: code3, message } = a0;
trackOptionClicked(code3, channel3, InviteOptionsType.GMAIL, a0.location);
Linking.openURL(SHARE_URLS[SHARE_APPS_KEY.GMAIL]("", message));
}
}, {
type: r28.TELEGRAM,
fullIcon: Module12263,
isAvailable: isAppInstalled(SHARE_APPS_KEY.TELEGRAM),
getLabel: () => intl.string(t["148qIV"]),
onPress: ({ channel: channel3, code: code3, message, location: location2 }) => {
const inviteURL = getInviteURL(code3);
trackOptionClicked(code3, channel3, InviteOptionsType.TELEGRAM, location2);
Linking.openURL(SHARE_URLS[SHARE_APPS_KEY.TELEGRAM](message, inviteURL));
}
}, {
type: r28.TWITTER,
fullIcon: Module12264,
isAvailable: isAppInstalled(SHARE_APPS_KEY.TWITTER),
getLabel: () => intl.string(t.oAiltV),
onPress: (a0) => {
const { channel: channel3, code: code3, message } = a0;
trackOptionClicked(code3, channel3, InviteOptionsType.TWITTER, a0.location);
Linking.openURL(SHARE_URLS[SHARE_APPS_KEY.TWITTER](message));
}
}, {
type: r28.WHATSAPP,
fullIcon: Module12265,
isAvailable: isAppInstalled(SHARE_APPS_KEY.WHATSAPP),
getLabel: () => intl.string(t.viazhS),
onPress: (a0) => {
const { channel: channel3, code: code3, message } = a0;
trackOptionClicked(code3, channel3, InviteOptionsType.WHATSAPP, a0.location);
Linking.openURL(SHARE_URLS[SHARE_APPS_KEY.WHATSAPP](message));
}
}, {
type: r28.LINE,
fullIcon: Module12266,
isAvailable: isAppInstalled(SHARE_APPS_KEY.LINE),
getLabel: () => intl.string(t.kqgslH),
onPress: (a0) => {
const { channel: channel3, code: code3, message } = a0;
trackOptionClicked(code3, channel3, InviteOptionsType.LINE, a0.location);
Linking.openURL(SHARE_URLS[SHARE_APPS_KEY.LINE](message));
}
}];
const r197 = [r64[0], r64[1]];
export { r28 as ShareItemType };
export { r64 as SHARE_ITEMS };
export { r197 as SHARE_ITEMS_DEFAULT };