Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4792.js (118.4 MB)
208 lines
8.4 KiB
TypeScript
208 lines
8.4 KiB
TypeScript
// Module ID: 13092
|
|
// Function ID: 13093
|
|
// Name: AddOrOpenAppButton
|
|
// Dependencies: [5, 32, 19, 9382, 1074, 1482, 21, 12240, 9666, 4574, 7263, 12227, 4304, 1365, 8671, 8959, 1114, 5027, 576, 7237, 4620, 4472, 1609, 1242, 2]
|
|
// Exports: default
|
|
|
|
// Module 13092 (AddOrOpenAppButton)
|
|
import ToastUtils from "ToastUtils" /* 4304 */;
|
|
import ActionSheetActionCreatorsDefault from "ActionSheetActionCreators" /* 4574 */;
|
|
import ClipboardUtils from "ClipboardUtils" /* 7263 */;
|
|
import ApplicationUtils from "ApplicationUtils" /* 9666 */;
|
|
import getApplicationInstallURL from "getApplicationInstallURL" /* 12227 */;
|
|
import useIsAppDMDefault from "useIsAppDM" /* 12240 */;
|
|
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
|
|
import _slicedToArray from "module_32" /* 32 */;
|
|
import noop from "module_19" /* 19 */;
|
|
|
|
require = fn;
|
|
function AddAppButton(application) {
|
|
application = application.application;
|
|
const guildId = application.guildId;
|
|
let items = [, , , , ];
|
|
({ customInstallUrl: arr[0], id: arr[1], installParams: arr[2], integrationTypesConfig: arr[3] } = application);
|
|
items[4] = guildId;
|
|
[][0] = application;
|
|
const callback = noop.useCallback(() => {
|
|
ApplicationUtils.installApplication({ applicationId: application.id, customInstallUrl: application.customInstallUrl, installParams: application.installParams, integrationTypesConfig: application.integrationTypesConfig, guildId });
|
|
const obj2 = { applicationId: application.id, customInstallUrl: application.customInstallUrl, installParams: application.installParams, integrationTypesConfig: application.integrationTypesConfig, guildId };
|
|
ActionSheetActionCreatorsDefault.hideActionSheet();
|
|
}, items);
|
|
const customInstallUrl = application.customInstallUrl;
|
|
if (null != customInstallUrl) {
|
|
if (!obj2.isDiscordUrl(customInstallUrl)) {
|
|
let PlusSmallIcon = application(8671).LinkExternalSmallIcon;
|
|
let tmp6 = application;
|
|
}
|
|
const items1 = [application];
|
|
const memo = obj.useMemo(() => {
|
|
const obj = { name: "longpress", label: null };
|
|
const intl = application(1114).intl;
|
|
obj.label = intl.string(application(1114).t.XWDihq);
|
|
const items = [obj];
|
|
return items;
|
|
}, []);
|
|
const callback1 = obj.useCallback((nativeEvent) => {
|
|
if ("longPress" === nativeEvent.nativeEvent.actionName) {
|
|
const obj = ClipboardUtils;
|
|
obj.copy(getApplicationInstallURL.getApplicationInstallURL(application));
|
|
ToastUtils.presentLinkCopied();
|
|
}
|
|
}, items1);
|
|
let obj3 = { text: null, onPress: null, onLongPress: null, accessibilityActions: null, onAccessibilityAction: null, icon: null };
|
|
let intl = tmp6(1114).intl;
|
|
obj3.text = intl.string(tmp6(1114).t.NgXl3C);
|
|
obj3.onPress = callback;
|
|
obj3.onLongPress = tmp2;
|
|
obj3.accessibilityActions = memo;
|
|
obj3.onAccessibilityAction = callback1;
|
|
const obj4 = { size: "sm", color: guildId(576).colors.WHITE };
|
|
obj3.icon = <PlusSmallIcon size="sm" color={guildId(576).colors.WHITE} />;
|
|
return jsx(tmp6(5027).Button, { text: null, onPress: null, onLongPress: null, accessibilityActions: null, onAccessibilityAction: null, icon: null });
|
|
}
|
|
PlusSmallIcon = application(8959).PlusSmallIcon;
|
|
tmp6 = application;
|
|
}
|
|
function OpenAppButton(profileApplication) {
|
|
profileApplication = profileApplication.profileApplication;
|
|
const botUserId = profileApplication.botUserId;
|
|
const channel = profileApplication.channel;
|
|
asyncGeneratorStep = undefined;
|
|
[obj.loading, asyncGeneratorStep] = noop.useState(false);
|
|
const items = [botUserId, channel, profileApplication.id];
|
|
const callback = noop.useCallback(asyncGeneratorStep(async (arg0, value) => {
|
|
if (c4 === 2) {
|
|
c4 = 3;
|
|
throw new TypeError("Generator functions may not be called on executing generators");
|
|
} else if (tmp4 === 3) {
|
|
if (arg0 === 1) {
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
let obj2 = { value, done: true };
|
|
return obj2;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c4 = 2;
|
|
if (0 === c3) {
|
|
if (arg0 === 1) {
|
|
c4 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c4 = 3;
|
|
let obj3 = { value, done: true };
|
|
return obj3;
|
|
} else {
|
|
dependencyMap = 0;
|
|
closure_129_0 = undefined;
|
|
closure_129_1 = undefined;
|
|
const obj4 = { type: "channel", channel };
|
|
const tmp43 = getSection(obj4, profileApplication.id);
|
|
closure_129_0 = tmp43;
|
|
const descriptor2 = tmp43.descriptor;
|
|
let application;
|
|
if (descriptor2 != null) {
|
|
application = descriptor2.application;
|
|
}
|
|
if (null == application) {
|
|
v2(true);
|
|
}
|
|
const descriptor = tmp43.descriptor;
|
|
let application1;
|
|
if (descriptor != null) {
|
|
application1 = descriptor.application;
|
|
}
|
|
closure_0 = application1;
|
|
if (application1 == null) {
|
|
c3 = 1;
|
|
c4 = 1;
|
|
const obj7 = { value: tmp2(7237).fetchApplication(tmp42.id), done: false };
|
|
return obj7;
|
|
} else {
|
|
closure_129_1 = closure_0;
|
|
closure_130_3(false);
|
|
if (null != closure_129_0) {
|
|
tmp2(4574).hideAllActionSheets();
|
|
const obj5 = tmp2(4574);
|
|
const obj8 = { recipientIds: closure_130_1 };
|
|
c3 = 2;
|
|
c4 = 1;
|
|
const obj10 = { value: tmp2(4620).openPrivateChannel(obj8), done: false };
|
|
return obj10;
|
|
} else {
|
|
c4 = 3;
|
|
}
|
|
}
|
|
tmp42 = profileApplication;
|
|
}
|
|
} else if (1 === tmp5) {
|
|
if (arg0 === 1) {
|
|
c4 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c4 = 3;
|
|
const obj11 = { value, done: true };
|
|
return obj11;
|
|
} else {
|
|
closure_0 = value;
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c4 = 3;
|
|
throw value;
|
|
} else if (arg0 !== 2) {
|
|
const _setTimeout = setTimeout;
|
|
const timerId = setTimeout(() => {
|
|
const bestActiveInput = closure_0(dependencyMap[21]).getBestActiveInput();
|
|
if (bestActiveInput != null) {
|
|
const obj2 = { type: closure_0(dependencyMap[22]).KeyboardTypes.APP_LAUNCHER, context: null };
|
|
const obj3 = { initialRouteName: constants2.APPLICATION_VIEW, initiallyExpanded: true, application, installOnDemand: null };
|
|
const isGuildInstalled = closure_1_0.isGuildInstalled;
|
|
let tmp5 = !isGuildInstalled;
|
|
if (!isGuildInstalled) {
|
|
tmp5 = !closure_1_0.isUserInstalled;
|
|
}
|
|
obj3.installOnDemand = tmp5;
|
|
obj2.context = obj3;
|
|
bestActiveInput.openCustomKeyboard(obj2);
|
|
}
|
|
}, 0);
|
|
const obj12 = { application_id: closure_129_1.id };
|
|
tmp2(1242).track(constants.APP_PROFILE_OPEN_APP_BUTTON_CLICKED, obj12);
|
|
const obj = tmp2(1242);
|
|
}
|
|
c4 = 3;
|
|
const obj13 = { value, done: true };
|
|
return obj13;
|
|
} catch (tmp35) {
|
|
c4 = tmp;
|
|
throw tmp35;
|
|
}
|
|
}
|
|
}), items);
|
|
let obj = { text: null, loading: null, onPress: null };
|
|
const intl = profileApplication(channel[16]).intl;
|
|
obj.text = intl.string(profileApplication(channel[16]).t["Cia+A8"]);
|
|
obj.onPress = callback;
|
|
return jsx(profileApplication(channel[17]).Button, { text: null, loading: null, onPress: null });
|
|
}
|
|
const getSection = fn(9382).getSection;
|
|
const AnalyticEvents = fn(1074).AnalyticEvents;
|
|
const AppLauncherRouteName = fn(1482).AppLauncherRouteName;
|
|
const jsx = fn(21).jsx;
|
|
const size = fn(2);
|
|
const result = size.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: application, botUserId, channel };
|
|
let tmp2 = <OpenAppButton profileApplication={application} botUserId={botUserId} channel={channel} />;
|
|
}
|
|
return tmp2;
|
|
}
|
|
tmp2 = <AddAppButton application={application} guildId={guildId} />;
|
|
};
|