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

383 lines
22 KiB
TypeScript

/* Metro module 15324; source: modules/launchpad/native/LaunchPadUnreadServers.tsx; dependencies: [31, 27, 1379, 4605, 1878, 661, 33, 4501, 697, 6947, 15325, 566, 1305, 9719, 5475, 10254, 4603, 4601, 9608, 14532, 1357, 1478, 15330, 1244, 8140, 2] */
import MobileVisualRefreshExperiment from '../../themes/experiments/MobileVisualRefreshExperiment.tsx'; /* Metro dependency 1357 */
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 ReadStateStore from '../../../stores/ReadStateStore.tsx'; /* Metro dependency 4605 */
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 ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as CreateStylesModule from '../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
import * as TransitionToGuildNativeModule from '../../routing/transitionToGuild.native.tsx'; /* Metro dependency 6947 */
import * as FastListModule from '../../../lib/native/FastList.tsx'; /* Metro dependency 8140 */
function _fun117189(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#117189, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15521:6, offset: 0x024a78e6, size: 579 bytes, params: 8, frame: 23
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactModule;
const createStyles = CreateStylesModule.createStyles;
object = {};
object.listWrapper = {marginTop: 8};
object.list = {'marginBottom': 4, 'flexShrink': 0};
const BACKGROUND_BASE_LOW = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOW;
object.maskStrokeStyle = {backgroundColor: BACKGROUND_BASE_LOW};
object.privateChannelWrapper = {'position': 'relative', 'paddingVertical': 2, 'justifyContent': 'center',
'alignItems': 'center'};
object.privateChannelIcon = {'width': 48, 'height': 48, 'borderRadius': 24, 'overflow': 'hidden'};
object.badgeWrapper = {'position': 'absolute', 'top': '50%', 'left': '50%', 'marginLeft': 6, 'marginTop': 6};
object.guildWrapper = {'paddingVertical': 2, 'justifyContent': 'center', 'alignItems': 'center'};
object.guildHistorySeparatorWrapper = {'flex': 1, 'justifyContent': 'center', 'alignItems': 'center'};
const object4 = {'width': 2, 'height': 32};
object4.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
const BACKGROUND_MOD_STRONG = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_MOD_STRONG;
object4.backgroundColor = BACKGROUND_MOD_STRONG;
object.guildHistorySeparator = object4;
const env0_12 = Reflect.apply(createStyles, CreateStylesModule, [object]);
const env0_13 = value.memo(GuildItemInner);
const env0_14 = value.memo(PrivateChannelItemInner);
value = value.memo(LaunchPadUnreadServers);
(FileImportTrackerModule).fileFinishedImporting('modules/launchpad/native/LaunchPadUnreadServers.tsx');
exports.default = value;
function HistorySeparator() { // fn#117190, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15521:2345, offset: 0x024a7b29, size: 71 bytes, params: 1, frame: 17
const styles = useStyles();
return (
<View style={styles.guildHistorySeparatorWrapper}>
<View style={styles.guildHistorySeparator} />
</View>
);
}
function renderHistorySection() { // fn#117191, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15521:2480, offset: 0x024a7b70, size: 23 bytes, params: 1, frame: 13
return <HistorySeparator />;
}
function GuildItemInner({guildId, selected, onGuildSelect}) { // fn#117192, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15521:937, offset: 0x024a7b87, size: 212 bytes, params: 2, frame: 22
const styles = useStyles();
const binding = env0_3;
return (
<View style={styles.guildWrapper}>
{((Component) => <Component size={48} borderRadius={16} guildId={guildId} selected={selected} onPress={binding.useCallback(function() {
onGuildSelect(guildId);
}, [guildId, onGuildSelect])} onLongPress={binding.useCallback(_fun117194,
[guildId])} backgroundColor={styles.maskStrokeStyle.backgroundColor} />)(importDefault(15325) /* metro dependency 15325: SimpleGuild */)}
</View>
);
function _fun117194() { // fn#117194, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15521:1064, offset: 0x024a7c5b, size: 45 bytes, params: 1, frame: 12
let value = environment.__proto__;
value = require(6947) /* metro dependency 6947: transitionToGuildNative */;
value.transitionToGuild(guildId);
}
}
function PrivateChannelItemInner({channelId}) { // fn#117195, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15521:1299, offset: 0x024a7c88, size: 669 bytes, params: 2, frame: 26
var r0;
var items2;
var value10;
var value;
const styles = useStyles();
const channel = (require(566) /* metro dependency 566: flux */).useStateFromStores([ChannelStore], function() {
return ChannelStore.getChannel(channelId);
});
const value3 = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserStore], _fun117197);
const value4 = (require(566) /* metro dependency 566: flux */).useStateFromStores([ReadStateStore], _fun117198);
const type = channel?.type;
const DM = ChannelTypes.DM;
let r6 = (
type !== DM
? (
channel == null
? (
channel != null
? ((Component) => <Component style={[styles.privateChannelIcon]} source={(require(10254) /* metro dependency 10254: getChannelIcon */).getChannelIconSource(channel)} />)(importDefault(5475) /* metro dependency 5475: FastImage */)
: undefined
)
: (
channel.isGroupDM()
? ((Component) => <Component channel={channel} size={(require(1305) /* metro dependency 1305: native */).AvatarSizes.LARGE_48} />)(importDefault(9719) /* metro dependency 9719: GroupDMAvatar */)
: (
channel != null
? ((Component) => <Component style={[styles.privateChannelIcon]} source={(require(10254) /* metro dependency 10254: getChannelIcon */).getChannelIconSource(channel)} />)(importDefault(5475) /* metro dependency 5475: FastImage */)
: undefined
)
)
)
: (
value3 != null
? ((Avatar) => <Avatar style={styles.privateChannelIcon} user={value3} guildId={undefined} size={(require(1305) /* metro dependency 1305: native */).AvatarSizes.LARGE_48} />)((require(1305) /* metro dependency 1305: native */).Avatar)
: (
channel == null
? (
channel != null
? ((Component) => <Component style={[styles.privateChannelIcon]} source={(require(10254) /* metro dependency 10254: getChannelIcon */).getChannelIconSource(channel)} />)(importDefault(5475) /* metro dependency 5475: FastImage */)
: undefined
)
: (
channel.isGroupDM()
? ((Component) => <Component channel={channel} size={(require(1305) /* metro dependency 1305: native */).AvatarSizes.LARGE_48} />)(importDefault(9719) /* metro dependency 9719: GroupDMAvatar */)
: (
channel != null
? ((Component) => <Component style={[styles.privateChannelIcon]} source={(require(10254) /* metro dependency 10254: getChannelIcon */).getChannelIconSource(channel)} />)(importDefault(5475) /* metro dependency 5475: FastImage */)
: undefined
)
)
)
)
);
const binding = env0_3;
const useCallback = binding.useCallback;
if (channel != null) {
var pressableBindingProps = {onPress: Reflect.apply(useCallback, binding, [_fun117199, [value3, channel]]),
style: styles.privateChannelWrapper, accessibilityRole: 'button', accessible: true};
items2 = [r6];
value10 = value4 > 0;
if (value10) {
var viewBindingProps = {style: styles.badgeWrapper};
value = importDefault(9608) /* metro dependency 9608: MaskedBadge */;
value = (
<View {...viewBindingProps}>
{((Component) => <Component value={value4} unread backgroundColor={styles.maskStrokeStyle.backgroundColor} />)(value)}
</View>
);
r6 = value;
} else {
r6 = value10;
}
items2[1] = r6;
value = (
<Pressable {...pressableBindingProps}>
{items2}
</Pressable>
);
r0 = value;
} else {
r0 = null;
}
return r0;
function _fun117197() { // fn#117197, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15521:1451, offset: 0x024a7f25, size: 71 bytes, params: 1, frame: 13
return channel != null && channel.isPrivate() ? UserStore.getUser(channel.getRecipientId()) : undefined;
}
function _fun117198() { // fn#117198, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15521:1552, offset: 0x024a7f6c, size: 47 bytes, params: 1, frame: 12
return channel != null ? ReadStateStore.getMentionCount(channel.id) : 0;
}
function _fun117199() { // fn#117199, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15521:1940, offset: 0x024a7f9b, size: 165 bytes, params: 1, frame: 16
var type;
var value2;
var moduleValue;
if (channel != null) {
type = channel.type;
value2 = environment.__proto__;
if (type !== ChannelTypes.DM) {
moduleValue = require(4601) /* metro dependency 4601: transitionToChannel */;
moduleValue.transitionToChannel(channel.id, {navigationReplace: true});
} else if (env0_2 != null) {
(importDefault(4603) /* metro dependency 4603: ChannelActionCreators */).openPrivateChannel({recipientIds: [env0_2.id]});
} else {
moduleValue = require(4601) /* metro dependency 4601: transitionToChannel */;
moduleValue.transitionToChannel(channel.id, {navigationReplace: true});
}
}
}
}
function LaunchPadUnreadServers({selectedGuildId, setSelectedGuild, unreadPrivateChannelIds, unreadGuilds, guildHistory, visible}) { // fn#117200, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15521:2556, offset: 0x024a8040, size: 742 bytes, params: 2, frame: 35
var r0;
var moduleValue2;
var renderCategoryItem;
const intl = (IndexNativeModule).intl;
var string;
const t = (IndexNativeModule).t;
var items3;
const AnimatedFastList = (FastListModule).AnimatedFastList;
var items2;
const unreadGuilds2 = unreadGuilds;
const styles = useStyles();
const value2 = (require(14532) /* metro dependency 14532: RedesignCategory */).useCategoryStyles();
const value3 = (MobileVisualRefreshExperiment)('LaunchPadUnreadServers');
const width = (UseWindowDimensionsNative)().width;
const binding = unreadGuilds2;
const env0_6 = binding.useRef(-1);
let useCallback = binding.useCallback;
const value4 = Reflect.apply(useCallback, binding, [_fun117201, [setSelectedGuild, selectedGuildId]]);
binding.useEffect(function() {
return _fun117204;
}, []);
const value6 = binding.useRef(null);
binding.useEffect(_fun117205, [visible]);
const value7 = binding.useCallback(_fun117206, [unreadGuilds, unreadPrivateChannelIds, selectedGuildId, value4,
guildHistory]);
useCallback = binding.useCallback;
let length = unreadGuilds.length;
const value8 = Reflect.apply(useCallback, binding, [function(a0) {
var value = 0;
return a0 !== 2 ? value : guildHistory.length > value && (unreadPrivateChannelIds.length > value || unreadGuilds.length > value) ? 10 : value;
}, [length, unreadPrivateChannelIds.length, guildHistory.length]]);
let r20 = unreadGuilds.length > 0 || unreadPrivateChannelIds.length > 0;
if (r20) {
var viewBindingProps = {style: styles.listWrapper};
moduleValue2 = require(14532) /* metro dependency 14532: RedesignCategory */;
renderCategoryItem = moduleValue2.renderCategoryItem;
string = intl.string;
r20 = r20 ? Reflect.apply(string, intl, [t.xSY9BH]) : Reflect.apply(string, intl, [t.kCt2zG]);
items3 = [Reflect.apply(renderCategoryItem, moduleValue2, [{name: r20, styles: value2,
isRefreshEnabled: value3}])];
var animatedFastListProps = {ref: value6, style: styles.list, horizontal: true, renderItem: value7,
renderSection: renderHistorySection, sectionSize: value8};
length = unreadPrivateChannelIds.length;
items2 = [length];
length = unreadGuilds.length;
items2[1] = length;
length = guildHistory.length;
items2[2] = length;
animatedFastListProps.sections = items2;
animatedFastListProps.itemSize = 58;
animatedFastListProps.headerSize = 19;
animatedFastListProps.footerSize = 19;
animatedFastListProps.chunkBase = width;
animatedFastListProps.showsHorizontalScrollIndicator = false;
animatedFastListProps.showsVerticalScrollIndicator = false;
animatedFastListProps.stickySectionsVariant = 'disabled';
animatedFastListProps.keyboardShouldPersistTaps = 'always';
items3[1] = <AnimatedFastList {...animatedFastListProps} />;
r0 = (
<View {...viewBindingProps}>
{items3}
</View>
);
} else {
length = guildHistory.length;
if (length > 0) {
var viewBindingProps = {style: styles.listWrapper};
moduleValue2 = require(14532) /* metro dependency 14532: RedesignCategory */;
renderCategoryItem = moduleValue2.renderCategoryItem;
string = intl.string;
r20 = r20 ? Reflect.apply(string, intl, [t.xSY9BH]) : Reflect.apply(string, intl, [t.kCt2zG]);
items3 = [Reflect.apply(renderCategoryItem, moduleValue2, [{name: r20, styles: value2,
isRefreshEnabled: value3}])];
var animatedFastListProps = {ref: value6, style: styles.list, horizontal: true, renderItem: value7,
renderSection: renderHistorySection, sectionSize: value8};
length = unreadPrivateChannelIds.length;
items2 = [length];
length = unreadGuilds.length;
items2[1] = length;
length = guildHistory.length;
items2[2] = length;
animatedFastListProps.sections = items2;
animatedFastListProps.itemSize = 58;
animatedFastListProps.headerSize = 19;
animatedFastListProps.footerSize = 19;
animatedFastListProps.chunkBase = width;
animatedFastListProps.showsHorizontalScrollIndicator = false;
animatedFastListProps.showsVerticalScrollIndicator = false;
animatedFastListProps.stickySectionsVariant = 'disabled';
animatedFastListProps.keyboardShouldPersistTaps = 'always';
items3[1] = <AnimatedFastList {...animatedFastListProps} />;
r0 = (
<View {...viewBindingProps}>
{items3}
</View>
);
} else {
r0 = null;
}
}
return r0;
function _fun117201(a0) { // fn#117201, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15521:2823, offset: 0x024a8326, size: 191 bytes, params: 2, frame: 16
var environment;
var binding;
var clearTimeout;
var value5;
const value = a0;
if (env0_6.current >= 0) {
clearTimeout = global.clearTimeout;
binding = env0_6;
clearTimeout(binding.current);
binding.current = -1;
value5 = environment.__proto__;
} else {
var value4 = undefined;
if ((importDefault(15330) /* metro dependency 15330: isGuildSelectable */)(value)) {
setSelectedGuild(value === selectedGuildId ? value4 : value);
env0_6.current = global.setTimeout(_fun117202, 400);
return value4;
}
clearTimeout = global.clearTimeout;
binding = env0_6;
clearTimeout(binding.current);
binding.current = -1;
}
(TransitionToGuildNativeModule).transitionToGuild(value);
function _fun117202() { // fn#117202, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15521:2975, offset: 0x024a83e5, size: 41 bytes, params: 1, frame: 12
const clearTimeout = global.clearTimeout;
const binding = env1_6;
clearTimeout(binding.current);
binding.current = -1;
}
}
function _fun117203() { // fn#117203, offset: 0x024a840e, size: 11 bytes, params: 1, frame: 1
return _fun117204;
function _fun117204() { // fn#117204, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15521:3050, offset: 0x01e0a746, size: 29 bytes, params: 1, frame: 11
return global.clearTimeout(env1_6.current);
}
}
function _fun117205() { // fn#117205, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15521:3117, offset: 0x024a8419, size: 42 bytes, params: 1, frame: 11
var current;
if (visible) {
current = env0_8.current;
if (current != null) {
current.scrollToTop(false);
}
}
}
function _fun117206(a0, a1) { // fn#117206, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15521:3200, offset: 0x024a8443, size: 159 bytes, params: 3, frame: 17
var r7;
var r0;
var value;
var property;
if (a0 === 0) {
property = unreadPrivateChannelIds[a1];
value = property != null;
if (value) {
value = environment.__proto__;
value = ((Component) => <Component channelId={property} />)(env1_14);
r0 = value;
} else {
r0 = value;
}
return r0;
}
if (a0 >= 1) {
r7 = a0 === 1 ? unreadGuilds[a1] : guildHistory[a1];
value = r7 != null;
if (value) {
value = environment.__proto__;
value = ((Component) => <Component guildId={r7} selected={selectedGuildId === r7} onGuildSelect={env0_7} />)(env1_13);
r0 = value;
} else {
r0 = value;
}
return r0;
}
return null;
}
}
}
global.__d(_fun117189, 15324, [31, 27, 1379, 4605, 1878, 661, 33, 4501, 697, 6947, 15325, 566, 1305, 9719, 5475,
10254, 4603, 4601, 9608, 14532, 1357, 1478, 15330, 1244, 8140,
2]) /* metro module 15324, dependencies: [31, 27, 1379, 4605, 1878, 661, 33, 4501, 697, 6947, 15325, 566, 1305, 9719, 5475, 10254, 4603, 4601, 9608, 14532, 1357, 1478, 15330, 1244, 8140, 2] */;