decord/source/modules/user_profile/native/AddOrOpenAppButton.tsx

228 lines
8.2 KiB
TypeScript
Raw Normal View History

// Module ID: 12929
// Function ID: 12930
2026-07-20 16:05:17 +00:00
// Name: AddAppButton
// Dependencies: [5, 32, 19, 9219, 673, 1497, 21, 12077, 9502, 4448, 7130, 12064, 4193, 1485, 8510, 8797, 1233, 4936, 709, 7103, 4494, 4343, 1625, 695, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 12929 (AddAppButton)
import useIsAppDMDefault from "useIsAppDM" /* 12077 */;
2026-08-24 06:08:38 +00:00
import closure_3 from "asyncGeneratorStep" /* 5 */;
import closure_4 from "_slicedToArray" /* 32 */;
import closure_5 from "noop" /* 19 */;
import { getSection } from "getIndexKey" /* 9219 */;
2026-09-02 09:53:35 +00:00
import { AnalyticEvents } from "ME" /* 673 */;
import { AppLauncherRouteName } from "APP_LAUNCHER_BUILT_IN_SECTION_ICON" /* 1497 */;
2026-08-24 06:08:38 +00:00
import { jsx } from "jsxProd" /* 21 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
function AddAppButton(application) {
application = application.application;
const guildId = application.guildId;
2026-07-29 08:29:29 +00:00
let obj = React;
2026-07-23 10:11:24 +00:00
let items = [, , , , ];
2026-07-20 16:05:17 +00:00
({ customInstallUrl: arr[0], id: arr[1], installParams: arr[2], integrationTypesConfig: arr[3] } = application);
items[4] = guildId;
[][0] = application;
const callback = React.useCallback(() => {
2026-08-24 06:08:38 +00:00
let obj = application(closure_1_2[8]);
2026-07-20 16:05:17 +00:00
obj = { applicationId: application.id, customInstallUrl: application.customInstallUrl, installParams: application.installParams, integrationTypesConfig: application.integrationTypesConfig, guildId };
obj.installApplication(obj);
2026-08-24 06:08:38 +00:00
guildId(closure_1_2[9]).hideActionSheet();
2026-07-20 16:05:17 +00:00
}, items);
const customInstallUrl = application.customInstallUrl;
if (null != customInstallUrl) {
2026-07-29 08:29:29 +00:00
if (!obj2.isDiscordUrl(customInstallUrl)) {
let PlusSmallIcon = application(8510).LinkExternalSmallIcon;
2026-07-29 08:29:29 +00:00
let tmp6 = application;
2026-07-20 16:05:17 +00:00
}
const items1 = [application];
2026-07-29 08:29:29 +00:00
const memo = obj.useMemo(() => {
const obj = { name: "longpress", label: null };
2026-09-02 09:53:35 +00:00
const intl = application(1233).intl;
obj[1] = intl.string(application(1233).t.XWDihq);
2026-07-20 16:05:17 +00:00
const items = [obj];
return items;
}, []);
2026-07-29 08:29:29 +00:00
const callback1 = obj.useCallback((nativeEvent) => {
2026-07-20 16:05:17 +00:00
if ("longPress" === nativeEvent.nativeEvent.actionName) {
2026-08-24 06:08:38 +00:00
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]);
2026-07-20 16:05:17 +00:00
}
}, items1);
2026-07-29 08:29:29 +00:00
obj = { text: null, onPress: null, onLongPress: null, accessibilityActions: null, onAccessibilityAction: null, icon: null };
2026-09-02 09:53:35 +00:00
let intl = tmp6(1233).intl;
obj[0] = intl.string(tmp6(1233).t.NgXl3C);
2026-07-29 08:29:29 +00:00
obj[1] = callback;
obj[2] = tmp2;
obj[3] = memo;
obj[4] = callback1;
obj = { size: "sm", color: null };
2026-09-02 09:53:35 +00:00
obj[1] = guildId(709).colors.WHITE;
2026-07-29 08:29:29 +00:00
obj[5] = <PlusSmallIcon size="sm" color={null} />;
return jsx(tmp6(4936).Button, { size: "sm", color: null });
2026-07-20 16:05:17 +00:00
}
PlusSmallIcon = application(8797).PlusSmallIcon;
2026-07-29 08:29:29 +00:00
tmp6 = application;
2026-07-20 16:05:17 +00:00
}
function OpenAppButton(profileApplication) {
profileApplication = profileApplication.profileApplication;
const botUserId = profileApplication.botUserId;
const channel = profileApplication.channel;
2026-07-29 08:29:29 +00:00
let callback;
const tmp = callback2(React.useState(false), 2);
callback = tmp[1];
2026-07-20 16:05:17 +00:00
const items = [botUserId, channel, profileApplication.id];
2026-07-29 08:29:29 +00:00
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 {
2026-09-01 10:26:29 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} 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 {
2026-08-24 06:08:38 +00:00
c2 = 0;
2026-07-29 08:29:29 +00:00
let id = tmp2;
2026-08-24 06:08:38 +00:00
closure_0 = undefined;
2026-07-29 08:29:29 +00:00
id = undefined;
2026-08-24 06:08:38 +00:00
obj1 = { type: "channel", channel: null };
obj1[1] = closure_1_2;
const tmp44 = closure_1_6(obj1, closure_1_0.id);
2026-07-29 08:29:29 +00:00
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 };
2026-08-24 06:08:38 +00:00
obj2[0] = closure_1_1(closure_1_2[19]).fetchApplication(tmp43.id);
2026-07-29 08:29:29 +00:00
return obj2;
} else {
id = closure_0;
v0(false);
if (null != closure_0) {
2026-08-24 06:08:38 +00:00
let obj4 = closure_1_1(closure_1_2[9]);
2026-08-26 06:04:24 +00:00
obj4.hideAllActionSheets();
2026-08-24 06:08:38 +00:00
let obj5 = closure_1_1(closure_1_2[20]);
2026-07-29 08:29:29 +00:00
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;
}
}
2026-08-24 06:08:38 +00:00
tmp43 = closure_1_0;
2026-07-29 08:29:29 +00:00
}
} 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 };
2026-08-24 06:08:38 +00:00
obj[0] = closure_1_8.APPLICATION_VIEW;
2026-07-29 08:29:29 +00:00
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);
2026-08-24 06:08:38 +00:00
obj = closure_1_1(closure_1_2[23]);
2026-07-29 08:29:29 +00:00
const obj6 = { application_id: null };
obj6[0] = id.id;
2026-08-24 06:08:38 +00:00
obj.track(closure_1_7.APP_PROFILE_OPEN_APP_BUTTON_CLICKED, obj6);
2026-07-29 08:29:29 +00:00
}
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 };
2026-07-23 10:11:24 +00:00
const intl = profileApplication(channel[16]).intl;
2026-07-29 08:29:29 +00:00
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 });
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/user_profile/native/AddOrOpenAppButton.tsx");
2026-07-20 16:05:17 +00:00
export default function AddOrOpenAppButton(arg0) {
({ application, channel } = arg0);
({ botUserId, guildId } = arg0);
2026-08-24 06:08:38 +00:00
if (useIsAppDMDefault(channel)) {
2026-07-20 16:05:17 +00:00
if (null != channel) {
2026-07-29 08:29:29 +00:00
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} />;
2026-07-20 16:05:17 +00:00
}
return tmp2;
}
tmp2 = <AddAppButton application={application} guildId={guildId} />;
};