Files
discord-decomp/sources/modules/activities/native/ActivityShareLinkModal.tsx
T
2026-07-28 01:06:53 +03:00

290 lines
18 KiB
TypeScript

/* Metro module 13034; source: modules/activities/native/ActivityShareLinkModal.tsx; dependencies: [5, 57, 31, 27, 1379, 1878, 1378, 7690, 4503, 33, 4501, 697, 566, 7232, 8809, 13033, 6777, 1360, 13035, 7067, 7076, 3857, 1244, 6797, 3856, 1478, 477, 5287, 9603, 5282, 5277, 4056, 7704, 9761, 9789, 2] */
import Module00005 from '../../../by-id/module-00005.js'; /* Metro dependency 5 */
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
import EmbeddedActivitiesStore from '../EmbeddedActivitiesStore.tsx'; /* Metro dependency 1378 */
import ChannelStore from '../../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import UseWindowDimensionsNative from '../../screen/useWindowDimensions.native.tsx'; /* Metro dependency 1478 */
import UserStore from '../../../stores/UserStore.tsx'; /* Metro dependency 1878 */
import UseGetOrFetchApplications from '../../applications/useGetOrFetchApplications.tsx'; /* Metro dependency 6777 */
import ThemedGradient from '../../client_themes/native/ThemedGradient.tsx'; /* Metro dependency 7704 */
import SearchableDestinationList from '../../share/native/SearchableDestinationList.tsx'; /* Metro dependency 9761 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
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 PlatformUtilsModule from '../../../utils/PlatformUtils.tsx'; /* Metro dependency 477 */
import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as ToastUtilsModule from '../../toast/native/ToastUtils.tsx'; /* Metro dependency 3856 */
import * as LinkIconModule from '../../../design/components/Icon/native/redesign/generated/LinkIcon.tsx'; /* Metro dependency 4056 */
import * as MessageConstantsModule from '../../messages/MessageConstants.tsx'; /* Metro dependency 4503 */
import * as HeaderActionButtonNativeModule from '../../../design/components/Navigator/native/HeaderActionButton.native.tsx'; /* Metro dependency 5277 */
import * as Module05287Module from '../../../by-id/module-05287.js'; /* Metro dependency 5287 */
import * as ClipboardUtilsNativeModule from '../../../utils/ClipboardUtils.native.tsx'; /* Metro dependency 6797 */
import * as UserRowConstantsModule from '../../main_tabs_v2/native/shared_components/user_list/UserRowConstants.tsx'; /* Metro dependency 7690 */
import * as GetApplicationInstallURLModule from '../../applications/getApplicationInstallURL.tsx'; /* Metro dependency 8809 */
import * as HeaderSharedModule from '../../main_tabs_v2/native/shared_components/HeaderShared.tsx'; /* Metro dependency 9603 */
import * as ModalFloatingActionNativeModule from '../../../design/components/Modal/native/ModalFloatingAction.native.tsx'; /* Metro dependency 9789 */
import * as OpenActivityShareLinkModalNativeModule from '../openActivityShareLinkModal.native.tsx'; /* Metro dependency 13033 */
function _fun99485(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#99485, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13224:6, offset: 0x021ca902, size: 465 bytes, params: 8, frame: 22
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = JsxRuntimeModule;
const env0_12 = value.jsx;
const env0_13 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object = {};
const object2 = {};
const PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object2.paddingHorizontal = PX_16;
const PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object2.paddingVertical = PX_8;
let BACKGROUND_BASE_LOWER = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWER;
object2.backgroundColor = BACKGROUND_BASE_LOWER;
object.headerContainer = object2;
object.header = {'borderBottomWidth': 0, 'shadowColor': 'transparent', 'backgroundColor': 'transparent'};
BACKGROUND_BASE_LOWER = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWER;
object.container = {'flex': 1, 'display': 'flex', backgroundColor: BACKGROUND_BASE_LOWER};
const env0_14 = Reflect.apply(createStyles, value, [object]);
(FileImportTrackerModule).fileFinishedImporting('modules/activities/native/ActivityShareLinkModal.tsx');
exports.default = ActivityShareLinkModal;
function ActivityShareLinkModal({applicationId, customId, linkId, message, onShare}) { // fn#99486, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13224:695, offset: 0x021caad3, size: 1220 bytes, params: 2, frame: 36
const message2 = message;
const onShare2 = onShare;
const styles = useStyles();
const connectedActivityChannelId = (require(566) /* metro dependency 566: flux */).useStateFromStores([EmbeddedActivitiesStore],
function() {
return EmbeddedActivitiesStore.getConnectedActivityChannelId();
});
const binding = connectedActivityChannelId;
const value3 = binding.useMemo(_fun99488, [connectedActivityChannelId]);
let useState = binding.useState;
const value4 = Reflect.apply(useState, binding, [false]);
const binding2 = onShare2;
const value5 = binding2(value4, 2);
const property = value5[0];
const env0_6 = value5[1];
useState = binding.useState;
const value7 = binding2(Reflect.apply(useState, binding, [false]), 2);
const property2 = value7[0];
const env0_8 = value7[1];
useState = binding.useState;
const value8 = binding2(Reflect.apply(useState, binding, [[]]), 2);
const property3 = value8[0];
const env0_10 = value8[1];
const length = property3.length;
const value9 = binding.useCallback(_fun99489, []);
const currentUser = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserStore], function() {
return UserStore.getCurrentUser();
});
useState = binding.useState;
const value10 = binding2(Reflect.apply(useState, binding, ['']), 2);
const property4 = value10[0];
binding.useEffect(_fun99491, [applicationId, currentUser, customId, linkId, value10[1]]);
const value11 = binding.useCallback(_fun99492, [property2, onShare]);
const value13 = binding.useCallback(message2(_fun99494),
[binding2((UseGetOrFetchApplications)([applicationId]), 1)[0],
property2, property4, message, onShare, property3]);
const env0_15 = binding.useCallback(_fun99499, [property4]);
const value14 = binding.useMemo(_fun99500,
[(UseWindowDimensionsNative)({ignoreKeyboard: true}).height]);
const Header = (Module05287Module).Header;
const headerProps = {headerStyle: styles.header};
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
headerProps.title = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.r9qKow);
headerProps.headerTitle = headerTitle_99501;
headerProps.headerLeft = (require(5282) /* metro dependency 5282: NavigatorHeaderNative */).getHeaderCloseButton(value11);
headerProps.headerRight = headerRight_99502;
headerProps.headerStatusBarHeight = PlatformUtilsModule.isIOS() ? 0 : undefined;
headerProps.headerTitleAlign = 'center';
const view = (
<View style={styles.headerContainer}>
<Header {...headerProps} />
</View>
);
const viewBinding2Props = {style: styles.container};
const items2 = [
((Component) => <Component absolute />)(ThemedGradient),
];
const TOGGLE = UserRowModes.TOGGLE;
items2[1] = (
<SearchableDestinationList
disableGradient
disableStickySections
initialSelectedDestinations={[]}
insetEnd={0}
onSelectedDestinationChange={value9}
originDestination={value3}
rowMode={TOGGLE}
/>
);
const ModalFloatingAction = (ModalFloatingActionNativeModule).ModalFloatingAction;
items2[2] = (
<ModalFloatingAction
disabled={property}
floatingBackgroundColor={styles.container.backgroundColor}
isVisible={length > 0}
loading={property}
onPress={property ? undefined : value13}
text={length === 1 ? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.TXNS7S) : intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.jWtYUm,
{count: length})}
/>
);
return (
<View style={value14}>
{view}
<View {...viewBinding2Props}>
{items2}
</View>
</View>
);
function _fun99488() { // fn#99488, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13224:884, offset: 0x021cafaa, size: 60 bytes, params: 1, frame: 14
var r0;
var value3;
var moduleValue;
if (connectedActivityChannelId != null) {
value3 = environment.__proto__;
moduleValue = require(7232) /* metro dependency 7232: formatResults */;
r0 = moduleValue.getDestinationIdFromChannelId(connectedActivityChannelId);
} else {
r0 = undefined;
}
return r0;
}
function _fun99489(a0) { // fn#99489, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13224:1099, offset: 0x02094ab3, size: 19 bytes, params: 2, frame: 11
env0_10(a0);
}
function _fun99491() { // fn#99491, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13224:1227, offset: 0x021cafe6, size: 107 bytes, params: 1, frame: 16
const binding = env0_13;
const value3 = undefined;
const getActivityLaunchURL = GetApplicationInstallURLModule.getActivityLaunchURL;
binding(Reflect.apply(getActivityLaunchURL, GetApplicationInstallURLModule, [{applicationId: applicationId,
referrerId: currentUser == null ? value3 : currentUser.id, customId: customId, linkId: linkId}]));
return value3;
}
function _fun99492() { // fn#99492, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13224:1371, offset: 0x021cb051, size: 56 bytes, params: 1, frame: 13
onShare(false, env0_7);
const value = environment.__proto__;
(OpenActivityShareLinkModalNativeModule).closeActivityShareLinkModal();
}
function* _fun99494() { // fn#99494, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13224:1479, offset: 0x021cb094, size: 368 bytes, params: 1, frame: 25
var environment;
if (true) {
var env0_0;
value = environment.__proto__;
if (useStyles != null) {
var Promise = global.Promise;
var all = Promise.all;
var embeddedActivitiesStoreBinding = EmbeddedActivitiesStore;
var map = embeddedActivitiesStoreBinding.map;
var binding = env2_0;
var getOrResolveChannelIdFromDestinationId = binding(env2_2[13]).getOrResolveChannelIdFromDestinationId;
yield Reflect.apply(all, Promise, [Reflect.apply(map, embeddedActivitiesStoreBinding,
[getOrResolveChannelIdFromDestinationId])]);
var value4 = undefined;
if (false) {
return value4;
}
var filter = value4.filter;
binding = env2_0;
var binding2 = env2_2;
var value6 = Reflect.apply(filter, value4, [binding(binding2[17]).isNotNullish]);
var value7 = binding(binding2[18]);
env0_0 = value7.resolveActivityShareMessageContent(env1_3, useStyles, env1_12);
View(true);
value6.forEach(_fun99495());
var value8 = env2_1(binding2[21]);
var open = value8.open;
var intl = binding(binding2[22]).intl;
Reflect.apply(open, value8, [{key: 'ACTIVITY_SHARE_LINK_SUCCESS',
content: intl.formatToPlainString(binding(binding2[22]).t.jQULqL, {applicationName: useStyles.name})}]);
env1_4(true, ChannelStore);
binding(binding2[15]).closeActivityShareLinkModal();
}
}
function _fun99495() { // fn#99495, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13224:1684, offset: 0x021cb204, size: 36 bytes, params: 1, frame: 12
const env0_0 = env3_3(_fun99497);
return _fun99498;
function* _fun99497(a0) { // fn#99497, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13224:1704, offset: 0x021cb233, size: 147 bytes, params: 2, frame: 21
if (true) {
value = environment.__proto__.__proto__.__proto__.__proto__.__proto__;
var binding = env5_7;
var channel = binding.getChannel(a0);
if (channel != null) {
binding = env5_1;
var binding2 = env5_2;
var value4 = binding(binding2[19]);
var sendMessage = value4.sendMessage;
var value5 = binding(binding2[20]);
var value7 = value5.parse(channel, applicationId);
var ACTIVITY_SHARE = env5_11.ACTIVITY_SHARE;
yield Reflect.apply(sendMessage, value4, [a0, value7, false, {location: ACTIVITY_SHARE}]);
if (false) {
return undefined;
}
}
}
}
function _fun99498() { // fn#99498, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13224:1841, offset: 0x00c3945f, size: 30 bytes, params: 1, frame: 13
return env0_0.apply(this, arguments);
}
}
}
function _fun99499() { // fn#99499, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13224:2108, offset: 0x021cb2c6, size: 78 bytes, params: 1, frame: 15
const value = environment.__proto__;
(ClipboardUtilsNativeModule).copy(env0_12);
env0_8(true);
(ToastUtilsModule).presentLinkCopied();
}
function _fun99500() { // fn#99500, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13224:2224, offset: 0x021cb314, size: 59 bytes, params: 1, frame: 12
let value = environment.__proto__;
value = require(477) /* metro dependency 477: PlatformUtils */;
value = value.isAndroid();
return {height: value ? height : '100%'};
}
function ActivityShareLinkModalHeaderTitle({children}) { // fn#99501, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13224:2441, owner: ActivityShareLinkModal.headerTitle, offset: 0x021cb34f, size: 79 bytes, params: 2, frame: 14
const GenericHeaderTitle = (HeaderSharedModule).GenericHeaderTitle;
return (
<GenericHeaderTitle
title={children}
subtitle={message}
variant="redesign/heading-18/bold"
/>
);
}
function ActivityShareLinkModalHeaderRight(a0) { // fn#99502, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13224:2600, owner: ActivityShareLinkModal.headerRight, offset: 0x021cb39e, size: 154 bytes, params: 2, frame: 18
const value = environment.__proto__;
const HeaderActionButton = (HeaderActionButtonNativeModule).HeaderActionButton;
const headerActionButtonProps = {...a0};
headerActionButtonProps['onPress'] = env0_15;
const intl = (IndexNativeModule).intl;
const string = intl.string;
const Xrt5Po = (IndexNativeModule).t.Xrt5Po;
headerActionButtonProps['accessibilityLabel'] = Reflect.apply(string, intl, [Xrt5Po]);
const LinkIcon = (LinkIconModule).LinkIcon;
headerActionButtonProps['IconComponent'] = LinkIcon;
return <HeaderActionButton {...headerActionButtonProps} />;
}
}
}
global.__d(_fun99485, 13034, [5, 57, 31, 27, 1379, 1878, 1378, 7690, 4503, 33, 4501, 697, 566, 7232, 8809, 13033,
6777, 1360, 13035, 7067, 7076, 3857, 1244, 6797, 3856, 1478, 477, 5287, 9603, 5282, 5277, 4056, 7704, 9761,
9789,
2]) /* metro module 13034, dependencies: [5, 57, 31, 27, 1379, 1878, 1378, 7690, 4503, 33, 4501, 697, 566, 7232, 8809, 13033, 6777, 1360, 13035, 7067, 7076, 3857, 1244, 6797, 3856, 1478, 477, 5287, 9603, 5282, 5277, 4056, 7704, 9761, 9789, 2] */;