458 lines
25 KiB
TypeScript
458 lines
25 KiB
TypeScript
/* Metro module 11598; source: modules/activities/utils/useActivityShelfItem.tsx; dependencies: [5, 1378, 4237, 661, 8049, 477, 10718, 11599, 11600, 1909, 7504, 10702, 10701, 6777, 3774, 6771, 8045, 8087, 4603, 9472, 8109, 2] */
|
|
import Module00005 from '../../../by-id/module-00005.js'; /* Metro dependency 5 */
|
|
import EmbeddedActivitiesStore from '../EmbeddedActivitiesStore.tsx'; /* Metro dependency 1378 */
|
|
import UseAnalyticsLocations from '../../app_analytics/useAnalyticsLocations.tsx'; /* Metro dependency 6771 */
|
|
import GetPlatform from './getPlatform.tsx'; /* Metro dependency 8049 */
|
|
import UseCurrentEmbeddedApplication from './useCurrentEmbeddedApplication.tsx'; /* Metro dependency 10701 */
|
|
import UseCurrentEmbeddedActivity from './useCurrentEmbeddedActivity.tsx'; /* Metro dependency 10702 */
|
|
import UseEmbeddedActivityBackground from './useEmbeddedActivityBackground.tsx'; /* Metro dependency 10718 */
|
|
import UseEmbeddedAppsForChannel from '../useEmbeddedAppsForChannel.tsx'; /* Metro dependency 11600 */
|
|
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as PlatformUtilsModule from '../../../utils/PlatformUtils.tsx'; /* Metro dependency 477 */
|
|
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as EmbeddedActivityLocationUtilsModule from './embeddedActivityLocationUtils.tsx'; /* Metro dependency 3774 */
|
|
import * as ConstantsModule2 from '../Constants.tsx'; /* Metro dependency 4237 */
|
|
import * as UseGetOrFetchApplicationsModule from '../../applications/useGetOrFetchApplications.tsx'; /* Metro dependency 6777 */
|
|
import * as ApplicationFlagUtilsModule from '../../applications/utils/ApplicationFlagUtils.tsx'; /* Metro dependency 7504 */
|
|
import * as CanLaunchFrameModule from '../../frames/utils/canLaunchFrame.tsx'; /* Metro dependency 8045 */
|
|
|
|
function _fun88811(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#88811, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11784:6, offset: 0x01ff307d, size: 285 bytes, params: 8, frame: 23
|
|
const env0_0 = require;
|
|
const getStaffReleasePhase2 = getStaffReleasePhase;
|
|
const useActivityAction2 = useActivityAction;
|
|
const useOnActivityItemSelected2 = useOnActivityItemSelected;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
object = {START: 0};
|
|
object[0] = 'START';
|
|
object.JOIN = 1;
|
|
object[1] = 'JOIN';
|
|
object.LEAVE = 2;
|
|
object[2] = 'LEAVE';
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/activities/utils/useActivityShelfItem.tsx');
|
|
exports.default = useActivityShelfItem;
|
|
exports.ActivityAction = object;
|
|
exports.getStaffReleasePhase = getStaffReleasePhase2;
|
|
exports.useActivityAction = useActivityAction2;
|
|
exports.useOnActivityItemSelected = useOnActivityItemSelected2;
|
|
function getStaffReleasePhase(a0, a1) { // fn#88812, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11784:266, offset: 0x01ff319a, size: 243 bytes, params: 3, frame: 16
|
|
var r0;
|
|
var client_platform_config;
|
|
var defaultImport;
|
|
var moduleValue3;
|
|
var release_phase;
|
|
var value;
|
|
const value2 = undefined;
|
|
let hasApplicationFlag = ApplicationFlagUtilsModule.hasApplicationFlag;
|
|
const EMBEDDED_RELEASED = ApplicationFlags.EMBEDDED_RELEASED;
|
|
if (Reflect.apply(hasApplicationFlag, ApplicationFlagUtilsModule, [a0, EMBEDDED_RELEASED])) {
|
|
client_platform_config = a1.client_platform_config;
|
|
defaultImport = importDefault(8049) /* metro dependency 8049: getPlatform */;
|
|
moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */;
|
|
release_phase = client_platform_config[defaultImport(moduleValue3.getOS())].release_phase;
|
|
if (STAFF_RELEASE_PHASES.includes(release_phase)) {
|
|
value = release_phase.replace('_', ' ');
|
|
value = value.replace(RegExp('(^\\w|\\s\\w)', 'g'), function(a0) {
|
|
return a0.toUpperCase();
|
|
});
|
|
r0 = value;
|
|
} else {
|
|
r0 = value2;
|
|
}
|
|
return r0;
|
|
}
|
|
hasApplicationFlag = ApplicationFlagUtilsModule.hasApplicationFlag;
|
|
const EMBEDDED_FIRST_PARTY = ApplicationFlags.EMBEDDED_FIRST_PARTY;
|
|
if (Reflect.apply(hasApplicationFlag, ApplicationFlagUtilsModule, [a0, EMBEDDED_FIRST_PARTY])) {
|
|
client_platform_config = a1.client_platform_config;
|
|
defaultImport = importDefault(8049) /* metro dependency 8049: getPlatform */;
|
|
moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */;
|
|
release_phase = client_platform_config[defaultImport(moduleValue3.getOS())].release_phase;
|
|
if (STAFF_RELEASE_PHASES.includes(release_phase)) {
|
|
value = release_phase.replace('_', ' ');
|
|
value = value.replace(RegExp('(^\\w|\\s\\w)', 'g'), function(a0) {
|
|
return a0.toUpperCase();
|
|
});
|
|
r0 = value;
|
|
} else {
|
|
r0 = value2;
|
|
}
|
|
return r0;
|
|
}
|
|
return value2;
|
|
}
|
|
|
|
function useActivityAction({context, applicationId, fetchesApplication}) { // fn#88814, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11784:574, offset: 0x01ff328d, size: 301 bytes, params: 2, frame: 22
|
|
fetchesApplication = fetchesApplication === undefined || fetchesApplication;
|
|
const START = env0_7.START;
|
|
const channel = context.type !== 'channel' ? undefined : context.channel;
|
|
const value4 = (UseCurrentEmbeddedActivity)();
|
|
const value5 = (UseCurrentEmbeddedApplication)({fetchesApplication: fetchesApplication});
|
|
const value6 = (UseGetOrFetchApplicationsModule).useGetOrFetchApplication(applicationId,
|
|
fetchesApplication);
|
|
const value8 = (UseEmbeddedAppsForChannel)(channel).find(_fun88815);
|
|
if (value6 == null) {
|
|
return START;
|
|
}
|
|
const getEmbeddedActivityLocationChannelId = EmbeddedActivityLocationUtilsModule.getEmbeddedActivityLocationChannelId;
|
|
return channel == null || Reflect.apply(getEmbeddedActivityLocationChannelId, EmbeddedActivityLocationUtilsModule,
|
|
[value4?.location]) !== channel.id ? value8 == null ? START : env0_7.JOIN : value5?.id === value6.id ? env0_7.LEAVE : value8 == null ? START : env0_7.JOIN;
|
|
function _fun88815({embeddedActivity}) { // fn#88815, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11784:814, offset: 0x01ff33ba, size: 45 bytes, params: 2, frame: 4
|
|
return env0_0 != null && env0_0.id === embeddedActivity.applicationId;
|
|
}
|
|
|
|
}
|
|
|
|
function useOnActivityItemSelected({application, botUserIdForAppDM, context, locationObject, embeddedActivitiesManager, onActivityItemSelectedProp, launchingComponentId, commandOrigin, sectionName, source, fetchesApplication, customId, referrerId, onConfirmActivityLaunchChecksAlertOpen}) { // fn#88816, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11784:1058, offset: 0x01ff33e7, size: 408 bytes, params: 2, frame: 18
|
|
fetchesApplication = fetchesApplication === undefined || fetchesApplication;
|
|
const value5 = useActivityAction({context: context, applicationId: application?.id ?? '',
|
|
fetchesApplication: fetchesApplication});
|
|
const env0_13 = (UseAnalyticsLocations)().analyticsLocations;
|
|
const env0_14 = (UseCurrentEmbeddedActivity)();
|
|
const env0_15 = (CanLaunchFrameModule).canLaunchFrame(application);
|
|
if (application == null) {
|
|
return function() {
|
|
if (onActivityItemSelectedProp != null) {
|
|
onActivityItemSelectedProp({applicationId: ''});
|
|
}
|
|
};
|
|
}
|
|
const START = sectionName.START;
|
|
if (START === value5) {
|
|
return embeddedActivitiesManager(_fun88819);
|
|
}
|
|
const JOIN = sectionName.JOIN;
|
|
if (JOIN === value5) {
|
|
return embeddedActivitiesManager(_fun88822);
|
|
}
|
|
const LEAVE = sectionName.LEAVE;
|
|
if (LEAVE === value5) {
|
|
return _fun88824;
|
|
}
|
|
function* _fun88819() { // fn#88819, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11784:1639, offset: 0x01ff35b0, size: 401 bytes, params: 1, frame: 16
|
|
var environment;
|
|
var id;
|
|
var r6;
|
|
var value;
|
|
var value2;
|
|
var value3;
|
|
var type;
|
|
var channel;
|
|
var value4;
|
|
var binding;
|
|
var binding2;
|
|
var property;
|
|
var value5;
|
|
var openPrivateChannel;
|
|
var object;
|
|
var value6;
|
|
var value7;
|
|
var value8;
|
|
var value9;
|
|
var value10;
|
|
var value11;
|
|
var then;
|
|
var value12;
|
|
var value13;
|
|
var error;
|
|
var value14;
|
|
var binding3;
|
|
var value15;
|
|
var launchFrame;
|
|
var value16;
|
|
var value17;
|
|
var value18;
|
|
var embeddedActivitiesStoreBinding;
|
|
var value19;
|
|
exceptionSkip51: while (true) {
|
|
exceptionLanding51: while (true) {
|
|
exceptionSkip26: while (true) {
|
|
exceptionLanding26: while (true) {
|
|
value = undefined;
|
|
value2 = false;
|
|
if (value2) {
|
|
return value;
|
|
}
|
|
value = undefined;
|
|
value3 = environment.__proto__;
|
|
if (env1_15) {
|
|
value14 = environment.__proto__.__proto__;
|
|
try {
|
|
binding = env2_1;
|
|
} catch (error) {
|
|
break exceptionLanding51;
|
|
}
|
|
try {
|
|
binding3 = env2_2;
|
|
} catch (error) {
|
|
break exceptionLanding51;
|
|
}
|
|
try {
|
|
property = binding3[17];
|
|
} catch (error) {
|
|
break exceptionLanding51;
|
|
}
|
|
try {
|
|
value15 = binding(property);
|
|
} catch (error) {
|
|
break exceptionLanding51;
|
|
}
|
|
try {
|
|
launchFrame = value15.launchFrame;
|
|
} catch (error) {
|
|
break exceptionLanding51;
|
|
}
|
|
try {
|
|
object = {};
|
|
} catch (error) {
|
|
break exceptionLanding51;
|
|
}
|
|
try {
|
|
binding = env1_12;
|
|
} catch (error) {
|
|
break exceptionLanding51;
|
|
}
|
|
try {
|
|
object.applicationId = binding;
|
|
} catch (error) {
|
|
break exceptionLanding51;
|
|
}
|
|
try {
|
|
value16 = Reflect.apply(launchFrame, value15, [object]);
|
|
} catch (error) {
|
|
break exceptionLanding51;
|
|
}
|
|
yield value16;
|
|
try {
|
|
value17 = undefined;
|
|
value18 = false;
|
|
} catch (error) {
|
|
break exceptionLanding51;
|
|
}
|
|
if (value18) {
|
|
return value17;
|
|
}
|
|
try {
|
|
embeddedActivitiesStoreBinding = EmbeddedActivitiesStore;
|
|
} catch (error) {
|
|
break exceptionLanding51;
|
|
}
|
|
try {
|
|
value19 = embeddedActivitiesStoreBinding == null;
|
|
} catch (error) {
|
|
break exceptionLanding51;
|
|
}
|
|
if (!value19) {
|
|
try {
|
|
embeddedActivitiesStoreBinding = EmbeddedActivitiesStore;
|
|
} catch (error) {
|
|
break exceptionLanding51;
|
|
}
|
|
try {
|
|
object = {};
|
|
} catch (error) {
|
|
break exceptionLanding51;
|
|
}
|
|
try {
|
|
binding = env1_12;
|
|
} catch (error) {
|
|
break exceptionLanding51;
|
|
}
|
|
try {
|
|
object.applicationId = binding;
|
|
} catch (error) {
|
|
break exceptionLanding51;
|
|
}
|
|
try {
|
|
embeddedActivitiesStoreBinding(object);
|
|
} catch (error) {
|
|
break exceptionLanding51;
|
|
}
|
|
}
|
|
return value;
|
|
}
|
|
type = importDefault.type;
|
|
if (type !== 'channel') {
|
|
id = value;
|
|
} else {
|
|
channel = importDefault.channel;
|
|
id = channel.id;
|
|
}
|
|
if (require == null) {
|
|
r6 = id;
|
|
value9 = environment.__proto__.__proto__;
|
|
value11 = env2_1(env2_2[19])({targetApplicationId: env1_12, locationObject: dependencyMap,
|
|
channelId: r6,
|
|
analyticsLocations: env1_13, componentId: STAFF_RELEASE_PHASES,
|
|
commandOrigin: ApplicationFlags,
|
|
sectionName: env1_7, source: getStaffReleasePhase, customId: useActivityAction,
|
|
referrerId: useOnActivityItemSelected, onConfirmActivityLaunchChecksAlertOpen: env1_11});
|
|
yield value11.then(_fun88820);
|
|
return value;
|
|
}
|
|
value4 = environment.__proto__.__proto__;
|
|
try {
|
|
binding = env2_1;
|
|
} catch (error) {
|
|
break exceptionLanding26;
|
|
}
|
|
try {
|
|
binding2 = env2_2;
|
|
} catch (error) {
|
|
break exceptionLanding26;
|
|
}
|
|
try {
|
|
property = binding2[18];
|
|
} catch (error) {
|
|
break exceptionLanding26;
|
|
}
|
|
try {
|
|
value5 = binding(property);
|
|
} catch (error) {
|
|
break exceptionLanding26;
|
|
}
|
|
try {
|
|
openPrivateChannel = value5.openPrivateChannel;
|
|
} catch (error) {
|
|
break exceptionLanding26;
|
|
}
|
|
try {
|
|
object = {};
|
|
} catch (error) {
|
|
break exceptionLanding26;
|
|
}
|
|
try {
|
|
} catch (error) {
|
|
break exceptionLanding26;
|
|
}
|
|
try {
|
|
object.recipientIds = require;
|
|
} catch (error) {
|
|
break exceptionLanding26;
|
|
}
|
|
try {
|
|
object.navigateToChannel = true;
|
|
} catch (error) {
|
|
break exceptionLanding26;
|
|
}
|
|
try {
|
|
value6 = Reflect.apply(openPrivateChannel, value5, [object]);
|
|
} catch (error) {
|
|
break exceptionLanding26;
|
|
}
|
|
yield value6;
|
|
try {
|
|
value7 = undefined;
|
|
value8 = false;
|
|
} catch (error) {
|
|
break exceptionLanding26;
|
|
}
|
|
if (value8) {
|
|
return value7;
|
|
}
|
|
r6 = value7;
|
|
value9 = environment.__proto__.__proto__;
|
|
binding = env2_1;
|
|
value10 = binding(env2_2[19]);
|
|
value11 = value10({targetApplicationId: env1_12, locationObject: dependencyMap, channelId: r6,
|
|
analyticsLocations: env1_13, componentId: STAFF_RELEASE_PHASES, commandOrigin: ApplicationFlags,
|
|
sectionName: env1_7, source: getStaffReleasePhase, customId: useActivityAction,
|
|
referrerId: useOnActivityItemSelected, onConfirmActivityLaunchChecksAlertOpen: env1_11});
|
|
then = value11.then;
|
|
yield Reflect.apply(then, value11, [_fun88820]);
|
|
value12 = undefined;
|
|
value13 = false;
|
|
return value13 ? value12 : value;
|
|
break exceptionSkip26;
|
|
}
|
|
return value;
|
|
break exceptionSkip26;
|
|
}
|
|
break exceptionSkip51;
|
|
}
|
|
return value;
|
|
break exceptionSkip51;
|
|
}
|
|
function _fun88820(a0) { // fn#88820, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11784:2122, offset: 0x01ff3741, size: 50 bytes, params: 2, frame: 14
|
|
return a0 && EmbeddedActivitiesStore?.({applicationId: env2_12});
|
|
}
|
|
|
|
}
|
|
|
|
function* _fun88822() { // fn#88822, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11784:2194, offset: 0x01ff377e, size: 213 bytes, params: 1, frame: 16
|
|
var environment;
|
|
if (true) {
|
|
value = environment.__proto__.__proto__;
|
|
var binding = env2_4;
|
|
if (!binding.isLaunchingActivity()) {
|
|
binding = env2_1;
|
|
value = undefined;
|
|
value = binding(env2_2[20])({applicationId: env1_12,
|
|
activityChannelId: importDefault.type !== 'channel' ? value : importDefault.channel.id,
|
|
locationObject: dependencyMap, analyticsLocations: env1_13, componentId: STAFF_RELEASE_PHASES,
|
|
sectionName: env1_7, source: getStaffReleasePhase, customId: useActivityAction,
|
|
referrerId: useOnActivityItemSelected});
|
|
yield value.then(_fun88823);
|
|
value = undefined;
|
|
if (false) {
|
|
return value;
|
|
}
|
|
}
|
|
}
|
|
function _fun88823(a0) { // fn#88823, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11784:2428, offset: 0x01ff3741, size: 50 bytes, params: 2, frame: 14
|
|
return a0 && EmbeddedActivitiesStore?.({applicationId: env2_12});
|
|
}
|
|
|
|
}
|
|
|
|
function _fun88824() { // fn#88824, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11784:2497, offset: 0x01ff3853, size: 104 bytes, params: 1, frame: 14
|
|
const embeddedActivitiesStoreBinding = EmbeddedActivitiesStore;
|
|
if (!embeddedActivitiesStoreBinding.isLaunchingActivity()) {
|
|
if (env0_14 != null) {
|
|
embeddedActivitiesManager.leaveActivity({location: env0_14.location, applicationId: env0_12});
|
|
}
|
|
if (onActivityItemSelectedProp != null) {
|
|
onActivityItemSelectedProp({applicationId: env0_12});
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function useActivityShelfItem({activityItem, context, locationObject, onActivityItemSelected, embeddedActivitiesManager, assetNames = ['embedded_cover'], backgroundResolution, launchingComponentId, commandOrigin, source}) { // fn#88825, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11784:2720, offset: 0x01ff38bb, size: 619 bytes, params: 2, frame: 32
|
|
backgroundResolution = backgroundResolution === undefined ? 250 : backgroundResolution;
|
|
const application = activityItem.application;
|
|
const activity = activityItem.activity;
|
|
const client_platform_config = activity.client_platform_config;
|
|
const defaultImport = GetPlatform;
|
|
const getOS = PlatformUtilsModule.getOS;
|
|
const property = client_platform_config[defaultImport(Reflect.apply(getOS, PlatformUtilsModule, []))];
|
|
const Date = global.Date;
|
|
const value4 = Date.now();
|
|
const r4 = property.label_until != null && value4 < global.Date.parse(property.label_until) && property.label_from != null && value4 > global.Date.parse(property.label_from);
|
|
const value10 = (UseEmbeddedActivityBackground)({applicationId: application.id,
|
|
size: backgroundResolution, names: assetNames, format: 'webp'});
|
|
const r9 = activity.activity_preview_video_asset_id != null ? (importDefault(11599) /* metro dependency 11599: getPreviewVideoAssetUrl */)(application.id,
|
|
activity.activity_preview_video_asset_id) : null;
|
|
const value13 = (importDefault(11600) /* metro dependency 11600: useEmbeddedAppsForChannel */)(context.type !== 'channel' ? undefined : context.channel).find(function({embeddedActivity}) {
|
|
return application.id === embeddedActivity.applicationId;
|
|
});
|
|
const value14 = useActivityAction({context: context, applicationId: application.id});
|
|
const value15 = useOnActivityItemSelected({application: activityItem.application, context: context,
|
|
locationObject: locationObject, embeddedActivitiesManager: embeddedActivitiesManager,
|
|
onActivityItemSelectedProp: onActivityItemSelected, launchingComponentId: launchingComponentId,
|
|
commandOrigin: commandOrigin, source: source});
|
|
const staffReleasePhase = getStaffReleasePhase(application, activityItem.activity);
|
|
object = {imageBackground: value10, videoUrl: r9, joinableEmbeddedApp: value13, activityAction: value14,
|
|
onActivityItemSelected: value15};
|
|
object.labelType = r4 ? property.label_type : (require(1909) /* metro dependency 1909: Server */).EmbeddedActivityLabelTypes.NONE;
|
|
object.staffReleasePhase = staffReleasePhase;
|
|
return object;
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun88811, 11598, [5, 1378, 4237, 661, 8049, 477, 10718, 11599, 11600, 1909, 7504, 10702, 10701, 6777,
|
|
3774, 6771, 8045, 8087, 4603, 9472, 8109,
|
|
2]) /* metro module 11598, dependencies: [5, 1378, 4237, 661, 8049, 477, 10718, 11599, 11600, 1909, 7504, 10702, 10701, 6777, 3774, 6771, 8045, 8087, 4603, 9472, 8109, 2] */;
|