Files
discord-decomp/sources/components_native/channel_settings/ChannelSettingsInstantInvites.tsx
T
2026-07-28 01:06:53 +03:00

257 lines
13 KiB
TypeScript

/* Metro module 15183; source: components_native/channel_settings/ChannelSettingsInstantInvites.tsx; dependencies: [57, 31, 27, 8149, 1379, 661, 33, 4501, 697, 1585, 566, 8148, 12132, 1305, 12146, 12147, 1244, 5460, 15184, 8671, 2] */
import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import UseSafeAreaInsetsNative from '../../modules/safe_area/useSafeAreaInsets.native.tsx'; /* Metro dependency 1585 */
import ChannelSettingsStore from '../../stores/ChannelSettingsStore.tsx'; /* Metro dependency 8149 */
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 FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../../intl/index.native.tsx'; /* Metro dependency 1244 */
function _fun115996(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#115996, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15380:6, offset: 0x02477699, size: 359 bytes, params: 8, frame: 23
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = JsxRuntimeModule;
const env0_9 = value.jsx;
const env0_10 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object = {};
const object2 = {};
let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object2.paddingHorizontal = PX_16;
const BACKGROUND_BASE_LOWER = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWER;
object2.backgroundColor = BACKGROUND_BASE_LOWER;
object2.flex = 1;
object.content = object2;
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object.gap = {height: PX_16};
const env0_11 = Reflect.apply(createStyles, value, [object]);
(FileImportTrackerModule).fileFinishedImporting('components_native/channel_settings/ChannelSettingsInstantInvites.tsx');
exports.default = ConnectedChannelSettingsInstantInvites;
function ConnectedChannelSettingsInstantInvites() { // fn#115997, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15380:494, offset: 0x02477800, size: 845 bytes, params: 1, frame: 29
var r7;
var r1;
var r0;
var EmptyState;
const intl = (IndexNativeModule).intl;
const t = (IndexNativeModule).t;
var items2;
var value;
const styles = useStyles();
const bottom = (UseSafeAreaInsetsNative)().bottom;
const [property, env0_1] = Module00057(ReactModule.useState(undefined), 2);
const value4 = ReactModule.useCallback(_fun115998, [styles]);
const useStateFromStores = FluxModule.useStateFromStores;
const channelSettingsStoreBinding = ChannelSettingsStore;
const env0_2 = Reflect.apply(useStateFromStores, FluxModule, [[channelSettingsStoreBinding], function() {
return ChannelSettingsStore.getChannel();
}]);
const {invites, loading} = FluxModule.useStateFromStoresObject([channelSettingsStoreBinding], function() {
return ChannelSettingsStore.getInvites();
});
const value8 = ReactModule.useMemo(_fun116005, [ReactModule.useMemo(_fun116001, [invites]),
FluxModule.useStateFromStoresArray([ChannelStore], _fun116003)]);
items = [value8.length];
ReactModule.useEffect(function() {
importDefault(dependencyMap[11]).setSection(ChannelSettingsSections.INSTANT_INVITES);
}, []);
const value9 = ReactModule.useCallback(_fun116009, [value8]);
if (loading) {
if (loading) {
var viewBindingProps = {style: styles.content};
const SceneLoadingIndicator = (require(5460) /* metro dependency 5460: SceneLoadingIndicatorNative */).SceneLoadingIndicator;
items2 = [
<SceneLoadingIndicator />,
];
if (value8.length > 0) {
value = importDefault(15184) /* metro dependency 15184: InstantInviteSelfMeasurer */;
value = ((Component) => <Component item={value8[0]} onMeasured={value4} />)(value);
r7 = value;
} else {
r7 = null;
}
items2[1] = r7;
value = (
<View {...viewBindingProps}>
{items2}
</View>
);
r1 = value;
} else if (property == null) {
var viewBindingProps = {style: styles.content};
const SceneLoadingIndicator2 = (require(5460) /* metro dependency 5460: SceneLoadingIndicatorNative */).SceneLoadingIndicator;
items2 = [
<SceneLoadingIndicator2 />,
];
if (value8.length > 0) {
value = importDefault(15184) /* metro dependency 15184: InstantInviteSelfMeasurer */;
value = ((Component) => <Component item={value8[0]} onMeasured={value4} />)(value);
r7 = value;
} else {
r7 = null;
}
items2[1] = r7;
value = (
<View {...viewBindingProps}>
{items2}
</View>
);
r1 = value;
} else {
var viewBindingProps = {style: styles.content};
value = importDefault(8671) /* metro dependency 8671: FastestListAndroid */;
value = (
<View {...viewBindingProps}>
{((Component) => <Component sections={items} estimatedListSize="windowSize" itemSize={property} renderItem={value9} insetStart={styles.gap.height} insetEnd={bottom} />)(value)}
</View>
);
r1 = value;
}
r0 = r1;
} else if (value8.length !== 0) {
if (loading) {
var viewBindingProps = {style: styles.content};
const SceneLoadingIndicator3 = (require(5460) /* metro dependency 5460: SceneLoadingIndicatorNative */).SceneLoadingIndicator;
items2 = [
<SceneLoadingIndicator3 />,
];
if (value8.length > 0) {
value = importDefault(15184) /* metro dependency 15184: InstantInviteSelfMeasurer */;
value = ((Component) => <Component item={value8[0]} onMeasured={value4} />)(value);
r7 = value;
} else {
r7 = null;
}
items2[1] = r7;
value = (
<View {...viewBindingProps}>
{items2}
</View>
);
r1 = value;
} else if (property == null) {
var viewBindingProps = {style: styles.content};
const SceneLoadingIndicator4 = (require(5460) /* metro dependency 5460: SceneLoadingIndicatorNative */).SceneLoadingIndicator;
items2 = [
<SceneLoadingIndicator4 />,
];
if (value8.length > 0) {
value = importDefault(15184) /* metro dependency 15184: InstantInviteSelfMeasurer */;
value = ((Component) => <Component item={value8[0]} onMeasured={value4} />)(value);
r7 = value;
} else {
r7 = null;
}
items2[1] = r7;
value = (
<View {...viewBindingProps}>
{items2}
</View>
);
r1 = value;
} else {
var viewBindingProps = {style: styles.content};
value = importDefault(8671) /* metro dependency 8671: FastestListAndroid */;
value = (
<View {...viewBindingProps}>
{((Component) => <Component sections={items} estimatedListSize="windowSize" itemSize={property} renderItem={value9} insetStart={styles.gap.height} insetEnd={bottom} />)(value)}
</View>
);
r1 = value;
}
r0 = r1;
} else {
EmptyState = (require(1305) /* metro dependency 1305: native */).EmptyState;
r0 = (
<EmptyState
lightSource={importDefault(12146) /* metro dependency 12146 */}
darkSource={importDefault(12147) /* metro dependency 12147 */}
title={intl.string(t['+nLJkZ'])}
body={intl.string(t.F53CAc)}
/>
);
}
return r0;
function _fun115998(a0) { // fn#115998, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15380:634, offset: 0x02477b4d, size: 37 bytes, params: 2, frame: 11
env0_1(a0 + styles.gap.height);
}
function _fun116001() { // fn#116001, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15380:818, offset: 0x02477b97, size: 47 bytes, params: 1, frame: 11
const Object = global.Object;
return Object.values(invites).sort(function(a0, a1) {
var r2;
var property = a0.inviter;
var value = undefined;
r2 = property == null ? value : property.username;
var value2 = '';
var value3 = (r2 ?? value2).toLowerCase();
property = a1.inviter;
return value3.localeCompare(((property == null ? value : property.username) ?? value2).toLowerCase());
});
}
function _fun116003() { // fn#116003, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15380:1082, offset: 0x02477c34, size: 67 bytes, params: 1, frame: 12
var environment;
var r0;
var value2;
var channelStoreBinding;
var value;
if (channel != null) {
value2 = environment.__proto__;
channelStoreBinding = ChannelStore;
value = channelStoreBinding.getSortedLinkedChannelsForGuild(channel.guild_id);
value = value.filter(function({id}) {
return id === channel.id;
});
r0 = value;
} else {
r0 = [];
}
return r0;
}
function _fun116005() { // fn#116005, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15380:1183, offset: 0x02477c91, size: 69 bytes, params: 1, frame: 15
let binding = ReactModule;
const value2 = binding.map(function(a0) {
return {type: 'invite', data: a0};
});
const items2 = [];
const value3 = arraySpread(items2, value2, 0, binding);
binding = ReactNativeModule.View;
arraySpread(items2, binding.map(function(a0) {
return {type: 'channel', data: a0};
}), value3, binding);
return items2;
}
function _fun116009(a0, a1) { // fn#116009, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15380:1375, offset: 0x02477d2c, size: 130 bytes, params: 3, frame: 15
var r0;
var value;
const property = env0_6[a1];
if (property.type === 'invite') {
value = environment.__proto__;
value = importDefault(12132) /* metro dependency 12132: InstantInvite */;
value = ((Component) => <Component invite={property.data} />)(value);
r0 = value;
} else {
value = environment.__proto__;
const LinkedChannelInvite = (require(12132) /* metro dependency 12132: InstantInvite */).LinkedChannelInvite;
value = <LinkedChannelInvite channel={property.data} />;
r0 = value;
}
return r0;
}
}
}
global.__d(_fun115996, 15183, [57, 31, 27, 8149, 1379, 661, 33, 4501, 697, 1585, 566, 8148, 12132, 1305, 12146,
12147, 1244, 5460, 15184, 8671,
2]) /* metro module 15183, dependencies: [57, 31, 27, 8149, 1379, 661, 33, 4501, 697, 1585, 566, 8148, 12132, 1305, 12146, 12147, 1244, 5460, 15184, 8671, 2] */;