Files
2026-07-28 01:06:53 +03:00

219 lines
13 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] */
import Module00005 from '../../../by-id/module-00005.js'; /* Metro dependency 5 */
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
import Native from '../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
import ActionSheetActionCreators from '../../action_sheet/native/ActionSheetActionCreators.tsx'; /* Metro dependency 4080 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as AppLauncherNativeConstantsModule from '../../app_launcher/native/AppLauncherNativeConstants.tsx'; /* Metro dependency 1483 */
import * as ToastUtilsModule from '../../toast/native/ToastUtils.tsx'; /* Metro dependency 3856 */
import * as ButtonNativeModule from '../../../design/components/Button/native/Button.native.tsx'; /* Metro dependency 4578 */
import * as ApplicationCommandIndexStoreModule from '../../application_commands/ApplicationCommandIndexStore.tsx'; /* Metro dependency 7861 */
import * as GetApplicationInstallURLModule from '../../applications/getApplicationInstallURL.tsx'; /* Metro dependency 8809 */
import * as ApplicationUtilsModule from '../../../utils/native/ApplicationUtils.tsx'; /* Metro dependency 8870 */
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});
(FileImportTrackerModule).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 useCallback = ReactModule.useCallback;
let customInstallUrl = application.customInstallUrl;
const value2 = Reflect.apply(useCallback, ReactModule, [_fun69134, [customInstallUrl, application.id,
application.installParams, application.integrationTypesConfig, guildId]]);
const value3 = ReactModule.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 = ReactModule.useMemo(function() {
var object = {name: 'longpress'};
object.label = require(dependencyMap[16]).intl.string(require(dependencyMap[16]).t.XWDihq);
return [object];
}, []);
const value5 = ReactModule.useCallback(_fun69137, [application]);
const Button = (ButtonNativeModule).Button;
const intl = (IndexNativeModule).intl;
const string = intl.string;
const NgXl3C = (IndexNativeModule).t.NgXl3C;
const WHITE = (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 _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 installApplication = ApplicationUtilsModule.installApplication;
const applicationBinding = application;
Reflect.apply(installApplication, ApplicationUtilsModule, [{applicationId: applicationBinding.id,
customInstallUrl: applicationBinding.customInstallUrl, installParams: applicationBinding.installParams,
integrationTypesConfig: applicationBinding.integrationTypesConfig, guildId: guildId}]);
(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 getApplicationInstallURL = GetApplicationInstallURLModule.getApplicationInstallURL;
Reflect.apply(copy, value, [Reflect.apply(getApplicationInstallURL, GetApplicationInstallURLModule, [application])]);
(ToastUtilsModule).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 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] = Module00057(ReactModule.useState(false), 2);
const value5 = ReactModule.useCallback(env0_3(_fun69140), [botUserId, channel, profileApplication.id]);
const Button = (ButtonNativeModule).Button;
const intl = (IndexNativeModule).intl;
return (
<Button
text={intl.string((IndexNativeModule).t['Cia+A8'])}
loading={property}
onPress={value5}
/>
);
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 object;
const value = environment.__proto__.__proto__.__proto__;
const bestActiveInput = env3_0(env3_2[21]).getBestActiveInput();
if (bestActiveInput != null) {
openCustomKeyboard = bestActiveInput.openCustomKeyboard;
object = {};
object.type = env3_0(env3_2[22]).KeyboardTypes.APP_LAUNCHER;
object.context = {initialRouteName: env3_8.APPLICATION_VIEW, initiallyExpanded: true, application: env0_1,
installOnDemand: !env0_0.isGuildInstalled && !env0_0.isUserInstalled};
Reflect.apply(openCustomKeyboard, bestActiveInput, [object]);
}
}
}
}
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} />
)
);
}
}
global.__d(_fun69132, 8868, [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]) /* metro module 8868, 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] */;