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

163 lines
12 KiB
TypeScript

/* Metro module 15340; source: modules/launchpad/native/shared/TextChannel.tsx; dependencies: [31, 27, 5071, 1949, 1379, 1309, 4865, 33, 4501, 15332, 697, 14436, 6860, 566, 4805, 9619, 13775, 5087, 4584, 15341, 6632, 11600, 10975, 3834, 15343, 8448, 14700, 15333, 5278, 15344, 15345, 15336, 15339, 2] */
import ChannelStore from '../../../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import LocaleStore from '../../../user_settings/LocaleStore.tsx'; /* Metro dependency 1949 */
import ActiveJoinedThreadsStore from '../../../threads/ActiveJoinedThreadsStore.tsx'; /* Metro dependency 5071 */
import UseChannelRoleSubscriptionStatus from '../../../guild_role_subscriptions/useChannelRoleSubscriptionStatus.tsx'; /* Metro dependency 6632 */
import UseEmbeddedAppsForChannel from '../../../activities/useEmbeddedAppsForChannel.tsx'; /* Metro dependency 11600 */
import RenderChannelPressableWrapper from './renderChannelPressableWrapper.tsx'; /* Metro dependency 15333 */
import UsePressUnderlayColor from '../../../main_tabs_v2/native/shared_components/util/usePressUnderlayColor.tsx'; /* Metro dependency 15341 */
import RenderChannelItem from './renderChannelItem.tsx'; /* Metro dependency 15345 */
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 FormConstantsModule from '../../../../design/void/Form/native/FormConstants.tsx'; /* Metro dependency 1309 */
import * as CreateStylesModule from '../../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
import * as UseFontScaleModule from '../../../screen/native/useFontScale.tsx'; /* Metro dependency 4584 */
import * as ReadStateConstantsModule from '../../../read_states/ReadStateConstants.tsx'; /* Metro dependency 4865 */
import * as SpoilerChannelUtilsModule from '../../../spoiler_channels/SpoilerChannelUtils.tsx'; /* Metro dependency 5087 */
import * as PressablesModule from '../../../../design/void/Pressables/native/Pressables.tsx'; /* Metro dependency 5278 */
import * as ThreadHooksModule from '../../../threads/ThreadHooks.tsx'; /* Metro dependency 6860 */
import * as ActivitiesInTextUtilsModule from '../../../activities/ActivitiesInTextUtils.tsx'; /* Metro dependency 8448 */
import * as ForumHooksModule from '../../../forums/ForumHooks.tsx'; /* Metro dependency 9619 */
import * as UseChannelUnreadBadgeStateModule from './useChannelUnreadBadgeState.tsx'; /* Metro dependency 14436 */
import * as UseTextChannelPressEventsModule from '../../../main_tabs_v2/native/shared_components/guild_channels/useTextChannelPressEvents.tsx'; /* Metro dependency 15344 */
import * as RenderChannelItemModule from './renderChannelItem.tsx'; /* Metro dependency 15345 */
function _fun117274(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#117274, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15537:6, offset: 0x024acabe, size: 307 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactModule;
const env0_12 = (CreateStylesModule).createStyles(_fun117275);
value = value.memo(TextChannel);
(FileImportTrackerModule).fileFinishedImporting('modules/launchpad/native/shared/TextChannel.tsx');
exports.default = value;
function _fun117275() { // fn#117275, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15537:258, offset: 0x024acbf1, size: 194 bytes, params: 1, frame: 15
const object = {};
const object2 = {'flex': 1, 'borderRadius': null, 'marginBottom': 1};
object2.borderRadius = (importDefault(15332) /* metro dependency 15332: getLayoutStyles */)().container.borderRadius;
object.pressable = object2;
const object3 = {'position': 'absolute', 'top': 0, 'bottom': 0, 'left': 0, 'right': 0, 'borderWidth': 1};
const BORDER_MUTED = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_MUTED;
object3.borderColor = BORDER_MUTED;
object3.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.md;
object.selectedBorder = object3;
const object4 = {};
object4.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.md;
const BACKGROUND_MOD_MUTED = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_MOD_MUTED;
object4.backgroundColor = BACKGROUND_MOD_MUTED;
object.rowSelected = object4;
return object;
}
function TextChannel({channel, subtitle, muted, navigationReplace, showGuildBadgeIcon, selected}) { // fn#117276, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15537:613, offset: 0x024accb3, size: 1341 bytes, params: 2, frame: 47
var r33;
var moduleValue9;
muted = !(muted === undefined) && muted;
navigationReplace = !(navigationReplace === undefined) && navigationReplace;
selected = !(selected === undefined) && selected;
const id = channel.id;
const isForumLikeChannel2 = channel.isForumLikeChannel();
const guild_id = channel.guild_id;
const {newChannel, optInEnabled, unread, resolvedUnreadSetting, mentionCount,
isMentionLowImportance} = (UseChannelUnreadBadgeStateModule).useChannelUnreadBadgeState(channel,
muted);
const styles = useStyles(muted, unread);
const useHasActiveThreads = ThreadHooksModule.useHasActiveThreads;
const hasActiveThreads = Reflect.apply(useHasActiveThreads, ThreadHooksModule, [channel]).hasActiveThreads;
let useStateFromStores = FluxModule.useStateFromStores;
const newThreadCount = Reflect.apply(useStateFromStores, FluxModule, [[ActiveJoinedThreadsStore], function() {
var activeJoinedThreadsStoreBinding = ActiveJoinedThreadsStore;
var channelBinding = channel;
return activeJoinedThreadsStoreBinding.getNewThreadCount(channelBinding.guild_id, channelBinding.id);
}]);
useStateFromStores = FluxModule.useStateFromStores;
const r34 = (importDefault(4805) /* metro dependency 4805: useChannelName */)(Reflect.apply(useStateFromStores,
FluxModule, [[ChannelStore], function() {
return ChannelStore.getChannel(channel.parent_id);
}])) ?? undefined;
const value9 = (ForumHooksModule).useUnreadThreadsCountForParent(channel.guild_id,
channel.id);
const value11 = (importDefault(13775) /* metro dependency 13775: useMessagePreviews */)(channel,
{unread: unread && !muted});
const value12 = (SpoilerChannelUtilsModule).useIsChannelSpoilerGated(channel);
const value13 = (UseFontScaleModule).useFontScale();
const locale = FluxModule.useStateFromStores([LocaleStore], function() {
return LocaleStore.locale;
});
const value14 = (UsePressUnderlayColor)();
const {isSubscriptionGated,
needSubscriptionToAccess} = (UseChannelRoleSubscriptionStatus)(channel.id);
const value16 = (UseEmbeddedAppsForChannel)(channel);
if (value11 == null) {
moduleValue9 = require(15343) /* metro dependency 15343: ChannelSubtitle */;
r33 = moduleValue9.renderChannelSubtitle({subtitle: subtitle, muted: muted, channelId: id, guildId: guild_id});
} else if (value12) {
moduleValue9 = require(15343) /* metro dependency 15343: ChannelSubtitle */;
r33 = moduleValue9.renderChannelSubtitle({subtitle: subtitle, muted: muted, channelId: id, guildId: guild_id});
} else {
const ChannelRowPreview = (require(10975) /* metro dependency 10975: ChannelRowPreview */).ChannelRowPreview;
r33 = (
<ChannelRowPreview
channel={channel}
message={value11}
color="text-muted"
muted={muted}
layout={(require(3834) /* metro dependency 3834: ChannelListLayoutTypes */).ChannelListLayoutTypes.COMPACT}
/>
);
}
const value19 = (ActivitiesInTextUtilsModule).useIsActivitiesInTextEnabled(channel.id);
const value21 = env0_3.useMemo(_fun117280, [value16.length > 0, value16]);
const defaultImport3 = RenderChannelPressableWrapper;
const PressableHighlight = (PressablesModule).PressableHighlight;
const pressableHighlightProps = {style: [styles.pressable, selected ? styles.rowSelected : undefined],
underlayColor: value14, androidRippleConfig: getThemedRippleConfig({color: value14})};
const useTextChannelPressEvents = UseTextChannelPressEventsModule.useTextChannelPressEvents;
copyDataProperties(pressableHighlightProps, Reflect.apply(useTextChannelPressEvents,
UseTextChannelPressEventsModule, [channel, navigationReplace]), undefined);
const getChannelAccessibilityProps = RenderChannelItemModule.getChannelAccessibilityProps;
copyDataProperties(pressableHighlightProps, Reflect.apply(getChannelAccessibilityProps, RenderChannelItemModule,
[{channel: channel, unread: unread, mentionCount: mentionCount}]), undefined);
const items2 = [
selected && <View style={styles.selectedBorder} pointerEvents="none" />,
];
const defaultImport4 = RenderChannelItem;
const object = {channel: channel, channelCategoryName: r34, subtitle: r33, hasActiveThreads: hasActiveThreads};
object.unreadBadge = ((Component) => <Component unread={unread} resolvedUnreadSetting={resolvedUnreadSetting} muted={muted} />)(importDefault(15336) /* metro dependency 15336: UnreadBadge */);
object.mentionBadge = (importDefault(15339) /* metro dependency 15339: renderChannelBadge */)({newChannel: newChannel && optInEnabled,
mentionCount: mentionCount, isMentionLowImportance: isMentionLowImportance,
postsWithUnreadsCount: isForumLikeChannel2 && value9 > 0 ? muted || resolvedUnreadSetting !== UnreadSetting.ALL_MESSAGES ? undefined : value9 : undefined,
newPostCount: isForumLikeChannel2 && value9 > 0 ? muted ? undefined : newThreadCount : undefined,
locale: locale});
object.unread = unread;
object.resolvedUnreadSetting = resolvedUnreadSetting;
object.mentionCount = mentionCount;
object.muted = muted;
object.channelName = (importDefault(4805) /* metro dependency 4805: useChannelName */)(channel);
object.fontScale = value13;
object.isSubscriptionGated = isSubscriptionGated;
object.needSubscriptionToAccess = needSubscriptionToAccess;
object.showGuildBadgeIcon = showGuildBadgeIcon;
object.end = value19 ? value21 : null;
items2[1] = defaultImport4(object);
return defaultImport3(<PressableHighlight {...pressableHighlightProps}>{items2}</PressableHighlight>);
function _fun117280() { // fn#117280, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15537:1764, offset: 0x024ad238, size: 60 bytes, params: 1, frame: 15
return (
env0_2
? ((Component) => <Component embeddedApps={env0_1} />)(importDefault(14700) /* metro dependency 14700: ChannelItemEmbeddedActivities */)
: null
);
}
}
}
global.__d(_fun117274, 15340, [31, 27, 5071, 1949, 1379, 1309, 4865, 33, 4501, 15332, 697, 14436, 6860, 566, 4805,
9619, 13775, 5087, 4584, 15341, 6632, 11600, 10975, 3834, 15343, 8448, 14700, 15333, 5278, 15344, 15345, 15336,
15339,
2]) /* metro module 15340, dependencies: [31, 27, 5071, 1949, 1379, 1309, 4865, 33, 4501, 15332, 697, 14436, 6860, 566, 4805, 9619, 13775, 5087, 4584, 15341, 6632, 11600, 10975, 3834, 15343, 8448, 14700, 15333, 5278, 15344, 15345, 15336, 15339, 2] */;