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

231 lines
8.2 KiB
TypeScript
Raw Normal View History

2026-08-15 05:55:55 +00:00
// Module ID: 12094
// Function ID: 12095
2026-07-20 16:05:17 +00:00
// Name: AddAppButton
2026-08-15 05:55:55 +00:00
// Dependencies: [5, 32, 19, 8448, 676, 1499, 21, 11323, 8773, 4342, 7167, 11310, 4093, 1487, 6693, 9262, 1236, 4745, 712, 7140, 4770, 4237, 1627, 698, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-15 05:55:55 +00:00
// Module 12094 (AddAppButton)
2026-07-23 10:11:24 +00:00
import APP_LAUNCHER_BUILT_IN_SECTION_ICON from "APP_LAUNCHER_BUILT_IN_SECTION_ICON";
import _slicedToArray from "_slicedToArray";
2026-07-29 08:29:29 +00:00
import fetchApplication from "fetchApplication";
import { getSection } from "getIndexKey";
2026-07-23 10:11:24 +00:00
import { AnalyticEvents } from "ME";
import { AppLauncherRouteName } from "APP_LAUNCHER_BUILT_IN_SECTION_ICON";
2026-07-29 08:29:29 +00:00
import { jsx } from "getBestActiveInput";
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-07-23 10:11:24 +00:00
let obj = application(outer1_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-07-23 10:11:24 +00:00
guildId(outer1_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)) {
2026-08-15 05:55:55 +00:00
let PlusSmallIcon = application(6693).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 };
const intl = application(1236).intl;
obj[1] = intl.string(application(1236).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-07-23 10:11:24 +00:00
const obj = application(outer1_2[10]);
obj.copy(application(outer1_2[11]).getApplicationInstallURL(application));
const obj2 = application(outer1_2[11]);
application(outer1_2[12]).presentLinkCopied();
const obj3 = application(outer1_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 };
let intl = tmp6(1236).intl;
obj[0] = intl.string(tmp6(1236).t.NgXl3C);
obj[1] = callback;
obj[2] = tmp2;
obj[3] = memo;
obj[4] = callback1;
obj = { size: "sm", color: null };
obj[1] = guildId(712).colors.WHITE;
obj[5] = <PlusSmallIcon size="sm" color={null} />;
2026-08-15 05:55:55 +00:00
return jsx(tmp6(4745).Button, { size: "sm", color: null });
2026-07-20 16:05:17 +00:00
}
2026-08-15 05:55:55 +00:00
PlusSmallIcon = application(9262).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-08-15 05:55:55 +00:00
return { value: "HermesInternal", done: "HermesInternal" };
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 {
let c2 = 0;
let id = tmp2;
let closure_0;
id = undefined;
const obj1 = { type: "channel", channel: null };
obj1[1] = outer1_2;
const tmp44 = outer1_6(obj1, outer1_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] = outer1_1(outer1_2[19]).fetchApplication(tmp43.id);
return obj2;
} else {
id = closure_0;
v0(false);
if (null != closure_0) {
let obj4 = outer1_1(outer1_2[9]);
obj4.hideActionSheet();
let obj5 = outer1_1(outer1_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 = outer1_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] = outer1_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 = outer1_1(outer1_2[23]);
const obj6 = { application_id: null };
obj6[0] = id.id;
obj.track(outer1_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 };
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-07-29 08:29:29 +00:00
const result = require("noop").fileFinishedImporting("modules/user_profile/native/AddOrOpenAppButton.tsx");
2026-07-20 16:05:17 +00:00
export default function AddOrOpenAppButton(arg0) {
let application;
let botUserId;
let channel;
let guildId;
({ application, channel } = arg0);
({ botUserId, guildId } = arg0);
2026-08-15 05:55:55 +00:00
if (importDefault(11323)(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} />;
};