304 lines
18 KiB
TypeScript
304 lines
18 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] */
|
|
import AnalyticsUtils from '../../../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */
|
|
import ChannelStore from '../../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
|
|
import UserStore from '../../../stores/UserStore.tsx'; /* Metro dependency 1878 */
|
|
import GuildChannelStore from '../../../stores/GuildChannelStore.tsx'; /* Metro dependency 1935 */
|
|
import ActionSheetActionCreators from '../../action_sheet/native/ActionSheetActionCreators.tsx'; /* Metro dependency 4080 */
|
|
import InviteStore from '../../../stores/InviteStore.tsx'; /* Metro dependency 4097 */
|
|
import PresenceStore from '../../../stores/PresenceStore.tsx'; /* Metro dependency 4396 */
|
|
import GuildTemplateStore from '../../guild_templates/GuildTemplateStore.tsx'; /* Metro dependency 7069 */
|
|
import CreateInviteModalStore from '../../../stores/CreateInviteModalStore.tsx'; /* Metro dependency 9152 */
|
|
import DisplayedInviteStore from '../../../stores/native/DisplayedInviteStore.tsx'; /* Metro dependency 9156 */
|
|
import CreateInviteModalActionCreators from '../../../actions/CreateInviteModalActionCreators.tsx'; /* Metro dependency 9158 */
|
|
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as ChannelRecordModule from '../../../records/ChannelRecord.tsx'; /* Metro dependency 1383 */
|
|
import * as ConstantsModule2 from '../Constants.tsx'; /* Metro dependency 4118 */
|
|
import * as DCDSendUtilsModule from './DCDSendUtils.tsx'; /* Metro dependency 4486 */
|
|
import * as InstantInviteConstantsModule from './InstantInviteConstants.tsx'; /* Metro dependency 9157 */
|
|
|
|
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 showInstantInviteActionSheet2 = showInstantInviteActionSheet;
|
|
const showVanityUrlInviteActionSheet2 = showVanityUrlInviteActionSheet;
|
|
const trackOptionClicked2 = trackOptionClicked;
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/instant_invite/native/InstantInviteUtils.tsx');
|
|
exports.showInstantInviteActionSheetForChannel = function(a0) {
|
|
var value2 = ChannelStore.getChannel(a0);
|
|
if (value2 != null) {
|
|
showInstantInviteActionSheet(value2);
|
|
}
|
|
};
|
|
exports.showInstantInviteActionSheet = showInstantInviteActionSheet2;
|
|
exports.showVanityUrlInviteActionSheet = showVanityUrlInviteActionSheet2;
|
|
exports.trackOptionClicked = trackOptionClicked2;
|
|
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 moduleValue;
|
|
var value3;
|
|
var defaultImport2;
|
|
var OPEN_MODAL;
|
|
var object;
|
|
var defaultImport3;
|
|
const object3 = {'isActionSheet': true, 'location': 'IOS Instant Invite Action Sheet Mount'};
|
|
const value2 = undefined;
|
|
const defaultImport = 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;
|
|
object3.targetType = InviteTargetTypes.STREAM;
|
|
ownerId = stream.ownerId;
|
|
object3.targetUserId = ownerId;
|
|
moduleValue = require(7128) /* metro dependency 7128: StreamerApplicationSelectors */;
|
|
value3 = moduleValue.getStreamerApplication(stream, PresenceStore);
|
|
defaultImport2 = defaultImport;
|
|
track = defaultImport2.track;
|
|
OPEN_MODAL = AnalyticEvents.OPEN_MODAL;
|
|
object = {type: 'Send Stream Invite'};
|
|
object.location = object3.location;
|
|
ownerId = stream.ownerId;
|
|
object.other_user_id = ownerId;
|
|
id = value3 == null ? value2 : value3.id;
|
|
object.application_id = id;
|
|
object.application_name = value3 == null ? value2 : value3.name;
|
|
id = value3 == null ? value2 : value3.id;
|
|
object.game_id = id;
|
|
Reflect.apply(track, defaultImport2, [OPEN_MODAL, object]);
|
|
} else if ((a1 == null ? value2 : a1.targetApplicationId) != null) {
|
|
object3.targetType = InviteTargetTypes.EMBEDDED_APPLICATION;
|
|
object3.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, object3);
|
|
}
|
|
(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 = AnalyticsUtils;
|
|
const track = defaultImport.track;
|
|
const OPEN_POPOUT = AnalyticEvents.OPEN_POPOUT;
|
|
Reflect.apply(track, defaultImport, [OPEN_POPOUT, {type: 'Vanity URL Invite', source: a2}]);
|
|
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 = AnalyticsUtils;
|
|
const track = defaultImport.track;
|
|
const INSTANT_INVITE_OPTION_CLICKED = AnalyticEvents.INSTANT_INVITE_OPTION_CLICKED;
|
|
const object = {invite_type: a2};
|
|
object.guild_id = getAnalyticsGuildId(a1);
|
|
object.channel_id = a1 == null ? value2 : a1.id;
|
|
object.invite_code = (require(4098) /* metro dependency 4098: InviteCodeUtils */).parseInviteCodeFromInviteKey(a0);
|
|
object.invite_channel_type = a1 == null ? value2 : a1.type;
|
|
const currentUser = UserStore.getCurrentUser();
|
|
object.invite_inviter_id = currentUser == null ? value2 : currentUser.id;
|
|
object.location = a3;
|
|
object.application_id = invite == null || invite.target_application == null ? value2 : invite.target_application.id;
|
|
Reflect.apply(track, defaultImport, [INSTANT_INVITE_OPTION_CLICKED, object]);
|
|
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 inviteStoreBinding;
|
|
var getInvite;
|
|
var baseCode;
|
|
var value3;
|
|
var defaultImport;
|
|
var track;
|
|
var INSTANT_INVITE_SHARED;
|
|
var object;
|
|
var currentUser;
|
|
const value = a4;
|
|
const value2 = undefined;
|
|
if (a0 != null) {
|
|
extraDataFromInviteKey = (require(4098) /* metro dependency 4098: InviteCodeUtils */).parseExtraDataFromInviteKey(a0);
|
|
inviteStoreBinding = InviteStore;
|
|
getInvite = inviteStoreBinding.getInvite;
|
|
baseCode = extraDataFromInviteKey.baseCode;
|
|
value3 = Reflect.apply(getInvite, inviteStoreBinding, [baseCode]);
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
track = defaultImport.track;
|
|
INSTANT_INVITE_SHARED = AnalyticEvents.INSTANT_INVITE_SHARED;
|
|
object = {};
|
|
object.guild_id = getAnalyticsGuildId(a1);
|
|
id = a1 == null ? value2 : a1.id;
|
|
object.channel_id = id;
|
|
baseCode = extraDataFromInviteKey.baseCode;
|
|
object.invite_code = baseCode;
|
|
object.invite_channel_type = a1 == null ? value2 : a1.type;
|
|
currentUser = UserStore.getCurrentUser();
|
|
id = currentUser == null ? value2 : currentUser.id;
|
|
object.invite_inviter_id = id;
|
|
object.invite_guild_scheduled_event_id = extraDataFromInviteKey.guildScheduledEventId;
|
|
object.location = a3;
|
|
id = value3 == null || value3.target_application == null ? value2 : value3.target_application.id;
|
|
object.application_id = id;
|
|
Reflect.apply(track, defaultImport, [INSTANT_INVITE_SHARED, object]);
|
|
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 _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 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 inviteStoreBinding;
|
|
var getInvite;
|
|
var baseCode;
|
|
var value4;
|
|
var defaultImport;
|
|
var track;
|
|
var COPY_INSTANT_INVITE;
|
|
var object;
|
|
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));
|
|
inviteStoreBinding = InviteStore;
|
|
getInvite = inviteStoreBinding.getInvite;
|
|
baseCode = extraDataFromInviteKey.baseCode;
|
|
value4 = Reflect.apply(getInvite, inviteStoreBinding, [baseCode]);
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
track = defaultImport.track;
|
|
COPY_INSTANT_INVITE = AnalyticEvents.COPY_INSTANT_INVITE;
|
|
object = {};
|
|
object.server = getAnalyticsGuildId(a1);
|
|
id = a1 == null ? value2 : a1.id;
|
|
object.channel = id;
|
|
object.channel_type = a1 == null ? value2 : a1.type;
|
|
object.location = a2;
|
|
baseCode = extraDataFromInviteKey.baseCode;
|
|
object.code = baseCode;
|
|
object.guild_scheduled_event_id = extraDataFromInviteKey.guildScheduledEventId;
|
|
id = value4 == null || value4.target_application == null ? value2 : value4.target_application.id;
|
|
object.application_id = id;
|
|
Reflect.apply(track, defaultImport, [COPY_INSTANT_INVITE, object]);
|
|
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;
|
|
(ActionSheetActionCreators).hideActionSheet();
|
|
const env0_2 = CreateInviteModalStore.getPendingSettings();
|
|
const defaultImport2 = CreateInviteModalActionCreators;
|
|
defaultImport2.openSettings(a0.guild_id, a0.id, value ?? 'Instant Invite Action Sheet', _fun71691);
|
|
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});
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
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 (DCDSendUtilsModule).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);
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun71680, 9151, [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]) /* metro module 9151, 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] */;
|