decord/source/modules/user_profile/native/AddOrOpenAppButton.tsx
2026-09-02 09:53:35 +00:00

227 lines
8.2 KiB
TypeScript

// Module ID: 9288
// Function ID: 9289
// Name: AddAppButton
// Dependencies: [5, 32, 19, 8154, 673, 1497, 21, 9289, 9290, 4445, 5989, 9098, 4193, 1485, 8743, 9394, 1233, 4928, 709, 5962, 4491, 4340, 1625, 695, 2]
// Exports: default
// Module 9288 (AddAppButton)
import useIsAppDMDefault from "useIsAppDM" /* 9289 */;
import closure_3 from "asyncGeneratorStep" /* 5 */;
import closure_4 from "_slicedToArray" /* 32 */;
import closure_5 from "noop" /* 19 */;
import { getSection } from "getIndexKey" /* 8154 */;
import { AnalyticEvents } from "ME" /* 673 */;
import { AppLauncherRouteName } from "APP_LAUNCHER_BUILT_IN_SECTION_ICON" /* 1497 */;
import { jsx } from "jsxProd" /* 21 */;
const require = arg1;
function AddAppButton(application) {
application = application.application;
const guildId = application.guildId;
let obj = React;
let items = [, , , , ];
({ customInstallUrl: arr[0], id: arr[1], installParams: arr[2], integrationTypesConfig: arr[3] } = application);
items[4] = guildId;
[][0] = application;
const callback = React.useCallback(() => {
let obj = application(closure_1_2[8]);
obj = { applicationId: application.id, customInstallUrl: application.customInstallUrl, installParams: application.installParams, integrationTypesConfig: application.integrationTypesConfig, guildId };
obj.installApplication(obj);
guildId(closure_1_2[9]).hideActionSheet();
}, items);
const customInstallUrl = application.customInstallUrl;
if (null != customInstallUrl) {
if (!obj2.isDiscordUrl(customInstallUrl)) {
let PlusSmallIcon = application(8743).LinkExternalSmallIcon;
let tmp6 = application;
}
const items1 = [application];
const memo = obj.useMemo(() => {
const obj = { name: "longpress", label: null };
const intl = application(1233).intl;
obj[1] = intl.string(application(1233).t.XWDihq);
const items = [obj];
return items;
}, []);
const callback1 = obj.useCallback((nativeEvent) => {
if ("longPress" === nativeEvent.nativeEvent.actionName) {
const obj = application(closure_1_2[10]);
obj.copy(application(closure_1_2[11]).getApplicationInstallURL(application));
const obj2 = application(closure_1_2[11]);
application(closure_1_2[12]).presentLinkCopied();
const obj3 = application(closure_1_2[12]);
}
}, items1);
obj = { text: null, onPress: null, onLongPress: null, accessibilityActions: null, onAccessibilityAction: null, icon: null };
let intl = tmp6(1233).intl;
obj[0] = intl.string(tmp6(1233).t.NgXl3C);
obj[1] = callback;
obj[2] = tmp2;
obj[3] = memo;
obj[4] = callback1;
obj = { size: "sm", color: null };
obj[1] = guildId(709).colors.WHITE;
obj[5] = <PlusSmallIcon size="sm" color={null} />;
return jsx(tmp6(4928).Button, { size: "sm", color: null });
}
PlusSmallIcon = application(9394).PlusSmallIcon;
tmp6 = application;
}
function OpenAppButton(profileApplication) {
profileApplication = profileApplication.profileApplication;
const botUserId = profileApplication.botUserId;
const channel = profileApplication.channel;
let callback;
const tmp = callback2(React.useState(false), 2);
callback = tmp[1];
const items = [botUserId, channel, profileApplication.id];
callback = React.useCallback(callback(function*() {
if (c4 === 2) {
c4 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
return { value: "HermesInternal", done: null };
}
} else {
try {
c4 = 2;
if (0 === v0) {
if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 === 2) {
c4 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
c2 = 0;
let id = tmp2;
closure_0 = undefined;
id = undefined;
obj1 = { type: "channel", channel: null };
obj1[1] = closure_1_2;
const tmp44 = closure_1_6(obj1, closure_1_0.id);
closure_0 = tmp44;
const descriptor2 = tmp44.descriptor;
let application;
if (descriptor2 != null) {
application = descriptor2.application;
}
if (null == application) {
v0(true);
}
const descriptor = tmp44.descriptor;
let application1;
if (descriptor != null) {
application1 = descriptor.application;
}
closure_0 = application1;
if (application1 == null) {
v0 = 1;
c4 = 1;
const obj2 = { value: null, done: false };
obj2[0] = closure_1_1(closure_1_2[19]).fetchApplication(tmp43.id);
return obj2;
} else {
id = closure_0;
v0(false);
if (null != closure_0) {
let obj4 = closure_1_1(closure_1_2[9]);
obj4.hideAllActionSheets();
let obj5 = closure_1_1(closure_1_2[20]);
const obj3 = { recipientIds: null };
obj3[0] = id;
v0 = 2;
c4 = 1;
obj4 = { value: null, done: false };
obj4[0] = obj5.openPrivateChannel(obj3);
return obj4;
} else {
c4 = 3;
}
}
tmp43 = closure_1_0;
}
} else if (1 === tmp5) {
if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 === 2) {
c4 = 3;
obj5 = { value: null, done: true };
obj5[0] = arg1;
return obj5;
} else {
closure_0 = arg1;
}
} else if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 !== 2) {
const _setTimeout = setTimeout;
const timerId = setTimeout(() => {
let obj = lib(table[21]);
const bestActiveInput = obj.getBestActiveInput();
if (bestActiveInput != null) {
obj = { type: null, context: null };
obj[0] = lib(table[22]).KeyboardTypes.APP_LAUNCHER;
obj = { initialRouteName: null, initiallyExpanded: true, application: null, installOnDemand: null };
obj[0] = closure_1_8.APPLICATION_VIEW;
obj[2] = closure_1;
const isGuildInstalled = lib.isGuildInstalled;
let tmp5 = !isGuildInstalled;
if (!isGuildInstalled) {
tmp5 = !lib.isUserInstalled;
}
obj[3] = tmp5;
obj[1] = obj;
bestActiveInput.openCustomKeyboard(obj);
}
}, 0);
obj = closure_1_1(closure_1_2[23]);
const obj6 = { application_id: null };
obj6[0] = id.id;
obj.track(closure_1_7.APP_PROFILE_OPEN_APP_BUTTON_CLICKED, obj6);
}
c4 = 3;
const obj7 = { value: null, done: true };
obj7[0] = arg1;
return obj7;
} catch (tmp35) {
c4 = tmp;
throw tmp35;
}
}
}), items);
let obj = { text: null, loading: null, onPress: null };
const intl = profileApplication(channel[16]).intl;
obj[0] = intl.string(profileApplication(channel[16]).t["Cia+A8"]);
obj[1] = tmp[0];
obj[2] = callback;
return jsx(profileApplication(channel[17]).Button, { text: null, loading: null, onPress: null });
}
const result = require("set").fileFinishedImporting("modules/user_profile/native/AddOrOpenAppButton.tsx");
export default function AddOrOpenAppButton(arg0) {
({ application, channel } = arg0);
({ botUserId, guildId } = arg0);
if (useIsAppDMDefault(channel)) {
if (null != channel) {
const obj = { profileApplication: null, botUserId: null, channel: null };
obj[0] = application;
obj[1] = botUserId;
obj[2] = channel;
let tmp2 = <OpenAppButton profileApplication={null} botUserId={null} channel={null} />;
}
return tmp2;
}
tmp2 = <AddAppButton application={application} guildId={guildId} />;
};