Files
discord-decomp/sources/modules/user_profile/native/AddOrOpenAppButton.tsx
T
2026-07-27 16:20:00 +03:00

198 lines
10 KiB
TypeScript

/* Metro module 8868; source: modules/user_profile/native/AddOrOpenAppButton.tsx; dependencies: [5, 57, 31, 7861, 661, 1483, 33, 8869, 8870, 4080, 6797, 8809, 3856, 1471, 6249, 10083, 1244, 4578, 697, 6772, 4603, 4015, 1583, 683, 2] */
function _fun69132(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#69132, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9053:6, offset: 0x01c6a3d0, size: 262 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(5) /* metro dependency 5 */;
const env0_4 = importDefault(57) /* metro dependency 57 */;
const env0_5 = importAll(31) /* metro dependency 31 */;
const env0_6 = (require(7861) /* metro dependency 7861: ApplicationCommandIndexStore */).getSection;
const env0_7 = (require(661) /* metro dependency 661: Constants */).AnalyticEvents;
const env0_8 = (require(1483) /* metro dependency 1483: AppLauncherNativeConstants */).AppLauncherRouteName;
const env0_9 = (require(33) /* metro dependency 33 */).jsx;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/user_profile/native/AddOrOpenAppButton.tsx');
exports.default = AddOrOpenAppButton;
}
function AddAppButton({application, guildId}) { // fn#69133, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9053:217, offset: 0x01c6a4d6, size: 451 bytes, params: 2, frame: 24
var r6;
var defaultImport;
const binding = env0_5;
const useCallback = binding.useCallback;
let customInstallUrl = application.customInstallUrl;
const value2 = Reflect.apply(useCallback, binding, [_fun69134, [customInstallUrl, application.id,
application.installParams, application.integrationTypesConfig, guildId]]);
const value3 = env0_5.useCallback(_fun69135, [application]);
customInstallUrl = application.customInstallUrl;
if (customInstallUrl == null) {
r6 = (require(10083) /* metro dependency 10083: PlusSmallIcon */).PlusSmallIcon;
} else {
defaultImport = importDefault(1471) /* metro dependency 1471: URLUtils */;
r6 = defaultImport.isDiscordUrl(customInstallUrl) ? (require(10083) /* metro dependency 10083: PlusSmallIcon */).PlusSmallIcon : (require(6249) /* metro dependency 6249: LinkExternalSmallIcon */).LinkExternalSmallIcon;
}
const value4 = env0_5.useMemo(function() {
var object = {name: 'longpress'};
object.label = require(dependencyMap[16]).intl.string(require(dependencyMap[16]).t.XWDihq);
return [object];
}, []);
const value5 = env0_5.useCallback(_fun69137, [application]);
const Button = (require(4578) /* metro dependency 4578: ButtonNative */).Button;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const string = intl.string;
const NgXl3C = (require(1244) /* metro dependency 1244: indexNative */).t.NgXl3C;
const WHITE = (importDefault(697) /* metro dependency 697: native */).colors.WHITE;
return (
<Button
text={Reflect.apply(string, intl, [NgXl3C])}
onPress={value2}
onLongPress={value3}
accessibilityActions={value4}
onAccessibilityAction={value5}
icon={((Component) => <Component size="sm" color={WHITE} />)(r6)}
/>
);
}
function OpenAppButton({profileApplication, botUserId, channel}) { // fn#69138, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9053:1219, offset: 0x01c6a839, size: 238 bytes, params: 2, frame: 20
const [property, env0_3] = env0_4(env0_5.useState(false), 2);
const value5 = env0_5.useCallback(env0_3(_fun69140), [botUserId, channel, profileApplication.id]);
const Button = (require(4578) /* metro dependency 4578: ButtonNative */).Button;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
return (
<Button
text={intl.string((require(1244) /* metro dependency 1244: indexNative */).t['Cia+A8'])}
loading={property}
onPress={value5}
/>
);
}
function AddOrOpenAppButton({application, botUserId, channel, guildId}) { // fn#69142, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9053:2217, offset: 0x01c6ab49, size: 121 bytes, params: 2, frame: 19
return (importDefault(8869) /* metro dependency 8869: useIsAppDM */)(channel) && channel != null ? <OpenAppButton profileApplication={application} botUserId={botUserId} channel={channel} /> : <AddAppButton application={application} guildId={guildId} />;
}
function _fun69134() { // fn#69134, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9053:287, offset: 0x01c6a699, size: 123 bytes, params: 1, frame: 17
const value = environment.__proto__;
const applicationUtilsModule = require(8870) /* metro dependency 8870: ApplicationUtils */;
const installApplication = applicationUtilsModule.installApplication;
const applicationBinding = application;
Reflect.apply(installApplication, applicationUtilsModule, [{applicationId: applicationBinding.id,
customInstallUrl: applicationBinding.customInstallUrl, installParams: applicationBinding.installParams,
integrationTypesConfig: applicationBinding.integrationTypesConfig, guildId: guildId}]);
(importDefault(4080) /* metro dependency 4080: ActionSheetActionCreators */).hideActionSheet();
}
function _fun69135() { // fn#69135, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9053:580, offset: 0x01c6a714, size: 90 bytes, params: 1, frame: 16
let value = environment.__proto__;
value = require(6797) /* metro dependency 6797: ClipboardUtilsNative */;
const copy = value.copy;
const getApplicationInstallURLModule = require(8809) /* metro dependency 8809: getApplicationInstallURL */;
const getApplicationInstallURL = getApplicationInstallURLModule.getApplicationInstallURL;
Reflect.apply(copy, value, [Reflect.apply(getApplicationInstallURL, getApplicationInstallURLModule, [application])]);
(require(3856) /* metro dependency 3856: ToastUtils */).presentLinkCopied();
}
function _fun69137({nativeEvent}) { // fn#69137, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9053:891, offset: 0x01c6a7c4, size: 117 bytes, params: 2, frame: 16
var value;
var copy;
var moduleValue;
if (nativeEvent.actionName === 'longPress') {
value = environment.__proto__;
value = require(6797) /* metro dependency 6797: ClipboardUtilsNative */;
copy = value.copy;
moduleValue = require(8809) /* metro dependency 8809: getApplicationInstallURL */;
Reflect.apply(copy, value, [moduleValue.getApplicationInstallURL(application)]);
value = require(3856) /* metro dependency 3856: ToastUtils */;
value.presentLinkCopied();
}
}
function* _fun69140() { // fn#69140, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9053:1351, offset: 0x01c6a932, size: 367 bytes, params: 1, frame: 20
var r7;
var binding2;
var value10;
var value13;
var track;
var APP_PROFILE_OPEN_APP_BUTTON_CLICKED;
let value = undefined;
if (true) {
value = undefined;
var binding = env2_6;
var id = require.id;
var value5 = binding({type: 'channel', channel: dependencyMap}, id);
var descriptor = value5.descriptor;
var application = descriptor == null ? value : descriptor.application;
if (application == null) {
env1_3(true);
}
descriptor = value5.descriptor;
application = descriptor == null ? value : descriptor.application;
if (application != null) {
r7 = application;
env1_3(false);
if (value5 == null) {
return value;
}
binding = env2_1;
binding2 = env2_2;
binding(binding2[9]).hideActionSheet();
value10 = binding(binding2[20]);
yield value10.openPrivateChannel({recipientIds: importDefault});
if (false) {
return undefined;
}
global.setTimeout(_fun69141, 0);
binding = env2_1;
value13 = binding(env2_2[23]);
value13.track(env2_7.APP_PROFILE_OPEN_APP_BUTTON_CLICKED, {application_id: r7.id});
return value;
}
binding = env2_1;
var value6 = binding(env2_2[19]);
var fetchApplication = value6.fetchApplication;
id = require.id;
yield Reflect.apply(fetchApplication, value6, [id]);
var value7 = undefined;
if (false) {
return value7;
}
r7 = value7;
env1_3(false);
if (value5 == null) {
return value;
}
binding = env2_1;
binding2 = env2_2;
binding(binding2[9]).hideActionSheet();
value10 = binding(binding2[20]);
yield value10.openPrivateChannel({recipientIds: importDefault});
if (false) {
return undefined;
}
global.setTimeout(_fun69141, 0);
binding = env2_1;
value13 = binding(env2_2[23]);
track = value13.track;
APP_PROFILE_OPEN_APP_BUTTON_CLICKED = env2_7.APP_PROFILE_OPEN_APP_BUTTON_CLICKED;
id = r7.id;
Reflect.apply(track, value13, [APP_PROFILE_OPEN_APP_BUTTON_CLICKED, {application_id: id}]);
}
return value;
}
function _fun69141() { // fn#69141, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9053:1675, offset: 0x01c6aaa1, size: 168 bytes, params: 1, frame: 16
var openCustomKeyboard;
var object2;
const value = environment.__proto__.__proto__.__proto__;
const bestActiveInput = env3_0(env3_2[21]).getBestActiveInput();
if (bestActiveInput != null) {
openCustomKeyboard = bestActiveInput.openCustomKeyboard;
object2 = {};
object2.type = env3_0(env3_2[22]).KeyboardTypes.APP_LAUNCHER;
object2.context = {initialRouteName: env3_8.APPLICATION_VIEW, initiallyExpanded: true, application: env0_1,
installOnDemand: !env0_0.isGuildInstalled && !env0_0.isUserInstalled};
Reflect.apply(openCustomKeyboard, bestActiveInput, [object2]);
}
}