This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

+198
View File
@@ -0,0 +1,198 @@
// Metro module 12759 (f12760).
import ChannelStore from "../../stores/ChannelStore";
import SelectedGuildStore from "../../stores/SelectedGuildStore";
import { isGuildHomeChannel } from "../channel/ChannelConstants";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import Module12 from "../../_bundle/Module12";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c8791_5, c8791_6, c8791_7, c8791_8, c8791_9;
const truncateOldMessageData = function truncateOldMessageData(a0) {
const r10 = c8791_7[a0];
if (r10 != null) {
let c20198_0 = SnowflakeUtils.fromTimestamp(Date.now() - c8791_5);
const r23 = Module12.findIndex(r10, (a0) => SnowflakeUtils.compare(a0.id, c20198_0) > 0);
if (r23 === -1) {
c8791_7[a0] = [];
} else {
c8791_7[a0] = Module12.slice(r10, Math.max(r23, r10.length - 26));
}
c8791_8[a0] = Date.now();
}
};
const handleChannelDelete = function handleChannelDelete({ channel }) {
delete c8791_7[channel.id];
delete c8791_8[channel.id];
};
c8791_5 = 900000;
c8791_6 = {};
c8791_7 = {};
c8791_8 = {};
c8791_9 = {};
class ActiveChannelsStore extends Module589.Store {
static displayName = "ActiveChannelsStore";
initialize() {
this.waitFor(ChannelStore, SelectedGuildStore);
}
getActiveChannelsFetchStatus(a0) {
return c8791_9[a0];
}
getActiveChannelIds(a0) {
return c8791_6[a0];
}
getChannelMessageData(a0) {
return c8791_7[a0];
}
shouldFetch(a0) {
return c8791_6[a0] == null && !c8791_9[a0]?.loading;
}
}
const activeChannelsStore = new ActiveChannelsStore(Dispatcher, {
CHANNEL_SELECT: function handleRefreshChannels({ channelId, guildId: guildId2 }) {
if (isGuildHomeChannel(channelId) && guildId2 != null) {
const r9 = c8791_6[guildId2];
if (r9 == null) {
return false;
}
r9.forEach((item) => {
truncateOldMessageData(item);
if (c8791_7[item]?.length === 0) {
delete c8791_7[item];
}
});
c8791_6[guildId2] = new Set(Module12.chain(Array.from(r9)).filter((item) => item in c8791_7).sortBy((item) => {
let r7 = c8791_7[item]?.length;
if (r7 == null) {
r7 = 0;
}
return -r7;
}).value());
return void 0;
}
return false;
},
MESSAGE_CREATE: function handleMessageCreate({ channelId, message, optimistic, isPushNotification }) {
if (!optimistic && !isPushNotification) {
const channel = ChannelStore.getChannel(channelId);
if (channel == null) {
return false;
}
const guild_id = channel.guild_id;
let r2 = guild_id != null;
if (r2) {
let r3 = c8791_6[guild_id] != null;
if (r3) {
const id = message.id;
const id2 = message.author?.id;
c8791_6[guild_id].add(channelId);
const r28 = c8791_8[channelId];
if (r28 == null || r28 + 300000 > Date.now()) {
truncateOldMessageData(channelId);
}
if (c8791_7[channelId] == null) {
c8791_7[channelId] = [];
}
c8791_7[channelId].push({
id,
userId: id2
});
r3 = void 0;
}
r2 = r3;
}
return r2;
}
return false;
},
GUILD_DELETE: function handleGuildDelete(a0) {
delete c8791_6[a0.guild.id];
},
CHANNEL_DELETE: handleChannelDelete,
THREAD_DELETE: handleChannelDelete,
ACTIVE_CHANNELS_FETCH_START: function handleActiveChannelsFetchStart(a0) {
c8791_9[a0.guildId] = {
loading: true,
error: null,
fetchedAt: Date.now()
};
},
ACTIVE_CHANNELS_FETCH_SUCCESS: function handleActiveChannelsFetchSuccess({ guildId, channels }) {
c8791_9[guildId] = {
loading: false,
error: null,
fetchedAt: Date.now()
};
c8791_6[guildId] = new Set();
channels.forEach((channel) => {
const channel_id = channel.channel_id;
channel.messages.forEach(({ message_id, user_id }) => {
c8791_6[guildId].add(channel_id);
const r18 = c8791_8[channel_id];
if (r18 == null || r18 + 300000 > Date.now()) {
truncateOldMessageData(channel_id);
}
if (c8791_7[channel_id] == null) {
c8791_7[channel_id] = [];
}
c8791_7[channel_id].push({
id: message_id,
userId: user_id
});
});
});
},
ACTIVE_CHANNELS_FETCH_FAILURE: function handleActiveChannelsFetchFailure(a0) {
c8791_9[a0.guildId] = {
loading: false,
error: a0.error,
fetchedAt: null
};
},
CONNECTION_OPEN: function handleConnectionOpen() {
const guildId2 = SelectedGuildStore.getGuildId();
if (guildId2 != null) {
const r8 = c8791_9[guildId2];
const r6 = c8791_6[guildId2];
const r10 = Array;
let r21 = r6;
if (r21 == null) {
r21 = [];
}
const r25 = r10.from(r21).reduce((acc, item) => {
let r2 = c8791_7[item];
if (r2 == null) {
r2 = [];
}
acc[item] = r2;
return acc;
}, {});
c8791_6 = {};
c8791_7 = {};
c8791_8 = {};
c8791_9 = {};
const r32 = Date.now();
let r33 = r8?.fetchedAt;
if (r33 == null) {
r33 = 0;
}
if (r32 - r33 < c8791_5) {
const r36 = {};
r36[guildId2] = r8;
c8791_9 = r36;
const r37 = {};
r37[guildId2] = r6;
c8791_6 = r37;
c8791_7 = {
...r25
};
}
} else {
c8791_6 = {};
c8791_7 = {};
c8791_8 = {};
c8791_9 = {};
}
}
});
export default activeChannelsStore;
export const MAX_STORED_MESSAGES = 26;
@@ -0,0 +1,3 @@
// Metro module 15423 (f15424).
export const GUILD_FEED_CARD_MARGIN_HORIZONTAL = 12;
export const GUILD_FEED_MIN_BANNER_HEIGHT = 156;
@@ -0,0 +1,224 @@
// Metro module 15422 (f15423).
import * as Module19 from "react";
import { useEffect, useMemo } from "react";
import { Image as Image2, View } from "react-native";
import GuildPopoutStore from "../../../guild_profile/GuildPopoutStore";
import GuildStore from "../../../../stores/GuildStore";
import { GUILD_FEED_CARD_MARGIN_HORIZONTAL, GUILD_FEED_MIN_BANNER_HEIGHT } from "../GuildFeedConstants";
import { GuildFeatures } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useSharedValue, useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import useWindowDimensions_native from "../../../screen/useWindowDimensions.native";
import useTheme from "../../../../hooks/useTheme";
import { fetchGuildForPopout } from "../../../guild_profile/GuildPopoutActionCreators";
import { isAndroid } from "../../../../utils/PlatformUtils";
import AvatarUtils from "../../../../utils/AvatarUtils";
import { getGuildBadgeSource } from "../../../guild/native/GuildBadge";
import { withTiming } from "../../../../design/animation/reanimated/timing/timing";
import { timingSlow } from "../../../../design/animation/reanimated/timing/timingPresets";
import { useStateFromStoresObject, useStateFromStores } from "../../../../_bundle/Module589";
import useIsWindowLarge from "../../../screen/native/useIsWindowLarge";
import { useDrawerWidth } from "../../../screen/native/drawer/useDrawerWidth";
import { isThemeDark } from "../../../../design/shared";
import Module15424 from "../../../../_bundle/Module15424";
import Module15425 from "../../../../_bundle/Module15425";
import GuildIcon, { GuildIconSizes } from "../../../guild/native/GuildIcon";
import { Text } from "../../../../design/components/Text/native/Text";
import { Icon } from "../../../../design/void/native";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import ToastActionCreators from "../../../toast/native/ToastActionCreators";
import { intl, t } from "../../../../intl/index.native";
import Module15426 from "../../../../_bundle/Module15426";
let useStyles, __initData;
const GuildFeedBanner = function GuildFeedBanner(props) {
let c21984_2, width, height, drawerWidth;
const guild = props.guild;
let description = props.description;
const { hideDescription, hideMemberCount } = props;
c21984_2 = void 0;
width = void 0;
height = void 0;
drawerWidth = void 0;
const styles = useStyles();
const sharedValue = useSharedValue(0);
const G = () => ({
opacity: sharedValue.get()
});
G.__closure = {
opacity: sharedValue
};
G.__workletHash = 10872399645496;
G.__initData = __initData;
const animatedStyle = useAnimatedStyle(G);
const height2 = Math.max(0.22 * useWindowDimensions_native().height, GUILD_FEED_MIN_BANNER_HEIGHT);
const theme = useTheme();
useEffect(() => {
fetchGuildForPopout(guild.id);
}, [guild]);
const memo = useMemo(() => {
const r8 = guild.features.has(GuildFeatures.ANIMATED_BANNER) && !isAndroid();
const r20 = guild.banner != null ? AvatarUtils.getGuildBannerSource({
id: guild.id,
banner: guild.banner
}, r8) : null;
return guild != null ? guild.homeHeader != null ? AvatarUtils.getGuildHomeHeaderSource({
id: guild.id,
homeHeader: guild.homeHeader
}) : r20 : r20;
}, [guild]);
const name = guild.name;
if (description == null) {
description = guild.description;
}
if (hideDescription) {
description = void 0;
}
const handleLoad = function handleLoad() {
sharedValue.set(withTiming(1, timingSlow));
};
const guildBadgeSource = getGuildBadgeSource(guild);
const discoverableGuild = useStateFromStoresObject([GuildPopoutStore], () => ({
discoverableGuild: GuildPopoutStore.getGuild(guild.id)
}), [guild]).discoverableGuild;
const isWindowLarge = useIsWindowLarge();
c21984_2 = isWindowLarge;
const windowDimensions_native = useWindowDimensions_native();
width = windowDimensions_native.width;
height = windowDimensions_native.height;
drawerWidth = useDrawerWidth();
const memo2 = useMemo(() => {
const r8 = Math.min(width, height);
if (c21984_2) {
return Math.min(Math.max(width, height) - drawerWidth, r8);
}
return r8 - 2 * GUILD_FEED_CARD_MARGIN_HORIZONTAL;
}, [width, height, isWindowLarge, drawerWidth]);
const r102 = [<Image2 {...memo != null ? {
style: [{
height: height2,
width: "100%"
}, animatedStyle],
source: memo,
onLoad: handleLoad
} : {
style: [{
height: height2,
width: "100%"
}, animatedStyle],
source: isThemeDark(theme) ? Module15424 : Module15425,
onLoad: handleLoad
}} />, ,];
r102[1] = <View style={[styles.headerContainer, styles.headerBorder]}>
<View style={[styles.content, {
width: memo2,
marginTop: -32
}]}>
<View style={styles.guildIconContainer}>
<GuildIcon style={styles.avatar} guild={guild} size={GuildIconSizes.XLARGE} animate />
</View>
<View style={styles.textContainer}>
<Text lineClamp={1} variant="heading-xl/extrabold" color="mobile-text-heading-primary" style={styles.title}>{name}</Text>
{guildBadgeSource != null ? <Icon style={styles.icon} source={guildBadgeSource} disableColor /> : null}
</View>
{description != null ? <Text style={styles.description} variant="text-sm/medium" color="text-default">{description}</Text> : null}
{discoverableGuild != null && !hideMemberCount && <View style={styles.memberInfo}>
{discoverableGuild.features.has(GuildFeatures.DISCOVERABLE) ? <PressableOpacity style={styles.publicInfo} accessibilityRole="button" onPress={() => {
ToastActionCreators.open({
key: "DISCOVERABLE_GUILD_HEADER_PUBLIC_INFO",
content: intl.string(t.O8lDI2)
});
}}>
<Icon style={styles.publicIcon} source={Module15426} />
<Text variant="text-xs/medium" color="text-default">
{intl.string(t["B/vjCu"])}
</Text>
</PressableOpacity> : null}
{discoverableGuild.presenceCount != null ? discoverableGuild.memberCount != null ? <>
<View style={styles.dotOnline} />
<Text variant="text-xs/medium" color="text-default">
{intl.format(t.QCNv6P, {
online: discoverableGuild.presenceCount,
offline: discoverableGuild.memberCount
})}
</Text>
</> : null : null}
</View>}
</View>
</View>;
return <View style={styles.container}>{r102}</View>;
};
useStyles = createStyles({
avatar: {
borderRadius: Module712.radii.lg,
height: 64,
width: 64
},
container: {
paddingBottom: 24,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
},
description: {
marginTop: 4
},
textContainer: {
marginTop: GUILD_FEED_CARD_MARGIN_HORIZONTAL,
alignItems: "center",
flexDirection: "row"
},
content: {
width: "100%"
},
icon: {
marginLeft: 8
},
headerContainer: {
alignItems: "center",
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
},
headerBorder: {
borderTopRightRadius: Module712.radii.lg,
borderTopLeftRadius: Module712.radii.lg,
marginTop: -16
},
guildIconContainer: {
padding: 4,
borderRadius: Module712.radii.lg,
alignSelf: "flex-start",
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
},
dotOnline: {
width: 4,
height: 4,
borderRadius: Module712.radii.xs,
marginRight: 4,
backgroundColor: Module712.unsafe_rawColors.GREEN_360
},
publicInfo: {
flexDirection: "row",
alignItems: "center",
marginRight: 12
},
publicIcon: {
marginRight: 4,
width: 14,
height: 14
},
memberInfo: {
marginTop: 4,
flexDirection: "row",
alignItems: "center"
},
title: {
maxWidth: "90%"
}
});
__initData = {
code: "function GuildFeedBannerTsx1(){const{opacity}=this.__closure;return{opacity:opacity.get()};}"
};
const r93 = Module19.memo(function GuildFeedBannerContainer(props) {
const { guildId, description, hideDescription, hideMemberCount } = props;
const stateFromStores = useStateFromStores([GuildStore], () => GuildStore.getGuild(guildId));
return stateFromStores != null ? <GuildFeedBanner guild={stateFromStores} description={description} hideDescription={hideDescription} hideMemberCount={hideMemberCount} /> : null;
});
export default r93;
@@ -0,0 +1,30 @@
// Metro module 15174 (f15175).
import { useCallback } from "react";
import { Routes } from "../../../../../Constants";
import { StaticChannelRoute } from "../../../../channel/ChannelConstants";
import { CHANNEL_MARGIN_VERTICAL } from "../../../../channel_list_v2/native/RedesignChannelListConstants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { transitionTo } from "../../../../routing/router_utils";
import BaseChannelItem, { ChannelModes, BaseChannelName, BaseChannelIcon } from "../../../../guild_sidebar/native/BaseChannelItem";
import { intl, t } from "../../../../../intl/index.native";
import { SignPostIcon } from "../../../../../design/components/Icon/native/redesign/generated/SignPostIcon";
const useStyles = createStyles({
container: {
marginVertical: CHANNEL_MARGIN_VERTICAL,
marginHorizontal: 8,
borderRadius: Module712.radii.md
}
});
export default function GuildHomeChannelRow(props) {
const { guild, selected } = props;
const styles = useStyles();
const id = guild.id;
const callback = useCallback(() => {
transitionTo(Routes.CHANNEL(id, StaticChannelRoute.GUILD_HOME));
}, [id]);
const mode = selected ? ChannelModes.SELECTED : ChannelModes.DEFAULT;
return <BaseChannelItem onPress={callback} style={styles.container} accessible accessibilityLabel={intl.string(t.VbpLyU)} accessibilityState={{
selected
}} mode={mode} name={<BaseChannelName name={intl.string(t.VbpLyU)} mode={mode} />} icon={<BaseChannelIcon mode={mode} IconComponent={SignPostIcon} />} />;
};
+78
View File
@@ -0,0 +1,78 @@
// Metro module 15061 (f15062).
import { isTextChannel } from "../../records/ChannelRecord";
import ChannelStore from "../../stores/ChannelStore";
import PermissionStore from "../../stores/PermissionStore";
import UserGuildSettingsStore from "../../stores/UserGuildSettingsStore";
import ActiveChannelsStore from "./ActiveChannelsStore";
import { Permissions } from "../../Constants";
import { ChannelFlags } from "../channel/ChannelConstants";
import { isNotNullish } from "../../utils/GlobalUtils";
export function getActiveTextChannels(a0, r3 = [ChannelStore, PermissionStore, ActiveChannelsStore, UserGuildSettingsStore]) {
let r21, r22, r23, r24;
let r29 = r3[Symbol.iterator]();
const next = r29.next;
const r32 = r29 === void 0 ? void 0 : (r21 = next.call(r29)).done ? r29 = void 0 : r21.value;
let r0 = r29 === void 0;
const r33 = r0 ? void 0 : r32;
let c21632_0 = r33;
let r35 = void 0;
if (!r0) {
const r36 = r29 === void 0 ? void 0 : (r22 = next.call(r29)).done ? r29 = void 0 : r22.value;
const r2 = r29 === void 0;
r35 = void 0;
r0 = r2;
if (!r2) {
r35 = r36;
r0 = r2;
}
}
let c21632_1 = r35;
let r37 = void 0;
if (!r0) {
const r39 = r29 === void 0 ? void 0 : (r23 = next.call(r29)).done ? r29 = void 0 : r23.value;
const r41 = r29 === void 0;
r37 = void 0;
r0 = r41;
if (!r41) {
r37 = r39;
r0 = r41;
}
}
let r42 = void 0;
if (!r0) {
const r43 = r29 === void 0 ? void 0 : (r24 = next.call(r29)).done ? r29 = void 0 : r24.value;
const r45 = r29 === void 0;
r42 = void 0;
r0 = r45;
if (!r45) {
r42 = r43;
r0 = r45;
}
}
if (!r0 && r29 !== void 0 && typeof r29.return === "function") {
r29.return();
}
const activeChannelIds = r37.getActiveChannelIds(a0);
const r49 = activeChannelIds != null ? Array.from(activeChannelIds) : [];
const mutedChannels = r42.getMutedChannels(a0);
return r49.map((item) => c21632_0.getChannel(item)).filter(isNotNullish).filter((item) => {
if (item == null ? void 0 : item.hasFlag(ChannelFlags.ACTIVE_CHANNELS_REMOVED)) {
return false;
}
if (isTextChannel(item.type)) {
if (mutedChannels.has(item.id)) {
return false;
}
if (item.parent_id != null && mutedChannels.has(item.parent_id)) {
return false;
}
if (c21632_1.can(Permissions.VIEW_CHANNEL, item)) {
const channel = c21632_0.getChannel(item.parent_id);
const isThread = item.isThread();
return (isThread ? channel == null : !isThread) || !(channel == null ? void 0 : channel.hasFlag(ChannelFlags.ACTIVE_CHANNELS_REMOVED));
}
return false;
}
return false;
});
}