Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4823.js (118.4 MB)
393 lines
14 KiB
TypeScript
393 lines
14 KiB
TypeScript
// Module ID: 9960
|
|
// Function ID: 9961
|
|
// Name: instant_invite/InstantInviteUtils
|
|
// Dependencies: [7567, 1962, 1958, 9961, 2013, 4622, 4678, 1372, 8879, 7850, 9965, 1074, 1241, 7852, 9966, 9967, 4623, 4605, 8491, 4335, 7873, 7299, 4771, 38, 9963, 2]
|
|
// Exports: getShareMessage, handleCopy, handleOpenInviteActionsheet, handleOpenShareSheet, handlePressSettings, hasDeferredInvite, isAppInstalled, showInstantInviteActionSheetForChannel, showVanityUrlInviteActionSheet
|
|
|
|
// Module 9960 (instant_invite/InstantInviteUtils)
|
|
import _modDef38 from "module_38" /* 38 */;
|
|
import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1241 */;
|
|
import ToastUtils from "ToastUtils" /* 4335 */;
|
|
import ActionSheetActionCreatorsDefault from "ActionSheetActionCreators" /* 4605 */;
|
|
import InviteCodeUtils from "InviteCodeUtils" /* 4623 */;
|
|
import DCDSendUtils from "DCDSendUtils" /* 4771 */;
|
|
import ClipboardUtils from "ClipboardUtils" /* 7299 */;
|
|
import StreamerApplicationSelectors from "StreamerApplicationSelectors" /* 7852 */;
|
|
import getInviteURLDefault from "getInviteURL" /* 7873 */;
|
|
import utils_InstantInviteUtils from "utils/InstantInviteUtils" /* 9963 */;
|
|
import CreateInviteModalActionCreatorsDefault from "CreateInviteModalActionCreators" /* 9966 */;
|
|
import openInstantInviteActionSheetDefault from "openInstantInviteActionSheet" /* 9967 */;
|
|
import GuildTemplateStore from "GuildTemplateStore" /* 7567 */;
|
|
import ChannelStore from "ChannelStore" /* 1958 */;
|
|
import CreateInviteModalStore from "CreateInviteModalStore" /* 9961 */;
|
|
import GuildChannelStore from "GuildChannelStore" /* 2013 */;
|
|
import InviteStore from "InviteStore" /* 4622 */;
|
|
import PresenceStore from "PresenceStore" /* 4678 */;
|
|
import UserStore from "UserStore" /* 1372 */;
|
|
import DisplayedInviteStore from "DisplayedInviteStore" /* 8879 */;
|
|
|
|
require = fn;
|
|
function showInstantInviteActionSheet(channel, source) {
|
|
source = undefined;
|
|
if (source != null) {
|
|
source = source.source;
|
|
}
|
|
AnalyticsUtilsDefault.track(constants.OPEN_POPOUT, { type: "Instant Invite", source });
|
|
let stream1;
|
|
if (source != null) {
|
|
stream1 = source.stream;
|
|
}
|
|
const obj2 = { isActionSheet: true, location: "IOS Instant Invite Action Sheet Mount" };
|
|
if (null != stream1) {
|
|
const stream = source.stream;
|
|
obj2.targetType = InviteTargetTypes.STREAM;
|
|
obj2.targetUserId = stream.ownerId;
|
|
const streamerApplication = StreamerApplicationSelectors.getStreamerApplication(stream, PresenceStore);
|
|
const obj4 = { type: "Send Stream Invite", location: obj2.location, other_user_id: stream.ownerId, application_id: null, application_name: null, game_id: null };
|
|
let id;
|
|
if (streamerApplication != null) {
|
|
id = streamerApplication.id;
|
|
}
|
|
obj4.application_id = id;
|
|
let name;
|
|
if (streamerApplication != null) {
|
|
name = streamerApplication.name;
|
|
}
|
|
obj4.application_name = name;
|
|
let id1;
|
|
if (streamerApplication != null) {
|
|
id1 = streamerApplication.id;
|
|
}
|
|
obj4.game_id = id1;
|
|
tmp(1241).track(tmp3.OPEN_MODAL, obj4);
|
|
const tmpResult = tmp(1241);
|
|
} else {
|
|
let targetApplicationId;
|
|
if (source != null) {
|
|
targetApplicationId = source.targetApplicationId;
|
|
}
|
|
if (null != targetApplicationId) {
|
|
obj2.targetType = InviteTargetTypes.EMBEDDED_APPLICATION;
|
|
obj2.targetApplicationId = source.targetApplicationId;
|
|
}
|
|
}
|
|
let createInvite;
|
|
if (source != null) {
|
|
createInvite = source.createInvite;
|
|
}
|
|
let tmp17 = false !== createInvite;
|
|
if (tmp17) {
|
|
let code;
|
|
if (source != null) {
|
|
code = source.code;
|
|
}
|
|
tmp17 = null == code;
|
|
}
|
|
if (tmp17) {
|
|
tmp(9966).init(channel.getGuildId(), channel.id, obj2);
|
|
const tmpResult3 = tmp(9966);
|
|
}
|
|
const obj5 = { channel, source: null, guildScheduledEventId: null, targetApplicationId: null, code: null, vanityURLCode: null, stackingBehavior: null };
|
|
let source1;
|
|
tmp3 = constants;
|
|
if (source != null) {
|
|
source1 = source.source;
|
|
}
|
|
obj5.source = source1;
|
|
let prop;
|
|
if (source != null) {
|
|
prop = source.guildScheduledEventId;
|
|
}
|
|
obj5.guildScheduledEventId = prop;
|
|
let targetApplicationId1;
|
|
if (source != null) {
|
|
targetApplicationId1 = source.targetApplicationId;
|
|
}
|
|
obj5.targetApplicationId = targetApplicationId1;
|
|
let code1;
|
|
if (source != null) {
|
|
code1 = source.code;
|
|
}
|
|
obj5.code = code1;
|
|
let stackingBehavior;
|
|
if (source != null) {
|
|
stackingBehavior = source.stackingBehavior;
|
|
}
|
|
obj5.stackingBehavior = stackingBehavior;
|
|
openInstantInviteActionSheetDefault(obj5);
|
|
}
|
|
function trackOptionClicked(code, channel, COPY, _location) {
|
|
const invite = InviteStore.getInvite(InviteCodeUtils.parseExtraDataFromInviteKey(code).baseCode);
|
|
const obj3 = { invite_type: COPY, guild_id: null, channel_id: null, invite_code: null, invite_channel_type: null, invite_inviter_id: null, location: null, application_id: null };
|
|
if (channel instanceof ChannelRecordBase) {
|
|
let guild_id = channel.guild_id;
|
|
} else {
|
|
let id;
|
|
if (channel != null) {
|
|
id = channel.id;
|
|
}
|
|
channel = ChannelStore.getChannel(id);
|
|
if (channel != null) {
|
|
guild_id = channel.getGuildId();
|
|
}
|
|
}
|
|
obj3.guild_id = guild_id;
|
|
let id1;
|
|
if (channel != null) {
|
|
id1 = channel.id;
|
|
}
|
|
obj3.channel_id = id1;
|
|
const obj2 = AnalyticsUtilsDefault;
|
|
obj3.invite_code = InviteCodeUtils.parseInviteCodeFromInviteKey(code);
|
|
let type;
|
|
if (channel != null) {
|
|
type = channel.type;
|
|
}
|
|
obj3.invite_channel_type = type;
|
|
const currentUser = UserStore.getCurrentUser();
|
|
let id2;
|
|
if (currentUser != null) {
|
|
id2 = currentUser.id;
|
|
}
|
|
obj3.invite_inviter_id = id2;
|
|
obj3.location = _location;
|
|
let id3;
|
|
if (invite != null) {
|
|
const target_application = invite.target_application;
|
|
if (target_application != null) {
|
|
id3 = target_application.id;
|
|
}
|
|
}
|
|
obj3.application_id = id3;
|
|
obj2.track(constants.INSTANT_INVITE_OPTION_CLICKED, obj3);
|
|
}
|
|
const ChannelRecordBase = fn(1962).ChannelRecordBase;
|
|
const InviteTargetTypes = fn(7850).InviteTargetTypes;
|
|
const IOS_COPY_TO_PASTEBOARD = fn(9965).IOS_COPY_TO_PASTEBOARD;
|
|
const Constants = fn(1074);
|
|
({ AnalyticEvents: closure_14, InviteOptionsType: closure_15, Permissions: closure_16 } = Constants);
|
|
const size = fn(2);
|
|
let result = size.fileFinishedImporting("modules/instant_invite/native/InstantInviteUtils.tsx");
|
|
|
|
export const showInstantInviteActionSheetForChannel = function showInstantInviteActionSheetForChannel(channelId) {
|
|
const channel = ChannelStore.getChannel(channelId);
|
|
if (null != channel) {
|
|
showInstantInviteActionSheet(channel);
|
|
}
|
|
};
|
|
export { showInstantInviteActionSheet };
|
|
export const showVanityUrlInviteActionSheet = function showVanityUrlInviteActionSheet(guild, channel, GUILD_SCHEDULED_EVENT, guildScheduledEventId) {
|
|
AnalyticsUtilsDefault.track(constants.OPEN_POPOUT, { type: "Vanity URL Invite", source: GUILD_SCHEDULED_EVENT });
|
|
const obj2 = { type: "Vanity URL Invite", source: GUILD_SCHEDULED_EVENT };
|
|
CreateInviteModalActionCreatorsDefault.init(guild.id, channel.id, { skipCreateInvite: true });
|
|
const obj4 = { vanityURLCode: guild.vanityURLCode, channel, source: GUILD_SCHEDULED_EVENT, guildScheduledEventId: null, stackingBehavior: null };
|
|
let prop;
|
|
if (guildScheduledEventId != null) {
|
|
prop = guildScheduledEventId.guildScheduledEventId;
|
|
}
|
|
obj4.guildScheduledEventId = prop;
|
|
let stackingBehavior;
|
|
if (guildScheduledEventId != null) {
|
|
stackingBehavior = guildScheduledEventId.stackingBehavior;
|
|
}
|
|
obj4.stackingBehavior = stackingBehavior;
|
|
openInstantInviteActionSheetDefault(obj4);
|
|
};
|
|
export { trackOptionClicked };
|
|
export function getShareMessage(arg0) {
|
|
return arg0;
|
|
}
|
|
export const handleOpenShareSheet = function handleOpenShareSheet(code, channel, intl, ADD_FRIENDS_WIDGET) {
|
|
let flag = arg4;
|
|
if (arg4 === undefined) {
|
|
flag = true;
|
|
}
|
|
if (null != code) {
|
|
const result = InviteCodeUtils.parseExtraDataFromInviteKey(code);
|
|
const invite = InviteStore.getInvite(result.baseCode);
|
|
const tmp21 = require;
|
|
const tmp26 = importDefault;
|
|
if (channel instanceof ChannelRecordBase) {
|
|
let guild_id = channel.guild_id;
|
|
} else {
|
|
let id;
|
|
if (channel != null) {
|
|
id = channel.id;
|
|
}
|
|
channel = ChannelStore.getChannel(id);
|
|
if (channel != null) {
|
|
guild_id = channel.getGuildId();
|
|
}
|
|
}
|
|
let obj = { guild_id, channel_id: null, invite_code: null, invite_channel_type: null, invite_inviter_id: null, invite_guild_scheduled_event_id: null, location: null, application_id: null };
|
|
let id1;
|
|
if (channel != null) {
|
|
id1 = channel.id;
|
|
}
|
|
obj.channel_id = id1;
|
|
obj.invite_code = result.baseCode;
|
|
let type;
|
|
if (channel != null) {
|
|
type = channel.type;
|
|
}
|
|
obj.invite_channel_type = type;
|
|
const currentUser = UserStore.getCurrentUser();
|
|
let id2;
|
|
if (currentUser != null) {
|
|
id2 = currentUser.id;
|
|
}
|
|
obj.invite_inviter_id = id2;
|
|
obj.invite_guild_scheduled_event_id = result.guildScheduledEventId;
|
|
obj.location = ADD_FRIENDS_WIDGET;
|
|
let id3;
|
|
if (invite != null) {
|
|
const target_application = invite.target_application;
|
|
if (target_application != null) {
|
|
id3 = target_application.id;
|
|
}
|
|
}
|
|
obj.application_id = id3;
|
|
AnalyticsUtilsDefault.track(constants.INSTANT_INVITE_SHARED, obj);
|
|
if (flag) {
|
|
trackOptionClicked(code, channel, constants2.SHARE, ADD_FRIENDS_WIDGET);
|
|
}
|
|
tmp26(4605).hideAllActionSheets();
|
|
const tmp26Result = tmp26(4605);
|
|
const obj2 = {
|
|
message: intl,
|
|
iOSOnlyShareCallback(arg0, arr) {
|
|
let tmp = arg0;
|
|
if (arg0) {
|
|
tmp = null != arr;
|
|
}
|
|
if (tmp) {
|
|
tmp = !arr.includes(IOS_COPY_TO_PASTEBOARD);
|
|
}
|
|
if (tmp) {
|
|
ToastUtils.presentInviteSent();
|
|
}
|
|
}
|
|
};
|
|
tmp21(8491).showShareActionSheet(obj2, ADD_FRIENDS_WIDGET);
|
|
const tmp21Result = tmp21(8491);
|
|
}
|
|
};
|
|
export const handleCopy = function handleCopy(code, channel, GROUP_DM, arg3) {
|
|
let flag = arg3;
|
|
if (arg3 === undefined) {
|
|
flag = true;
|
|
}
|
|
if (null != code) {
|
|
const result = InviteCodeUtils.parseExtraDataFromInviteKey(code);
|
|
const tmp13 = require;
|
|
const tmp17 = getInviteURLDefault(code);
|
|
ClipboardUtils.copy(tmp17);
|
|
const invite = InviteStore.getInvite(result.baseCode);
|
|
if (channel instanceof ChannelRecordBase) {
|
|
let guild_id = channel.guild_id;
|
|
} else {
|
|
let id;
|
|
if (channel != null) {
|
|
id = channel.id;
|
|
}
|
|
channel = ChannelStore.getChannel(id);
|
|
if (channel != null) {
|
|
guild_id = channel.getGuildId();
|
|
}
|
|
}
|
|
const obj = { server: guild_id, channel: null, channel_type: null, location: null, code: null, guild_scheduled_event_id: null, application_id: null };
|
|
let id1;
|
|
if (channel != null) {
|
|
id1 = channel.id;
|
|
}
|
|
obj.channel = id1;
|
|
let type;
|
|
if (channel != null) {
|
|
type = channel.type;
|
|
}
|
|
obj.channel_type = type;
|
|
obj.location = GROUP_DM;
|
|
({ baseCode: obj2.code, guildScheduledEventId: obj2.guild_scheduled_event_id } = result);
|
|
let id2;
|
|
if (invite != null) {
|
|
const target_application = invite.target_application;
|
|
if (target_application != null) {
|
|
id2 = target_application.id;
|
|
}
|
|
}
|
|
obj.application_id = id2;
|
|
AnalyticsUtilsDefault.track(constants.COPY_INSTANT_INVITE, obj);
|
|
if (flag) {
|
|
trackOptionClicked(code, channel, constants2.COPY);
|
|
}
|
|
tmp13(4335).presentLinkCopied();
|
|
const tmp13Result = tmp13(4335);
|
|
}
|
|
};
|
|
export const handlePressSettings = function handlePressSettings(channel, arg1, arg2) {
|
|
closure_0 = channel;
|
|
importDefault = arg1;
|
|
let str = arg2;
|
|
ActionSheetActionCreatorsDefault.hideActionSheet();
|
|
dependencyMap = CreateInviteModalStore.getPendingSettings();
|
|
({ guild_id, id } = channel);
|
|
if (arg2 == null) {
|
|
str = "Instant Invite Action Sheet";
|
|
}
|
|
CreateInviteModalActionCreatorsDefault.openSettings(guild_id, id, str, () => {
|
|
if (null != closure_1) {
|
|
tmp();
|
|
} else {
|
|
targetApplicationId = undefined;
|
|
if (targetApplicationId != null) {
|
|
targetApplicationId = targetApplicationId.targetApplicationId;
|
|
}
|
|
const obj = { createInvite: false, targetApplicationId };
|
|
showInstantInviteActionSheet(closure_0, obj);
|
|
}
|
|
});
|
|
};
|
|
export const isAppInstalled = function isAppInstalled(roblox) {
|
|
return DCDSendUtils.canOpenUrlScheme(roblox);
|
|
};
|
|
export const handleOpenInviteActionsheet = function handleOpenInviteActionsheet(guild, id, channels, GUILD_HEADER) {
|
|
let channel = ChannelStore.getChannel(id);
|
|
if (channel == null) {
|
|
channel = GuildChannelStore.getDefaultChannel(guild.id, true, constants3.CREATE_INSTANT_INVITE);
|
|
}
|
|
_modDef38(null != channel, "Channel cannot be null");
|
|
if (null != guild.vanityURLCode) {
|
|
if ("" !== guild.vanityURLCode) {
|
|
const obj3 = { type: "Vanity URL Invite", source: GUILD_HEADER };
|
|
tmp4(1241).track(constants.OPEN_POPOUT, obj3);
|
|
const tmp4Result = tmp4(1241);
|
|
tmp4(9966).init(guild.id, channel.id, { skipCreateInvite: true });
|
|
const obj4 = { vanityURLCode: guild.vanityURLCode, channel, source: GUILD_HEADER, guildScheduledEventId: undefined, stackingBehavior: undefined };
|
|
tmp4(9967)(obj4);
|
|
const tmp4Result2 = tmp4(9966);
|
|
}
|
|
}
|
|
const inviteChannelId = utils_InstantInviteUtils.getInviteChannelId(channel.id, channels);
|
|
if (null != inviteChannelId) {
|
|
let channel1 = ChannelStore.getChannel(inviteChannelId);
|
|
if (channel1 == null) {
|
|
channel1 = GuildChannelStore.getDefaultChannel(guild.id, true, constants3.CREATE_INSTANT_INVITE);
|
|
}
|
|
tmp4(38)(null != channel1, "Channel cannot be null");
|
|
const obj5 = { source: GUILD_HEADER };
|
|
showInstantInviteActionSheet(channel1, obj5);
|
|
}
|
|
};
|
|
export const hasDeferredInvite = function hasDeferredInvite() {
|
|
const displayedInviteCode = DisplayedInviteStore.getDisplayedInviteCode();
|
|
const displayedGuildTemplateCode = GuildTemplateStore.getDisplayedGuildTemplateCode();
|
|
let invite = null;
|
|
if (null != displayedInviteCode) {
|
|
invite = InviteStore.getInvite(displayedInviteCode);
|
|
}
|
|
let guildTemplate = null;
|
|
if (null != displayedGuildTemplateCode) {
|
|
guildTemplate = GuildTemplateStore.getGuildTemplate(displayedGuildTemplateCode);
|
|
}
|
|
return null != invite || null != guildTemplate;
|
|
};
|