decord/alpha/source/modules/activities/utils/useRefocusOrLaunchActivity.tsx

174 lines
6.4 KiB
TypeScript
Raw Normal View History

2026-10-09 10:00:15 +00:00
// Module ID: 12921
// Function ID: 12922
2026-07-20 16:05:17 +00:00
// Name: useRefocusOrLaunchActivity
2026-10-09 10:00:15 +00:00
// Dependencies: [5, 19, 10772, 2063, 10767, 6849, 504, 10768, 10769, 10814, 11566, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-10-09 10:00:15 +00:00
// Module 12921 (useRefocusOrLaunchActivity)
2026-10-03 08:58:59 +00:00
import _asyncToGenerator from "_asyncToGenerator" /* 5 */;
import react from "react" /* 19 */;
2026-10-09 10:00:15 +00:00
import FramesStore from "FramesStore" /* 10772 */;
import EmbeddedActivitiesStore from "EmbeddedActivitiesStore" /* 2063 */;
import FramesConstants from "FramesConstants" /* 10767 */;
2026-10-03 08:58:59 +00:00
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
let c5;
let metroImportAll;
let metroImportDefault;
({ MAIN_SURFACE: metroImportDefault, FrameLayoutModes: metroImportAll } = FramesConstants);
let result = size.fileFinishedImporting("modules/activities/utils/useRefocusOrLaunchActivity.tsx");
2026-07-20 16:05:17 +00:00
export default function useRefocusOrLaunchActivity(applicationId) {
applicationId = applicationId.applicationId;
let analyticsLocations = applicationId.analyticsLocations;
2026-10-03 08:58:59 +00:00
let runBeforeLaunchAttempt = applicationId.runBeforeLaunchAttempt;
2026-07-20 16:05:17 +00:00
const runAfterLaunchAttempt = applicationId.runAfterLaunchAttempt;
2026-07-29 08:29:29 +00:00
let stateFromStores1;
let obj = applicationId(runBeforeLaunchAttempt[5]);
2026-10-03 08:58:59 +00:00
const data = obj.useApplication(applicationId).data;
2026-07-29 08:29:29 +00:00
let obj2 = applicationId(runBeforeLaunchAttempt[6]);
2026-10-03 08:58:59 +00:00
const items = [stateFromStores1];
const stateFromStores = obj2.useStateFromStores(items, () => stateFromStores1.getCurrentEmbeddedActivity());
let obj3 = applicationId(runBeforeLaunchAttempt[6]);
2026-07-23 10:11:24 +00:00
const items1 = [stateFromStores];
2026-10-03 08:58:59 +00:00
stateFromStores1 = obj3.useStateFromStores(items1, () => stateFromStores.getMainFrame());
let obj4 = applicationId(runBeforeLaunchAttempt[7]);
let result = obj4.canLaunchContextlessFrame(data);
let c7 = result;
const items2 = [analyticsLocations, data, applicationId, result, stateFromStores, stateFromStores1, runAfterLaunchAttempt, runBeforeLaunchAttempt];
return data.useCallback(runAfterLaunchAttempt(function*(arg0, value) {
2026-10-03 08:58:59 +00:00
let c2;
let closure_1;
let id1;
let obj7;
2026-07-29 08:29:29 +00:00
if (c5 === 2) {
c5 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
2026-10-03 08:58:59 +00:00
} else if (tmp3 === 3) {
2026-07-29 08:29:29 +00:00
if (arg0 === 1) {
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
const obj2 = { value, done: true };
return obj2;
2026-07-29 08:29:29 +00:00
} else {
2026-10-05 08:00:40 +00:00
return { value: "IconComponent", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
2026-10-03 08:58:59 +00:00
let c4;
2026-07-29 08:29:29 +00:00
try {
c5 = 2;
2026-10-03 08:58:59 +00:00
if (0 === runBeforeLaunchAttempt) {
2026-07-29 08:29:29 +00:00
if (arg0 === 1) {
c5 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c5 = 3;
2026-10-03 08:58:59 +00:00
const obj3 = { value, done: true };
return obj3;
2026-07-29 08:29:29 +00:00
} else {
if (null != applicationId) {
if (null != data) {
2026-10-03 08:58:59 +00:00
const tmp6 = null != stateFromStores && tmp40.applicationId === tmp38;
if (null != stateFromStores1) {
2026-10-03 08:58:59 +00:00
if (stateFromStores1.applicationId === applicationId) {
const obj4 = { frameId: stateFromStores1.id, layoutMode: constants.FOCUSED };
const obj9 = tmp(runBeforeLaunchAttempt[8]);
const result = obj9.updateFrameLayoutMode(obj4);
2026-07-29 08:29:29 +00:00
}
}
2026-10-03 08:58:59 +00:00
if (tmp6) {
const _location = tmp40.location;
2026-07-29 08:29:29 +00:00
let guild_id = null;
2026-10-03 08:58:59 +00:00
const tmp24 = tmp(runBeforeLaunchAttempt[9]);
2026-07-29 08:29:29 +00:00
if ("guild_id" in _location) {
guild_id = _location.guild_id;
}
2026-10-03 08:58:59 +00:00
tmp24(guild_id, _location);
2026-07-29 08:29:29 +00:00
} else {
if (runBeforeLaunchAttempt != null) {
runBeforeLaunchAttempt();
2026-07-29 08:29:29 +00:00
}
c4 = 1;
2026-10-03 08:58:59 +00:00
const tmp9 = c7;
if (tmp9) {
const obj6 = { applicationId, surface, analyticsContext: obj7 };
obj7 = { isStart: true, analyticsLocations };
const obj5 = tmp(runBeforeLaunchAttempt[8]);
runBeforeLaunchAttempt = 2;
2026-07-29 08:29:29 +00:00
c5 = 1;
2026-10-03 08:58:59 +00:00
const obj8 = { value: obj5.launchFrame(obj6), done: false };
return obj8;
2026-07-29 08:29:29 +00:00
} else {
let id;
2026-10-03 08:58:59 +00:00
if (data != null) {
const bot = tmp39.bot;
2026-07-29 08:29:29 +00:00
if (bot != null) {
id = bot.id;
}
}
2026-10-03 08:58:59 +00:00
if (null != id) {
const obj10 = { appId: applicationId, botId: id1, analyticsLocations };
id1 = undefined;
const launchActivityInBotDM = analyticsLocations(runBeforeLaunchAttempt[10]).launchActivityInBotDM;
const tmp14 = analyticsLocations(runBeforeLaunchAttempt[10]);
if (data != null) {
const bot2 = tmp39.bot;
if (bot2 != null) {
id1 = bot2.id;
}
}
if (analyticsLocations == null) {
analyticsLocations = [];
}
runBeforeLaunchAttempt = 3;
c5 = 1;
const obj11 = { value: launchActivityInBotDM(obj10), done: false };
return obj11;
} else {
2026-07-29 08:29:29 +00:00
c4 = 0;
}
}
}
}
}
c5 = 3;
2026-10-05 08:00:40 +00:00
return { value: "IconComponent", done: null };
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
} else if (1 === runBeforeLaunchAttempt) {
2026-07-29 08:29:29 +00:00
c4 = 0;
2026-10-03 08:58:59 +00:00
} else if (2 === runBeforeLaunchAttempt) {
2026-07-29 08:29:29 +00:00
if (arg0 === 1) {
c5 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c4 = 0;
c5 = 3;
2026-10-03 08:58:59 +00:00
const obj12 = { value, done: true };
return obj12;
2026-07-29 08:29:29 +00:00
}
} else if (arg0 === 1) {
c5 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c4 = 0;
c5 = 3;
const obj = { value, done: true };
2026-07-29 08:29:29 +00:00
return obj;
}
if (closure_129_3 != null) {
closure_129_3();
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
} catch (tmp31) {
let closure_3 = tmp31;
if (0 === c4) {
c5 = 3;
throw tmp31;
2026-07-29 08:29:29 +00:00
} else {
2026-10-03 08:58:59 +00:00
runBeforeLaunchAttempt = 1;
2026-07-29 08:29:29 +00:00
}
}
}
}), items2);
2026-07-20 16:05:17 +00:00
};