295 lines
17 KiB
TypeScript
295 lines
17 KiB
TypeScript
/* Metro module 9151; source: modules/instant_invite/native/InstantInviteUtils.tsx; dependencies: [7069, 1383, 1379, 9152, 1935, 4097, 4396, 1878, 9156, 4118, 9157, 661, 683, 7128, 9158, 9159, 4098, 4080, 9212, 3856, 7147, 6797, 4486, 44, 9154, 2] */
|
|
function _fun71680(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#71680, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9336:6, offset: 0x01d2989c, size: 491 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const guildTemplateStore = importDefault(7069) /* metro dependency 7069: GuildTemplateStore */;
|
|
const env0_4 = (require(1383) /* metro dependency 1383: ChannelRecord */).ChannelRecordBase;
|
|
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
|
|
const createInviteModalStore = importDefault(9152) /* metro dependency 9152: CreateInviteModalStore */;
|
|
const guildChannelStore = importDefault(1935) /* metro dependency 1935: GuildChannelStore */;
|
|
const inviteStore = importDefault(4097) /* metro dependency 4097: InviteStore */;
|
|
const presenceStore = importDefault(4396) /* metro dependency 4396: PresenceStore */;
|
|
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
|
|
const displayedInviteStore = importDefault(9156) /* metro dependency 9156: DisplayedInviteStore */;
|
|
const env0_12 = (require(4118) /* metro dependency 4118: Constants */).InviteTargetTypes;
|
|
const env0_13 = (require(9157) /* metro dependency 9157: InstantInviteConstants */).IOS_COPY_TO_PASTEBOARD;
|
|
const constantsModule = require(661) /* metro dependency 661: Constants */;
|
|
const env0_14 = constantsModule.AnalyticEvents;
|
|
const env0_15 = constantsModule.InviteOptionsType;
|
|
const env0_16 = constantsModule.Permissions;
|
|
const closure = showInstantInviteActionSheet;
|
|
const closure2 = showVanityUrlInviteActionSheet;
|
|
const closure3 = trackOptionClicked;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/instant_invite/native/InstantInviteUtils.tsx');
|
|
exports.showInstantInviteActionSheetForChannel = function(a0) {
|
|
var value2 = ChannelStore.getChannel(a0);
|
|
if (value2 != null) {
|
|
showInstantInviteActionSheet(value2);
|
|
}
|
|
};
|
|
exports.showInstantInviteActionSheet = closure;
|
|
exports.showVanityUrlInviteActionSheet = closure2;
|
|
exports.trackOptionClicked = closure3;
|
|
exports.getShareMessage = function(a0) {
|
|
return a0;
|
|
};
|
|
exports.handleOpenShareSheet = handleOpenShareSheet;
|
|
exports.handleCopy = handleCopy;
|
|
exports.handlePressSettings = handlePressSettings;
|
|
exports.isAppInstalled = isAppInstalled;
|
|
exports.handleOpenInviteActionsheet = handleOpenInviteActionsheet;
|
|
exports.hasDeferredInvite = hasDeferredInvite;
|
|
}
|
|
|
|
function getAnalyticsGuildId(a0) { // fn#71681, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9336:1386, offset: 0x01d29a87, size: 75 bytes, params: 2, frame: 15
|
|
return a0 instanceof ChannelRecordBase ? a0.guild_id : ChannelStore.getChannel(a0?.id)?.getGuildId();
|
|
}
|
|
|
|
function showInstantInviteActionSheet(a0, a1) { // fn#71682, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9336:367, offset: 0x01d29ad2, size: 592 bytes, params: 3, frame: 23
|
|
var id;
|
|
var ownerId;
|
|
var streamerApplication;
|
|
var defaultImport2;
|
|
var OPEN_MODAL;
|
|
var object2;
|
|
var defaultImport3;
|
|
const object4 = {'isActionSheet': true, 'location': 'IOS Instant Invite Action Sheet Mount'};
|
|
const value2 = undefined;
|
|
const defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
let track = defaultImport.track;
|
|
const OPEN_POPOUT = AnalyticEvents.OPEN_POPOUT;
|
|
Reflect.apply(track, defaultImport, [OPEN_POPOUT, {type: 'Instant Invite',
|
|
source: a1 == null ? value2 : a1.source}]);
|
|
let stream = a1 == null ? value2 : a1.stream;
|
|
if (stream != null) {
|
|
stream = a1.stream;
|
|
object4.targetType = InviteTargetTypes.STREAM;
|
|
ownerId = stream.ownerId;
|
|
object4.targetUserId = ownerId;
|
|
streamerApplication = (require(7128) /* metro dependency 7128: StreamerApplicationSelectors */).getStreamerApplication(stream,
|
|
|
|
PresenceStore);
|
|
defaultImport2 = defaultImport;
|
|
track = defaultImport2.track;
|
|
OPEN_MODAL = AnalyticEvents.OPEN_MODAL;
|
|
object2 = {type: 'Send Stream Invite'};
|
|
object2.location = object4.location;
|
|
ownerId = stream.ownerId;
|
|
object2.other_user_id = ownerId;
|
|
id = streamerApplication == null ? value2 : streamerApplication.id;
|
|
object2.application_id = id;
|
|
object2.application_name = streamerApplication == null ? value2 : streamerApplication.name;
|
|
id = streamerApplication == null ? value2 : streamerApplication.id;
|
|
object2.game_id = id;
|
|
Reflect.apply(track, defaultImport2, [OPEN_MODAL, object2]);
|
|
} else if ((a1 == null ? value2 : a1.targetApplicationId) != null) {
|
|
object4.targetType = InviteTargetTypes.EMBEDDED_APPLICATION;
|
|
object4.targetApplicationId = a1.targetApplicationId;
|
|
}
|
|
if ((a1 == null ? value2 : a1.createInvite) !== false && (a1 == null ? value2 : a1.code) == null) {
|
|
defaultImport3 = importDefault(9158) /* metro dependency 9158: CreateInviteModalActionCreators */;
|
|
defaultImport3.init(a0.getGuildId(), a0.id, object4);
|
|
}
|
|
(importDefault(9159) /* metro dependency 9159: openInstantInviteActionSheet */)({channel: a0,
|
|
source: a1 == null ? value2 : a1.source, guildScheduledEventId: a1 == null ? value2 : a1.guildScheduledEventId,
|
|
targetApplicationId: a1 == null ? value2 : a1.targetApplicationId, code: a1 == null ? value2 : a1.code,
|
|
vanityURLCode: null, stackingBehavior: a1 == null ? value2 : a1.stackingBehavior});
|
|
return value2;
|
|
}
|
|
|
|
function showVanityUrlInviteActionSheet({id, vanityURLCode}, a1, a2, a3) { // fn#71683, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9336:1558, offset: 0x01d29d22, size: 200 bytes, params: 5, frame: 23
|
|
const defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
const track = defaultImport.track;
|
|
const OPEN_POPOUT = AnalyticEvents.OPEN_POPOUT;
|
|
Reflect.apply(track, defaultImport, [OPEN_POPOUT, {type: 'Vanity URL Invite', source: a2}]);
|
|
const createInviteModalActionCreators = importDefault(9158) /* metro dependency 9158: CreateInviteModalActionCreators */;
|
|
createInviteModalActionCreators.init(id, a1.id, {skipCreateInvite: true});
|
|
(importDefault(9159) /* metro dependency 9159: openInstantInviteActionSheet */)({vanityURLCode: vanityURLCode,
|
|
channel: a1, source: a2, guildScheduledEventId: a3?.guildScheduledEventId,
|
|
stackingBehavior: a3?.stackingBehavior});
|
|
}
|
|
|
|
function trackOptionClicked(a0, a1, a2, a3) { // fn#71684, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9336:1876, offset: 0x01d29dea, size: 270 bytes, params: 5, frame: 22
|
|
const value2 = undefined;
|
|
const invite = InviteStore.getInvite((require(4098) /* metro dependency 4098: InviteCodeUtils */).parseExtraDataFromInviteKey(a0).baseCode);
|
|
const defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
const track = defaultImport.track;
|
|
const INSTANT_INVITE_OPTION_CLICKED = AnalyticEvents.INSTANT_INVITE_OPTION_CLICKED;
|
|
const object2 = {invite_type: a2};
|
|
object2.guild_id = getAnalyticsGuildId(a1);
|
|
object2.channel_id = a1 == null ? value2 : a1.id;
|
|
object2.invite_code = (require(4098) /* metro dependency 4098: InviteCodeUtils */).parseInviteCodeFromInviteKey(a0);
|
|
object2.invite_channel_type = a1 == null ? value2 : a1.type;
|
|
const currentUser = UserStore.getCurrentUser();
|
|
object2.invite_inviter_id = currentUser == null ? value2 : currentUser.id;
|
|
object2.location = a3;
|
|
object2.application_id = invite == null || invite.target_application == null ? value2 : invite.target_application.id;
|
|
Reflect.apply(track, defaultImport, [INSTANT_INVITE_OPTION_CLICKED, object2]);
|
|
return value2;
|
|
}
|
|
|
|
function handleOpenShareSheet(a0, a1, a2, a3) { // fn#71687, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9336:2777, offset: 0x01d29f21, size: 378 bytes, params: 5, frame: 27
|
|
var id;
|
|
var extraDataFromInviteKey;
|
|
var getInvite;
|
|
var baseCode;
|
|
var value3;
|
|
var defaultImport;
|
|
var track;
|
|
var INSTANT_INVITE_SHARED;
|
|
var object2;
|
|
var currentUser;
|
|
const value = a4;
|
|
const value2 = undefined;
|
|
if (a0 != null) {
|
|
extraDataFromInviteKey = (require(4098) /* metro dependency 4098: InviteCodeUtils */).parseExtraDataFromInviteKey(a0);
|
|
getInvite = InviteStore.getInvite;
|
|
baseCode = extraDataFromInviteKey.baseCode;
|
|
value3 = Reflect.apply(getInvite, InviteStore, [baseCode]);
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
track = defaultImport.track;
|
|
INSTANT_INVITE_SHARED = AnalyticEvents.INSTANT_INVITE_SHARED;
|
|
object2 = {};
|
|
object2.guild_id = getAnalyticsGuildId(a1);
|
|
id = a1 == null ? value2 : a1.id;
|
|
object2.channel_id = id;
|
|
baseCode = extraDataFromInviteKey.baseCode;
|
|
object2.invite_code = baseCode;
|
|
object2.invite_channel_type = a1 == null ? value2 : a1.type;
|
|
currentUser = UserStore.getCurrentUser();
|
|
id = currentUser == null ? value2 : currentUser.id;
|
|
object2.invite_inviter_id = id;
|
|
object2.invite_guild_scheduled_event_id = extraDataFromInviteKey.guildScheduledEventId;
|
|
object2.location = a3;
|
|
id = value3 == null || value3.target_application == null ? value2 : value3.target_application.id;
|
|
object2.application_id = id;
|
|
Reflect.apply(track, defaultImport, [INSTANT_INVITE_SHARED, object2]);
|
|
if (!(value !== value2) || value) {
|
|
trackOptionClicked(a0, a1, InviteOptionsType.SHARE, a3);
|
|
}
|
|
(importDefault(4080) /* metro dependency 4080: ActionSheetActionCreators */).hideAllActionSheets();
|
|
(require(9212) /* metro dependency 9212: showShareActionSheetAndroid */).showShareActionSheet({message: a2}, a3,
|
|
_fun71688);
|
|
}
|
|
return value2;
|
|
}
|
|
|
|
function handleCopy(a0, a1, a2) { // fn#71689, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9336:3428, offset: 0x01d2a0d6, size: 329 bytes, params: 4, frame: 24
|
|
var id;
|
|
var extraDataFromInviteKey;
|
|
var getInvite;
|
|
var baseCode;
|
|
var value4;
|
|
var defaultImport;
|
|
var track;
|
|
var COPY_INSTANT_INVITE;
|
|
var object2;
|
|
const value = a3;
|
|
const value2 = undefined;
|
|
if (a0 != null) {
|
|
extraDataFromInviteKey = (require(4098) /* metro dependency 4098: InviteCodeUtils */).parseExtraDataFromInviteKey(a0);
|
|
(require(6797) /* metro dependency 6797: ClipboardUtilsNative */).copy((importDefault(7147) /* metro dependency 7147: getInviteURL */)(a0));
|
|
getInvite = InviteStore.getInvite;
|
|
baseCode = extraDataFromInviteKey.baseCode;
|
|
value4 = Reflect.apply(getInvite, InviteStore, [baseCode]);
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
track = defaultImport.track;
|
|
COPY_INSTANT_INVITE = AnalyticEvents.COPY_INSTANT_INVITE;
|
|
object2 = {};
|
|
object2.server = getAnalyticsGuildId(a1);
|
|
id = a1 == null ? value2 : a1.id;
|
|
object2.channel = id;
|
|
object2.channel_type = a1 == null ? value2 : a1.type;
|
|
object2.location = a2;
|
|
baseCode = extraDataFromInviteKey.baseCode;
|
|
object2.code = baseCode;
|
|
object2.guild_scheduled_event_id = extraDataFromInviteKey.guildScheduledEventId;
|
|
id = value4 == null || value4.target_application == null ? value2 : value4.target_application.id;
|
|
object2.application_id = id;
|
|
Reflect.apply(track, defaultImport, [COPY_INSTANT_INVITE, object2]);
|
|
if (!(value !== value2) || value) {
|
|
trackOptionClicked(a0, a1, InviteOptionsType.COPY);
|
|
}
|
|
(require(3856) /* metro dependency 3856: ToastUtils */).presentLinkCopied();
|
|
}
|
|
return value2;
|
|
}
|
|
|
|
function handlePressSettings(a0, a1, a2) { // fn#71690, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9336:3931, offset: 0x01d2a21f, size: 143 bytes, params: 4, frame: 20
|
|
const value = a2;
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
(importDefault(4080) /* metro dependency 4080: ActionSheetActionCreators */).hideActionSheet();
|
|
const env0_2 = CreateInviteModalStore.getPendingSettings();
|
|
const defaultImport2 = importDefault(9158) /* metro dependency 9158: CreateInviteModalActionCreators */;
|
|
defaultImport2.openSettings(a0.guild_id, a0.id, value ?? 'Instant Invite Action Sheet', _fun71691);
|
|
}
|
|
|
|
function isAppInstalled(a0) { // fn#71692, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9336:4246, offset: 0x01d2a30f, size: 41 bytes, params: 2, frame: 11
|
|
return (require(4486) /* metro dependency 4486: DCDSendUtils */).canOpenUrlScheme(a0);
|
|
}
|
|
|
|
function handleOpenInviteActionsheet(a0, a1, a2, a3) { // fn#71693, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9336:4340, offset: 0x01d2a338, size: 285 bytes, params: 5, frame: 24
|
|
var r7;
|
|
var moduleValue;
|
|
var value4;
|
|
const r2 = ChannelStore.getChannel(a1) ?? GuildChannelStore.getDefaultChannel(a0.id, true,
|
|
Permissions.CREATE_INSTANT_INVITE);
|
|
(importDefault(44) /* metro dependency 44 */)(r2 != null, 'Channel cannot be null');
|
|
if (a0.vanityURLCode == null) {
|
|
moduleValue = require(9154) /* metro dependency 9154: InstantInviteUtils */;
|
|
value4 = moduleValue.getInviteChannelId(r2.id, a2);
|
|
if (value4 != null) {
|
|
r7 = ChannelStore.getChannel(value4) ?? GuildChannelStore.getDefaultChannel(a0.id, true,
|
|
Permissions.CREATE_INSTANT_INVITE);
|
|
(importDefault(44) /* metro dependency 44 */)(r7 != null, 'Channel cannot be null');
|
|
showInstantInviteActionSheet(r7, {source: a3});
|
|
}
|
|
} else if (a0.vanityURLCode !== '') {
|
|
showVanityUrlInviteActionSheet(a0, r2, a3);
|
|
} else {
|
|
moduleValue = require(9154) /* metro dependency 9154: InstantInviteUtils */;
|
|
value4 = moduleValue.getInviteChannelId(r2.id, a2);
|
|
if (value4 != null) {
|
|
r7 = ChannelStore.getChannel(value4) ?? GuildChannelStore.getDefaultChannel(a0.id, true,
|
|
Permissions.CREATE_INSTANT_INVITE);
|
|
(importDefault(44) /* metro dependency 44 */)(r7 != null, 'Channel cannot be null');
|
|
showInstantInviteActionSheet(r7, {source: a3});
|
|
}
|
|
}
|
|
}
|
|
|
|
function hasDeferredInvite() { // fn#71694, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9336:4826, offset: 0x01d2a455, size: 94 bytes, params: 1, frame: 15
|
|
const displayedInviteCode = DisplayedInviteStore.getDisplayedInviteCode();
|
|
const displayedGuildTemplateCode = GuildTemplateStore.getDisplayedGuildTemplateCode();
|
|
const value4 = null;
|
|
return value4 != (value4 != displayedInviteCode ? InviteStore.getInvite(displayedInviteCode) : value4) || value4 != (value4 != displayedGuildTemplateCode ? GuildTemplateStore.getGuildTemplate(displayedGuildTemplateCode) : value4);
|
|
}
|
|
|
|
function _fun71688(a0) { // fn#71688, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9336:3362, offset: 0x01d2a09b, size: 59 bytes, params: 2, frame: 12
|
|
const includes = a0.includes;
|
|
const value = environment.__proto__;
|
|
if (!Reflect.apply(includes, a0, [IOS_COPY_TO_PASTEBOARD])) {
|
|
(require(3856) /* metro dependency 3856: ToastUtils */).presentInviteSent();
|
|
}
|
|
}
|
|
|
|
function _fun71691() { // fn#71691, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9336:4076, offset: 0x01d2a2ae, size: 97 bytes, params: 1, frame: 17
|
|
var value2;
|
|
var showInstantInviteActionSheetBinding;
|
|
var binding;
|
|
var value3;
|
|
if (require != null) {
|
|
require();
|
|
} else {
|
|
value2 = environment.__proto__;
|
|
showInstantInviteActionSheetBinding = showInstantInviteActionSheet;
|
|
binding = env0_0;
|
|
value3 = undefined;
|
|
showInstantInviteActionSheetBinding(binding, {createInvite: false,
|
|
targetApplicationId: (env0_2 == null ? value3 : env0_2.targetApplicationId) ?? value3});
|
|
}
|
|
}
|
|
|