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

@@ -0,0 +1,9 @@
// Metro module 15011 (f15012).
import { HomeDrawerSharedItem } from "./HomeDrawerShared";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
export function HomeDrawerAddServerRowExpandedChildren() {
return <HomeDrawerSharedItem title={<Text variant="text-md/medium" color="text-default">
{intl.string(t.l5WIbf)}
</Text>} subtitle={null} />;
}
@@ -0,0 +1,69 @@
// Metro module 15000 (f15001).
import { useMemo } from "react";
import { View } from "react-native";
import { isMultiUserDM } from "../../../records/ChannelRecord";
import RelationshipStore from "../../../stores/RelationshipStore";
import UserGuildSettingsStore from "../../../stores/UserGuildSettingsStore";
import UserStore from "../../../stores/UserStore";
import { NOOP } from "../../../_bundle/Module505";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { useStateFromStores } from "../../../_bundle/Module589";
import { computeChannelName } from "../../channel/useChannelName";
import { useBaseChannelUnreadBadgeState } from "../../launchpad/native/shared/useChannelUnreadBadgeState";
import useMessagePreviews from "../../main_tabs_v2/useMessagePreviews";
import { BellZIcon } from "../../../design/components/Icon/native/redesign/generated/BellZIcon";
import { BellSlashIcon } from "../../../design/components/Icon/native/redesign/generated/BellSlashIcon";
import { Text } from "../../../design/components/Text/native/Text";
import { ChannelRowPreview } from "../../main_tabs_v2/native/shared_components/ChannelRowPreview";
import { ChannelListLayoutTypes } from "../../main_tabs_v2/ChannelListLayoutTypes";
import { HomeDrawerSharedItem } from "./HomeDrawerShared";
import { MobileHomeDrawerExperiment } from "./HomeDrawerExperiment";
import useChatLayout from "../../chat/native/useChatLayout";
let useStyles;
const HomeDrawerDMExpandedChildren = function HomeDrawerDMExpandedChildren(props) {
let stateFromStores2, message, stateFromStores3, memo;
const channel = props.channel;
stateFromStores2 = void 0;
message = void 0;
stateFromStores3 = void 0;
memo = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getUser(channel.getRecipientId()));
stateFromStores2 = useStateFromStores([UserStore, RelationshipStore], () => channel == null ? null : isMultiUserDM(channel.type) ? computeChannelName(channel, UserStore, RelationshipStore) : stateFromStores != null ? computeChannelName(channel, UserStore, RelationshipStore) : null);
message = useMessagePreviews(channel, {
unread: useBaseChannelUnreadBadgeState(channel, false).unread
});
stateFromStores3 = useStateFromStores([UserGuildSettingsStore], () => UserGuildSettingsStore.getChannelMuteConfig(channel.guild_id, channel.id));
memo = useMemo(() => stateFromStores3 == null ? {
isMuted: false,
isTemporary: false
} : {
isMuted: stateFromStores3.end_time == null || new Date(stateFromStores3.end_time) > new Date(),
isTemporary: stateFromStores3.end_time != null
}, [stateFromStores3]);
return <HomeDrawerSharedItem title={useMemo(() => <View style={styles.title}>
<Text variant="text-md/medium" style={styles.titleText} lineClamp={1} color="text-default">{stateFromStores2}</Text>
{jsx(memo?.isMuted ? memo?.isTemporary ? BellZIcon : BellSlashIcon : NOOP, {
size: "xs"
})}
</View>, [stateFromStores2, memo, styles.title, styles.titleText])} subtitle={useMemo(() => message != null ? <ChannelRowPreview channel={channel} message={message} variant="text-xs/medium" color="text-strong" layout={ChannelListLayoutTypes.COZY} muted={memo.isMuted} /> : null, [channel, message, memo])} />;
};
useStyles = createStyles({
title: {
flexDirection: "row",
alignItems: "center",
gap: 4
},
titleText: {
flexShrink: 1
}
});
export default function HomeDrawerDMExpandedChildrenWrapper(props) {
const channel2 = props.channel;
const enableHome = MobileHomeDrawerExperiment.useConfig({
location: "dm-expanded-children"
}).enableHome;
const isChatBesideChannelList = useChatLayout().isChatBesideChannelList;
return enableHome ? isChatBesideChannelList ? null : <HomeDrawerDMExpandedChildren channel={channel2} /> : null;
};
@@ -0,0 +1,49 @@
// Metro module 14968 (f14969).
import { View } from "react-native";
import PresenceStore from "../../../stores/PresenceStore";
import RelationshipStore from "../../../stores/RelationshipStore";
import { StatusTypes } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useStateFromStores } from "../../../_bundle/Module589";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import { HomeDrawerSharedItem } from "./HomeDrawerShared";
import { MobileHomeDrawerExperiment } from "./HomeDrawerExperiment";
import useChatLayout from "../../chat/native/useChatLayout";
let useStyles;
const HomeDrawerDMsRow = function HomeDrawerDMsRow() {
const styles = useStyles();
const stateFromStores = useStateFromStores([RelationshipStore, PresenceStore], () => RelationshipStore.getFriendIDs().filter((item) => PresenceStore.getStatus(item) !== StatusTypes.OFFLINE).length);
const subtitle = stateFromStores > 0 ? <View style={styles.subtitle}>
<View style={styles.onlineDot} />
<Text variant="text-xs/medium" color="text-muted" lineClamp={1}>
{intl.format(t.N5UIKr, {
numFriends: stateFromStores
})}
</Text>
</View> : null;
return <HomeDrawerSharedItem title={<Text variant="text-md/medium" color="text-default" lineClamp={1}>
{intl.string(t.YUU0RF)}
</Text>} subtitle={subtitle} />;
};
useStyles = createStyles({
subtitle: {
flexDirection: "row",
alignItems: "center",
gap: 4
},
onlineDot: {
width: 8,
height: 8,
borderRadius: Module712.radii.round,
backgroundColor: Module712.colors.TEXT_STATUS_ONLINE
}
});
export default function HomeDrawerDMsRowWrapper() {
const enableHome = MobileHomeDrawerExperiment.useConfig({
location: "dm-expanded-children"
}).enableHome;
const isChatBesideChannelList = useChatLayout().isChatBesideChannelList;
return enableHome ? isChatBesideChannelList ? null : <HomeDrawerDMsRow /> : null;
};
@@ -0,0 +1,24 @@
// Metro module 4046 (f4047).
import ApexExperiment from "../../experiments/apex/ApexExperiment";
const r17 = ApexExperiment({
name: "2025-10-mobile-home-drawer",
kind: "user",
defaultConfig: {
enableHome: false,
landOnHome: false,
enablePeekHint: false
},
variations: {
1: {
enableHome: true,
landOnHome: false,
enablePeekHint: true
},
2: {
enableHome: true,
landOnHome: true,
enablePeekHint: false
}
}
});
export { r17 as MobileHomeDrawerExperiment };
@@ -0,0 +1,9 @@
// Metro module 14971 (f14972).
import { HomeDrawerSharedItem } from "./HomeDrawerShared";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
export function HomeDrawerFavoritesRowExpandedChildren() {
return <HomeDrawerSharedItem title={<Text variant="text-md/medium" color="text-default" lineClamp={1}>
{intl.string(t.wMWyci)}
</Text>} subtitle={null} />;
}
@@ -0,0 +1,130 @@
// Metro module 14963 (f14964).
import { useMemo } from "react";
import { View } from "react-native";
import GuildReadStateStore from "../../../stores/GuildReadStateStore";
import GuildStore from "../../../stores/GuildStore";
import SortedGuildStore from "../../../stores/SortedGuildStore";
import UserGuildSettingsStore from "../../../stores/UserGuildSettingsStore";
import VoiceStateStore from "../../../stores/VoiceStateStore";
import { NOOP } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { useStateFromStoresArray, useStateFromStores } from "../../../_bundle/Module589";
import { BellSlashIcon } from "../../../design/components/Icon/native/redesign/generated/BellSlashIcon";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import { HomeDrawerSharedItem } from "./HomeDrawerShared";
import { MobileHomeDrawerExperiment } from "./HomeDrawerExperiment";
import useChatLayout from "../../chat/native/useChatLayout";
let useStyles;
const Wrapper = function Wrapper(props) {
let r83, r84;
let stateFromStoresArray, stateFromStoresArray2, stateFromStoresArray3, children, color;
const { folder, expanded } = props;
stateFromStoresArray = void 0;
stateFromStoresArray2 = void 0;
stateFromStoresArray3 = void 0;
children = void 0;
color = void 0;
const styles = useStyles();
const memo = useMemo(() => ({
isMuted: false
}), []);
stateFromStoresArray = useStateFromStoresArray([GuildReadStateStore, UserGuildSettingsStore], () => folder.guildIds.filter((guildId) => {
const isMuted = UserGuildSettingsStore.isMuted(guildId);
return isMuted ? !isMuted : GuildReadStateStore.getMentionCount(guildId) > 0;
}));
const stateFromStores3 = useStateFromStores([GuildStore], () => {
const r6 = stateFromStoresArray[0];
return r6 != null ? GuildStore.getGuild(r6)?.name : void 0;
});
stateFromStoresArray2 = useStateFromStoresArray([GuildReadStateStore, UserGuildSettingsStore], () => folder.guildIds.filter((guildId) => {
const isMuted = UserGuildSettingsStore.isMuted(guildId);
return isMuted ? !isMuted : GuildReadStateStore.hasUnread(guildId);
}));
const stateFromStores2 = useStateFromStores([GuildStore], () => {
const r6 = stateFromStoresArray2[0];
return r6 != null ? GuildStore.getGuild(r6)?.name : void 0;
});
stateFromStoresArray3 = useStateFromStoresArray([VoiceStateStore, GuildStore, UserGuildSettingsStore], () => folder.guildIds.filter((guildId) => {
if (UserGuildSettingsStore.isMuted(guildId)) {
return false;
}
const afkChannelId = GuildStore.getGuild(guildId)?.afkChannelId;
const set = new Set();
for (const item of Object.values(VoiceStateStore.getVoiceStates(guildId))) {
if (item.channelId != null && item.channelId !== afkChannelId) {
set.add(item.channelId);
}
}
return [...set].some((item) => {
const isCategoryMuted = UserGuildSettingsStore.isCategoryMuted(guildId, item);
return isCategoryMuted ? !isCategoryMuted : !UserGuildSettingsStore.isChannelMuted(guildId, item);
});
}));
const stateFromStores = useStateFromStores([GuildStore], () => {
const r6 = stateFromStoresArray3[0];
return r6 != null ? GuildStore.getGuild(r6)?.name : void 0;
});
const memo2 = useMemo(() => {
const r23 = [memo.isMuted ? <BellSlashIcon size="xs" /> : <NOOP size="xs" />, ,];
let folderName = folder.folderName;
if (folderName == null) {
folderName = intl.string(t["JQ/1n3"]);
}
r23[1] = <Text variant="text-md/medium" style={styles.titleText} lineClamp={1} color="text-default">{folderName}</Text>;
return <View style={styles.title}>{r23}</View>;
}, [folder.folderName, memo, styles.title, styles.titleText]);
children = intl.format(t.knOfkb, {
num: folder.guildIds.length
});
color = "text-muted";
if (stateFromStoresArray.length > 0 && stateFromStores3 != null) {
children = intl.format(t.UoFb3H, {
guildName: stateFromStores3,
count: stateFromStoresArray.length - 1
});
r83 = "text-muted";
r84 = children;
} else if (stateFromStoresArray3.length > 0 && stateFromStores != null) {
children = intl.format(t["0CRdJQ"], {
guildName: stateFromStores,
count: stateFromStoresArray3.length - 1
});
color = "text-voice-connected";
r83 = "text-voice-connected";
r84 = children;
} else {
const r82 = stateFromStoresArray2.length > 0 && stateFromStores2 != null;
r83 = "text-muted";
r84 = children;
if (r82) {
children = intl.format(t["3Pm7uY"], {
guildName: stateFromStores2,
count: stateFromStoresArray2.length - 1
});
r83 = "text-muted";
r84 = children;
}
}
const memo3 = useMemo(() => <Text variant="text-xs/medium" color={color} lineClamp={1}>{children}</Text>, [r84, r83]);
return <HomeDrawerSharedItem title={memo2} subtitle={expanded ? void 0 : memo3} />;
};
useStyles = createStyles({
title: {
flexDirection: "row",
alignItems: "center",
gap: 4
},
titleText: {
flexShrink: 1
}
});
export default function HomeDrawerFolderExpandedChildren(props) {
const { folderId, expanded } = props;
const stateFromStores = useStateFromStores([SortedGuildStore], () => folderId != null ? SortedGuildStore.getGuildFolderById(folderId) : null);
const enableHome = MobileHomeDrawerExperiment.useConfig({
location: "folder-expanded-children"
}).enableHome;
const isChatBesideChannelList = useChatLayout().isChatBesideChannelList;
return stateFromStores == null ? null : enableHome ? isChatBesideChannelList ? null : <Wrapper folder={stateFromStores} expanded={expanded} /> : null;
};
@@ -0,0 +1,225 @@
// Metro module 14973 (f14974).
import { useMemo, useEffect } from "react";
import { View } from "react-native";
import JoinedThreadsStore from "../../threads/JoinedThreadsStore";
import { isThread } from "../../../records/ChannelRecord";
import ChannelStore from "../../../stores/ChannelStore";
import GuildChannelStore from "../../../stores/GuildChannelStore";
import GuildReadStateStore from "../../../stores/GuildReadStateStore";
import GuildStore from "../../../stores/GuildStore";
import ReadStateStore from "../../../stores/ReadStateStore";
import RelationshipStore from "../../../stores/RelationshipStore";
import UserGuildSettingsStore from "../../../stores/UserGuildSettingsStore";
import UserStore from "../../../stores/UserStore";
import { EMPTY_STRING_SNOWFLAKE_ID, NOOP } from "../../../Constants";
import { UnreadSetting } from "../../read_states/ReadStateConstants";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { useStateFromStores, useStateFromStoresObject } from "../../../_bundle/Module589";
import { MobileHomeDrawerExperiment } from "./HomeDrawerExperiment";
import useChatLayout from "../../chat/native/useChatLayout";
import { BellZIcon } from "../../../design/components/Icon/native/redesign/generated/BellZIcon";
import { BellSlashIcon } from "../../../design/components/Icon/native/redesign/generated/BellSlashIcon";
import { Text } from "../../../design/components/Text/native/Text";
import { useIsHomeDrawerChannelMuted } from "./isHomeDrawerChannelMuted";
import { useIsHomeDrawerChannelInChannelList } from "./isHomeDrawerChannelInChannelList";
import { computeChannelName } from "../../channel/useChannelName";
import SnowflakeUtils from "../../../utils/SnowflakeUtils";
import { useVoiceUsers, GuildVoiceState } from "./HomeDrawerGuildVoiceState";
import { useHomeDrawerGuildTyping } from "./useHomeDrawerGuildTyping";
import useTypingText from "../../chat/useTypingText";
import StreamingSubtitle from "./subtitles/StreamingSubtitle";
import VoiceSubtitle from "./subtitles/VoiceSubtitle";
import MentionSubtitle from "./subtitles/MentionSubtitle";
import TypingSubtitle from "./subtitles/TypingSubtitle";
import UnreadSubtitle from "./subtitles/UnreadSubtitle";
import { HomeDrawerSharedItem } from "./HomeDrawerShared";
let c10595_20, useStyles;
const GuildRowWrapper = function GuildRowWrapper(props) {
let stateFromStores2, memo, isHomeDrawerChannelMuted, isHomeDrawerChannelInChannelList, unreadChannel, unreadChannelName, unreadChannelCount, mentionChannel, mentionChannelName, mentionChannelCount, voiceUsers, streamingUser, typingChannelId, typingChannelName, stateFromStores3, text, c21495_21, memo2;
const { guild, disableSubtitle, onActiveHookChange } = props;
stateFromStores2 = void 0;
memo = void 0;
isHomeDrawerChannelMuted = void 0;
isHomeDrawerChannelInChannelList = void 0;
unreadChannel = void 0;
unreadChannelName = void 0;
unreadChannelCount = void 0;
mentionChannel = void 0;
mentionChannelName = void 0;
mentionChannelCount = void 0;
voiceUsers = void 0;
streamingUser = void 0;
typingChannelId = void 0;
typingChannelName = void 0;
stateFromStores3 = void 0;
text = void 0;
c21495_21 = void 0;
memo2 = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([GuildReadStateStore], () => GuildReadStateStore.hasUnread(guild.id));
stateFromStores2 = useStateFromStores([UserGuildSettingsStore], () => UserGuildSettingsStore.getMuteConfig(guild.id));
memo = useMemo(() => stateFromStores2 == null ? {
isMuted: false,
isTemporary: false
} : {
isMuted: stateFromStores2.end_time == null || new Date(stateFromStores2.end_time) > new Date(),
isTemporary: stateFromStores2.end_time != null
}, [stateFromStores2]);
const memo3 = useMemo(() => <View style={styles.guildName}>
<Text variant="text-md/medium" style={styles.guildNameText} lineClamp={1} color={memo.isMuted ? "text-muted" : "text-default"}>{guild.name}</Text>
{jsx(memo.isMuted ? memo.isTemporary ? BellZIcon : BellSlashIcon : NOOP, {
size: "xs",
color: "icon-muted"
})}
</View>, [guild, memo, styles.guildName, styles.guildNameText]);
isHomeDrawerChannelMuted = useIsHomeDrawerChannelMuted();
isHomeDrawerChannelInChannelList = useIsHomeDrawerChannelInChannelList();
const stateFromStoresObject = useStateFromStoresObject([GuildChannelStore, ChannelStore, UserStore, RelationshipStore, ReadStateStore, UserGuildSettingsStore, JoinedThreadsStore], () => {
const r15 = GuildChannelStore.getSelectableChannelIds(guild.id).filter((item) => {
const basicChannel = ChannelStore.getBasicChannel(item);
let r11 = basicChannel != null;
if (r11) {
const isHomeDrawerChannelMuted3 = isHomeDrawerChannelMuted(basicChannel);
let r14 = !isHomeDrawerChannelMuted3;
if (!isHomeDrawerChannelMuted3) {
const r16 = isThread(basicChannel.type) && !JoinedThreadsStore.hasJoined(item);
r14 = r16 ? !r16 : !!isHomeDrawerChannelInChannelList(basicChannel) && (ReadStateStore.hasUnread(item) && UserGuildSettingsStore.resolveUnreadSetting(basicChannel) === UnreadSetting.ALL_MESSAGES);
}
r11 = r14;
}
return r11;
});
const unreadChannel2 = r15.length > 0 ? ChannelStore.getChannel(r15[0]) : void 0;
return {
unreadChannel: unreadChannel2,
unreadChannelName: unreadChannel2 != null ? computeChannelName(unreadChannel2, UserStore, RelationshipStore) : void 0,
unreadChannelCount: r15.length
};
}, [guild.id, isHomeDrawerChannelMuted, isHomeDrawerChannelInChannelList]);
unreadChannel = stateFromStoresObject.unreadChannel;
unreadChannelName = stateFromStoresObject.unreadChannelName;
unreadChannelCount = stateFromStoresObject.unreadChannelCount;
const stateFromStoresObject2 = useStateFromStoresObject([GuildReadStateStore, ChannelStore, UserStore, RelationshipStore, JoinedThreadsStore], () => {
const r16 = GuildReadStateStore.getMutableGuildStates()[guild.id];
let c27879_0 = r16;
if (r16 == null) {
return {
mentionChannel: void 0,
mentionChannelName: void 0,
mentionChannelCount: 0
};
}
const r24 = SnowflakeUtils.keys(r16.mentionCounts).filter((item) => {
if (c27879_0.mentionCounts[item].count <= 0) {
return false;
}
const basicChannel = ChannelStore.getBasicChannel(item);
let r14 = basicChannel != null;
if (r14) {
const r17 = isThread(basicChannel.type) && !JoinedThreadsStore.hasJoined(item);
r14 = r17 ? !r17 : isHomeDrawerChannelInChannelList(basicChannel);
}
return r14;
});
const mentionChannel2 = r24.length > 0 ? ChannelStore.getChannel(r24[0]) : void 0;
return {
mentionChannel: mentionChannel2,
mentionChannelName: mentionChannel2 != null ? computeChannelName(mentionChannel2, UserStore, RelationshipStore) : void 0,
mentionChannelCount: r24.length
};
}, [guild.id, isHomeDrawerChannelInChannelList]);
mentionChannel = stateFromStoresObject2.mentionChannel;
mentionChannelName = stateFromStoresObject2.mentionChannelName;
mentionChannelCount = stateFromStoresObject2.mentionChannelCount;
const voiceUsers2 = useVoiceUsers(guild);
voiceUsers = voiceUsers2.voiceUsers;
streamingUser = voiceUsers2.streamingUser;
const streamingChannelId = voiceUsers2.streamingChannelId;
const homeDrawerGuildTyping = useHomeDrawerGuildTyping(guild.id);
typingChannelId = homeDrawerGuildTyping.typingChannelId;
typingChannelName = homeDrawerGuildTyping.typingChannelName;
const typingUserIds = homeDrawerGuildTyping.typingUserIds;
stateFromStores3 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(typingChannelId), [typingChannelId]);
text = useTypingText({
channelId: typingChannelId == null ? EMPTY_STRING_SNOWFLAKE_ID : typingChannelId,
guildId: guild.id,
typingUserIds
});
const r3 = !(memo.isMuted || disableSubtitle || voiceUsers.length === 0);
c21495_21 = r3;
memo2 = useMemo(() => {
let r15;
L23: {
if (c21495_21) {
r15 = streamingUser != null ? c10595_20.STREAMING : c10595_20.VOICE;
} else if (disableSubtitle) {
r15 = c10595_20.NONE;
} else {
if (mentionChannelName != null && mentionChannelCount > 0) {
r15 = c10595_20.MENTION;
break L23;
}
if (typingChannelId != null && text != null && !memo.isMuted) {
r15 = c10595_20.TYPING;
break L23;
}
r15 = stateFromStores && (unreadChannelName != null && unreadChannelCount > 0) ? c10595_20.UNREAD : c10595_20.NONE;
}
}
return r15;
}, [r3, streamingUser, disableSubtitle, mentionChannelName, mentionChannelCount, typingChannelId, text, memo.isMuted, stateFromStores, unreadChannelName, unreadChannelCount]);
useEffect(() => {
if (onActiveHookChange != null) {
onActiveHookChange(memo2);
}
}, [memo2, onActiveHookChange]);
return <HomeDrawerSharedItem title={memo3} subtitle={useMemo(() => {
if (c10595_20.STREAMING === memo2) {
return <StreamingSubtitle guildId={guild.id} streamingUser={streamingUser} />;
}
if (c10595_20.VOICE === memo2) {
return <VoiceSubtitle guildId={guild.id} voiceUsers={voiceUsers} />;
}
if (c10595_20.MENTION === memo2) {
return mentionChannelName != null ? <MentionSubtitle guild={guild} channel={mentionChannel} channelName={mentionChannelName} count={mentionChannelCount} /> : null;
}
if (c10595_20.TYPING === memo2) {
return <TypingSubtitle guild={guild} channel={stateFromStores3} channelName={typingChannelName} text={text} />;
}
if (c10595_20.UNREAD === memo2) {
return unreadChannelName != null ? <UnreadSubtitle guild={guild} channel={unreadChannel} channelName={unreadChannelName} count={unreadChannelCount} /> : null;
}
if (c10595_20.NONE === memo2) {
return null;
}
}, [memo2, guild, streamingUser, voiceUsers, mentionChannel, mentionChannelName, mentionChannelCount, stateFromStores3, typingChannelName, text, unreadChannel, unreadChannelName, unreadChannelCount])} right={memo.isMuted ? null : disableSubtitle ? null : voiceUsers.length !== 0 ? <GuildVoiceState voiceUsers={voiceUsers} streamingChannelId={streamingChannelId} streamingUser={streamingUser} guildId={guild.id} /> : null} />;
};
c10595_20 = {
STREAMING: "streaming",
VOICE: "voice",
MENTION: "mention",
TYPING: "typing",
UNREAD: "unread",
NONE: "none"
};
useStyles = createStyles({
guildName: {
flexDirection: "row",
alignItems: "center",
gap: 4
},
guildNameText: {
flexShrink: 1
}
});
export default function HomeDrawerGuildRow(props) {
const { guildId, disableSubtitle: disableSubtitle2, onActiveHookChange: onActiveHookChange2 } = props;
const stateFromStores4 = useStateFromStores([GuildStore], () => GuildStore.getGuild(guildId));
const enableHome = MobileHomeDrawerExperiment.useConfig({
location: "guild-row"
}).enableHome;
const isChatBesideChannelList = useChatLayout().isChatBesideChannelList;
return stateFromStores4 == null ? null : enableHome ? isChatBesideChannelList ? null : <GuildRowWrapper guild={stateFromStores4} disableSubtitle={disableSubtitle2} onActiveHookChange={onActiveHookChange2} /> : null;
};
export { c10595_20 as HomeDrawerActiveHook };
@@ -0,0 +1,189 @@
// Metro module 14978 (f14979).
import { useMemo } from "react";
import { View } from "react-native";
import GuildChannelStore, { GUILD_VOCAL_CHANNELS_KEY } from "../../../stores/GuildChannelStore";
import RelationshipStore from "../../../stores/RelationshipStore";
import UserGuildSettingsStore from "../../../stores/UserGuildSettingsStore";
import SortedVoiceStateStore from "../../../stores/views/SortedVoiceStateStore";
import { ChannelTypes } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { AvatarPile } from "../../../design/components/Pile/native/AvatarPile.native";
import { AvatarSizes, Avatar } from "../../../design/void/native";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import useFetchStreamPreview from "../../go_live/useFetchStreamPreview";
import FastImage from "../../../components_native/common/FastImage";
import Module4611 from "../../../_bundle/Module4611";
import { useIsHomeDrawerChannelInChannelList } from "./isHomeDrawerChannelInChannelList";
import { useStateFromStoresArray, useStateFromStores } from "../../../_bundle/Module589";
import Module12 from "../../../_bundle/Module12";
import { filterOutBlockedOrIgnoredUsers } from "../../blocking/BlockedUserUtils";
let useStyles, useStyles2, LiveTag;
const VoiceUsers = function VoiceUsers(props) {
const { voiceUsers, guildId } = props;
const r11 = voiceUsers.length > 3 ? voiceUsers.slice(0, 3) : voiceUsers;
return voiceUsers.length !== 0 ? <View style={{
flexDirection: "row",
alignItems: "center",
gap: 4
}}>
<AvatarPile size={AvatarSizes.XSMALL} names={r11.map((item) => item.username)} totalCount={r11.length}>
{r11.map((item) => <Avatar key={item.id} size={AvatarSizes.XSMALL} user={item} guildId={guildId} animate={false} />)}
</AvatarPile>
</View> : null;
};
LiveTag = function LiveTag() {
const styles2 = useStyles2();
return <View style={styles2.tag}>
<Text variant="text-xxs/bold" style={styles2.tagText} lineClamp={1}>
{intl.string(t.dI3q4h).toUpperCase()}
</Text>
</View>;
};
useStyles = createStyles({
voiceContainer: {
paddingRight: 8,
height: 40,
gap: 4,
justifyContent: "center"
},
streamPreviewShadow: {
borderRadius: Module712.radii.sm,
...Module712.shadows.SHADOW_MEDIUM
},
streamPreview: {
width: 72,
height: 44,
borderRadius: Module712.radii.sm,
overflow: "hidden"
},
streamPreviewDarkGradient: {
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
opacity: 0.8
},
streamPreviewGradient: {
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
opacity: 0.2
},
streamPreviewBorder: {
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
borderWidth: 1,
borderColor: Module712.colors.BORDER_SUBTLE,
borderRadius: Module712.radii.sm
}
});
useStyles2 = createStyles({
tag: {
paddingHorizontal: 4,
paddingVertical: 1,
borderBottomRightRadius: Module712.radii.xs,
overflow: "hidden",
justifyContent: "center",
alignItems: "center",
backgroundColor: Module712.unsafe_rawColors.RED_400,
position: "absolute",
top: 0,
left: 0
},
tagText: {
textAlign: "center",
color: Module712.unsafe_rawColors.WHITE,
includeFontPadding: false
}
});
export function GuildVoiceState(props) {
const voiceUsers = props.voiceUsers;
let streamingChannelId2 = props.streamingChannelId;
const { streamingUser, guildId: guildId2 } = props;
const styles = useStyles();
const r4 = voiceUsers.length > 0;
if (streamingChannelId2 == null) {
streamingChannelId2 = void 0;
}
const previewUrl = useFetchStreamPreview(guildId2, streamingChannelId2, streamingUser?.id).previewUrl;
return r4 ? <View style={[styles.voiceContainer, {
height: streamingUser != null ? 48 : 32
}]}>
{previewUrl == null ? <VoiceUsers voiceUsers={voiceUsers} guildId={guildId2} /> : <View style={styles.streamPreviewShadow}>
<View style={styles.streamPreview}>
<FastImage style={styles.streamPreview} source={{
uri: previewUrl
}} />
<Module4611 colors={["rgba(0, 0, 0, 1)", "rgba(0, 0, 0, 0)"]} start={{
x: 0,
y: 0
}} end={{
x: 0,
y: 1
}} style={styles.streamPreviewDarkGradient} pointerEvents="none" />
<Module4611 colors={["rgba(255, 255, 255, 1)", "rgba(255, 255, 255, 0)"]} start={{
x: 0,
y: 0
}} end={{
x: 1,
y: 1
}} style={styles.streamPreviewGradient} pointerEvents="none" />
<View style={styles.streamPreviewBorder} pointerEvents="none" />
<LiveTag />
</View>
</View>}
</View> : null;
}
export function useVoiceUsers(a0) {
let stateFromStores, stateFromStoresArray2;
let c21498_0 = a0;
const id = a0.id;
const isHomeDrawerChannelInChannelList = useIsHomeDrawerChannelInChannelList();
const stateFromStoresArray = useStateFromStoresArray([GuildChannelStore, UserGuildSettingsStore], () => GuildChannelStore.getChannels(id)[GUILD_VOCAL_CHANNELS_KEY].filter(({ channel }) => channel.type === ChannelTypes.GUILD_VOICE && !UserGuildSettingsStore.isGuildOrCategoryOrChannelMuted(id, channel.id) && isHomeDrawerChannelInChannelList(channel)).map((item) => item.channel.id), [id, isHomeDrawerChannelInChannelList]);
stateFromStores = useStateFromStores([SortedVoiceStateStore], () => SortedVoiceStateStore.getVoiceStates(id), [id]);
stateFromStoresArray2 = useStateFromStoresArray([RelationshipStore], () => RelationshipStore.getBlockedOrIgnoredIDs());
const memo = useMemo(() => Module12.flatMap(stateFromStoresArray, (a0) => {
if (a0 === c21498_0.afkChannelId) {
return [];
}
let r4 = stateFromStores[a0];
if (r4 == null) {
r4 = [];
}
return filterOutBlockedOrIgnoredUsers(r4.map((item) => item.user), stateFromStoresArray2);
}), [stateFromStoresArray, stateFromStores, a0.afkChannelId, stateFromStoresArray2]);
const memo2 = useMemo(() => {
const user = null;
let streamingChannelId = null;
Object.keys(stateFromStores).forEach((a0) => {
if (a0 !== c21498_0.afkChannelId && stateFromStoresArray.includes(a0)) {
let r6 = stateFromStores[a0];
if (r6 == null) {
r6 = [];
}
const r14 = r6.find((item) => item.voiceState.selfStream);
if (r14 != null && user == null) {
user = r14.user;
streamingChannelId = a0;
}
}
});
return {
streamingUser: user,
streamingChannelId
};
}, [stateFromStores, a0.afkChannelId, stateFromStoresArray]);
return {
voiceUsers: memo,
streamingUser: memo2.streamingUser,
streamingChannelId: memo2.streamingChannelId
};
}
@@ -0,0 +1,32 @@
// Metro module 14964 (f14965).
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
const useStyles = createStyles({
container: {
flex: 1,
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
gap: 12
},
titleContainer: {
flex: 1,
flexDirection: "column",
justifyContent: "center",
gap: 2
},
rightContainer: {
overflow: "hidden"
}
});
export function HomeDrawerSharedItem(props) {
const { title, subtitle, right } = props;
const styles = useStyles();
return <View style={styles.container}>
<View style={styles.titleContainer}>
{title}
{subtitle}
</View>
{right != null ? <View style={styles.rightContainer}>{right}</View> : null}
</View>;
}
@@ -0,0 +1,44 @@
// Metro module 14932 (f14933).
import { DM_WIDTH } from "../../../Constants";
import { createWithEqualityFn } from "../../../_bundle/identity_700";
import { makeMutable } from "../../reanimated/ReanimatedRexport";
import { shallow } from "../../../_bundle/Module3802";
const withEqualityFn = createWithEqualityFn((c21463_0, c21463_1) => ({
panelX: makeMutable(0),
gestureState: makeMutable({
active: false,
initialX: 0,
initialY: 0,
panelX: 0
}),
maxX: 0,
lastInteractionAt: {
current: 0
},
isPanelTouchActive: makeMutable(false),
setPanelX: (a0) => {
const r11 = c21463_1();
const { panelX, gestureState, maxX } = r11;
if (a0 === "open") {
panelX.set(maxX);
} else {
panelX.set(0);
}
gestureState.set({
...gestureState.get(),
active: false
});
},
updateMaxX: (a0, a1) => {
c21463_0({
maxX: a0.width - a1.left - a1.right - DM_WIDTH - 8 + 8
});
},
noteInteraction: () => {
c21463_1().lastInteractionAt.current = Date.now();
}
}), shallow);
export default withEqualityFn;
export function computeMaxX(a0, a1) {
return a0.width - a1.left - a1.right - DM_WIDTH - 8 + 8;
}
@@ -0,0 +1,26 @@
// Metro module 14933 (f14934).
import { create } from "../../../_bundle/Module644";
let c10561_0 = null;
const r16 = create((c21464_0, c21464_1) => ({
currentType: "voice",
startTimer: () => {
if (c10561_0 != null) {
clearInterval(c10561_0);
}
c10561_0 = setInterval(() => {
c21464_0({
currentType: c21464_1().currentType === "voice" ? "activity" : "voice"
});
}, 3500);
},
stopTimer: () => {
if (c10561_0 != null) {
clearInterval(c10561_0);
c10561_0 = null;
}
c21464_0({
currentType: "voice"
});
}
}));
export default r16;
@@ -0,0 +1,10 @@
// Metro module 14977 (f14978).
import UserGuildSettingsStore from "../../../stores/UserGuildSettingsStore";
import { useStateFromStores, statesWillNeverBeEqual } from "../../../_bundle/Module589";
import * as _isOptInEnabled from "../../opt_in_channels/isOptInEnabled";
export function useIsHomeDrawerChannelInChannelList() {
return useStateFromStores([UserGuildSettingsStore], () => (a0) => {
const isOptInEnabledForGuild = _isOptInEnabled.isOptInEnabledForGuild(a0.guild_id);
return isOptInEnabledForGuild ? UserGuildSettingsStore.isChannelRecordOrParentOptedIn(a0) : !isOptInEnabledForGuild;
}, [], statesWillNeverBeEqual);
}
@@ -0,0 +1,15 @@
// Metro module 14976 (f14977).
import JoinedThreadsStore from "../../threads/JoinedThreadsStore";
import { isThread } from "../../../records/ChannelRecord";
import UserGuildSettingsStore from "../../../stores/UserGuildSettingsStore";
import { useStateFromStores, statesWillNeverBeEqual } from "../../../_bundle/Module589";
export function useIsHomeDrawerChannelMuted() {
return useStateFromStores([JoinedThreadsStore, UserGuildSettingsStore], () => (a0) => {
const isThread2 = isThread(a0.type);
if (isThread2 && JoinedThreadsStore.isMuted(a0.id)) {
return true;
}
const r10 = isThread2 ? a0.parent_id : a0.id;
return r10 != null && UserGuildSettingsStore.isGuildOrCategoryOrChannelMuted(a0.guild_id, r10);
}, [], statesWillNeverBeEqual);
}
@@ -0,0 +1,27 @@
// Metro module 14983 (f14984).
import { View } from "react-native";
import { useSubtitleStyles } from "./useSubtitleStyles";
import { getChannelIconComponentWithGuild } from "../../../../utils/native/ChannelUtils";
import { TextIcon } from "../../../../design/components/Icon/native/redesign/generated/TextIcon";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
export default function MentionSubtitle(props) {
const { guild, channel, channelName, count } = props;
const styles = useSubtitleStyles();
let Component = channel != null ? getChannelIconComponentWithGuild(channel, guild) : void 0;
if (Component == null) {
Component = TextIcon;
}
return <View style={styles.subtitleRow}>
<Component size="xxs" color="icon-muted" style={styles.channelIcon} />
<Text variant="text-xs/medium" color="text-muted" lineClamp={1} style={styles.subtitleText}>
{intl.format(t.L9YdGH, {
channelName,
count: count - 1,
channelHook: (a0, a1) => <Text key={a1} variant="text-xs/medium">
{a0}
</Text>
})}
</Text>
</View>;
};
@@ -0,0 +1,11 @@
// Metro module 14981 (f14982).
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import NicknameUtils from "../../../../utils/NicknameUtils";
export default function StreamingSubtitle(props) {
return <Text variant="text-xs/medium" color="text-voice-connected" lineClamp={1}>
{intl.format(t.k5IKep, {
username: NicknameUtils.getName(props.guildId, null, props.streamingUser)
})}
</Text>;
};
@@ -0,0 +1,24 @@
// Metro module 14985 (f14986).
import { View } from "react-native";
import { useSubtitleStyles } from "./useSubtitleStyles";
import { getChannelIconComponentWithGuild } from "../../../../utils/native/ChannelUtils";
import { TextIcon } from "../../../../design/components/Icon/native/redesign/generated/TextIcon";
import { Text } from "../../../../design/components/Text/native/Text";
export default function TypingSubtitle(props) {
const { guild, channel, channelName, text } = props;
const styles = useSubtitleStyles();
let Component = channel != null ? getChannelIconComponentWithGuild(channel, guild) : void 0;
if (Component == null) {
Component = TextIcon;
}
return <View style={styles.subtitleRow}>
{channelName != null ? <Component size="xxs" color="icon-muted" style={styles.channelIcon} /> : null}
<Text variant="text-xs/medium" color="text-muted" lineClamp={1} style={styles.subtitleText}>
{channelName != null ? <Text variant="text-xs/medium">
{channelName}
{" · "}
</Text> : null}
{text}
</Text>
</View>;
};
@@ -0,0 +1,32 @@
// Metro module 14986 (f14987).
import { View } from "react-native";
import { useSubtitleStyles } from "./useSubtitleStyles";
import { getChannelIconComponentWithGuild } from "../../../../utils/native/ChannelUtils";
import * as _TextIcon from "../../../../design/components/Icon/native/redesign/generated/TextIcon";
import { intl, t } from "../../../../intl/index.native";
import { Text } from "../../../../design/components/Text/native/Text";
export default function UnreadSubtitle(props) {
const { guild, channel, channelName, count } = props;
const styles = useSubtitleStyles();
let r18 = channel != null ? getChannelIconComponentWithGuild(channel, guild) : void 0;
if (r18 == null) {
r18 = _TextIcon.TextIcon;
}
const TextIcon = r18;
return <View style={styles.subtitleRow}>
{intl.format(t.OqlmU6, {
channelName,
count: count - 1,
labelHook: (a0, a1) => <Text key={a1} variant="text-xs/medium" color="text-muted" lineClamp={1}>
{a0}
</Text>,
iconHook: (a0, a1) => <TextIcon key={a1} size="xxs" color="icon-muted" style={styles.unreadChannelIcon} />,
channelHook: (a0, a1) => <Text key={a1} variant="text-xs/medium" color="text-muted" lineClamp={1} style={styles.subtitleText}>
{a0}
</Text>,
overflowHook: (a0, a1) => <Text key={a1} variant="text-xs/medium" color="text-muted">
{a0}
</Text>
})}
</View>;
};
@@ -0,0 +1,13 @@
// Metro module 14982 (f14983).
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import NicknameUtils from "../../../../utils/NicknameUtils";
export default function VoiceSubtitle(props) {
const { guildId, voiceUsers } = props;
return <Text variant="text-xs/medium" color="text-voice-connected" lineClamp={1}>
{intl.format(t.r1Vkoc, {
users: voiceUsers.slice(0, 2).map((item) => NicknameUtils.getName(guildId, null, item)).join(", "),
overflowCount: Math.max(voiceUsers.length - 2, 0)
})}
</Text>;
};
@@ -0,0 +1,19 @@
// Metro module 14984 (f14985).
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
const useStyles = createStyles({
subtitleRow: {
flexDirection: "row",
alignItems: "center"
},
subtitleText: {
flexShrink: 1
},
channelIcon: {
marginRight: 2
},
unreadChannelIcon: {
marginLeft: 2,
marginRight: 2
}
});
export { useStyles as useSubtitleStyles };
@@ -0,0 +1,63 @@
// Metro module 14935 (f14936).
import { useState, useEffect } from "react";
import { useNavigation } from "../../../_bundle/Module1481";
import { coerceGuildsRoute } from "../../main_tabs_v2/helpers/NavigationRouteUtils.native";
export function useDrawerOpen(r8 = true) {
let setState;
let c21466_0 = r8;
setState = void 0;
const navigation = useNavigation();
let state;
[state, setState] = useState(() => {
if (c21466_0) {
const state = navigation.getState();
const r3 = state == null;
let r18 = void 0;
if (!r3) {
const routes = state.routes;
const r19 = routes == null;
r18 = void 0;
if (!r19) {
let r7 = state?.index;
if (r7 == null) {
r7 = 0;
}
r18 = routes[r7];
}
}
const r21 = coerceGuildsRoute(r18);
return (r21 == null ? void 0 : r21.params?.drawerOpen) === true;
}
return false;
});
useEffect(() => {
const handleStateChange2 = function handleStateChange(a0) {
const state = a0.data.state;
const r3 = state == null;
let r15 = void 0;
if (!r3) {
const routes = state.routes;
const r16 = routes == null;
r15 = void 0;
if (!r16) {
let r7 = state?.index;
if (r7 == null) {
r7 = 0;
}
r15 = routes[r7];
}
}
const r18 = coerceGuildsRoute(r15);
if (r18 != null) {
setState(r18.params?.drawerOpen === true);
}
};
if (c21466_0) {
navigation.addListener("state", handleStateChange2);
return () => {
navigation.removeListener("state", handleStateChange2);
};
}
}, [navigation, r8]);
return state;
}
@@ -0,0 +1,565 @@
// Metro module 14931 (f14932).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import { createContext, useCallback, useEffect, useRef, useLayoutEffect, useMemo, useState } from "react";
import HomeDrawerStore, { computeMaxX } from "./HomeDrawerStore";
import HomeDrawerSubtitleStore from "./HomeDrawerSubtitleStore";
import { AnalyticEvents } from "../../../Constants";
import { MobileHomeDrawerExperiment } from "./HomeDrawerExperiment";
import * as _ReanimatedRexport from "../../reanimated/ReanimatedRexport";
import { useSharedValue, useAnimatedReaction, useDerivedValue, useAnimatedStyle } from "../../reanimated/ReanimatedRexport";
import { useNavigation, useIsFocused } from "../../../_bundle/Module1481";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import * as _HapticUtils_native from "../../haptics/HapticUtils.native";
import useWindowDimensions_native from "../../screen/useWindowDimensions.native";
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
import useChatLayout from "../../chat/native/useChatLayout";
import { useHomeDrawerPeekHint } from "./useHomeDrawerPeekHint";
import * as _NavigationRouteUtils_native from "../../main_tabs_v2/helpers/NavigationRouteUtils.native";
import { coerceGuildsRoute } from "../../main_tabs_v2/helpers/NavigationRouteUtils.native";
import * as _spring from "../../../design/animation/reanimated/spring/spring";
import { Gesture } from "../../../_bundle/Module5273";
import { createFakeSharedValue } from "../../reanimated/ReanimatedHelperTypes";
const INITIAL_OPEN_WIDTH = 144;
const HOME_GESTURE_DRAG_PHYSICS = {
mass: 0.3,
damping: 30,
stiffness: 400
};
const HOME_DRAWER_FLING_PHYSICS = {
mass: 0.4,
damping: 100,
stiffness: 250
};
const MAX_HOME_DRAWER_ANIMATING_WIDTH = 48;
const ServerDrawerInteractAction = {
PEEK: "PEEK",
OPEN: "OPEN"
};
const __initData = {
code: "function useHomeDrawerGestureTsx1(){const{dragOffsetX,INITIAL_OPEN_WIDTH}=this.__closure;return dragOffsetX.get()>=INITIAL_OPEN_WIDTH;}"
};
const __initData2 = {
code: "function useHomeDrawerGestureTsx2(isOpen,wasOpen){const{GestureState,runOnJS,triggerHapticFeedback,HapticFeedbackTypes}=this.__closure;if(!GestureState.get().active||wasOpen===null){return;}if(isOpen===wasOpen){return;}if(isOpen){runOnJS(triggerHapticFeedback)(HapticFeedbackTypes.IMPACT_MEDIUM);}else{runOnJS(triggerHapticFeedback)(HapticFeedbackTypes.SOFT);}}"
};
const __initData3 = {
code: "function useHomeDrawerGestureTsx3(){const{panelX,peekX}=this.__closure;return panelX.get()+peekX.get();}"
};
const __initData4 = {
code: "function useHomeDrawerGestureTsx4(){const{isDrawerInitialized,initialPanelX,withSpring,panelX,GestureState,HOME_GESTURE_DRAG_PHYSICS,HOME_DRAWER_FLING_PHYSICS}=this.__closure;if(!isDrawerInitialized.get()){return initialPanelX;}return withSpring(panelX.get(),GestureState.get().active?HOME_GESTURE_DRAG_PHYSICS:HOME_DRAWER_FLING_PHYSICS,'animate-always');}"
};
const __initData5 = {
code: "function useHomeDrawerGestureTsx5(){const{panelGestureSpringX,peekX}=this.__closure;return panelGestureSpringX.get()+peekX.get();}"
};
const __initData6 = {
code: "function useHomeDrawerGestureTsx6(){const{safeAreaInsets,panelSpringTranslateX}=this.__closure;return{flex:1,marginTop:safeAreaInsets.top,transform:[{translateX:panelSpringTranslateX.get()}]};}"
};
const __initData7 = {
code: "function useHomeDrawerGestureTsx7(){const{drawerRevealX,MAX_HOME_DRAWER_ANIMATING_WIDTH,GUILD_DESCRIPTION_ANIMATION_DISTANCE,MIN_HOME_DRAWER_TEXT_OPACITY,MIN_HOME_DRAWER_OPEN_WIDTH,GUILD_LABEL_UNSNAPPED_SCALE,withSpring,HOME_DRAWER_FLING_PHYSICS,clamp}=this.__closure;let x=0;if(drawerRevealX.get()<MAX_HOME_DRAWER_ANIMATING_WIDTH){x=Math.min(GUILD_DESCRIPTION_ANIMATION_DISTANCE,drawerRevealX.get()/MAX_HOME_DRAWER_ANIMATING_WIDTH*GUILD_DESCRIPTION_ANIMATION_DISTANCE);}const opacity=MIN_HOME_DRAWER_TEXT_OPACITY+drawerRevealX.get()/MIN_HOME_DRAWER_OPEN_WIDTH*(1-MIN_HOME_DRAWER_TEXT_OPACITY);const scale=drawerRevealX.get()>=MAX_HOME_DRAWER_ANIMATING_WIDTH?1:GUILD_LABEL_UNSNAPPED_SCALE;return{transform:[{translateX:withSpring(x,HOME_DRAWER_FLING_PHYSICS)},{scale:withSpring(scale,HOME_DRAWER_FLING_PHYSICS)}],opacity:withSpring(clamp(opacity,0,1),HOME_DRAWER_FLING_PHYSICS)};}"
};
const __initData8 = {
code: "function useHomeDrawerGestureTsx8(){const{drawerRevealX,MAX_HOME_DRAWER_ANIMATING_WIDTH,MAX_HOME_DRAWER_ICON_DISTANCE,withSpring,HOME_DRAWER_FLING_PHYSICS}=this.__closure;let x=0;if(drawerRevealX.get()<MAX_HOME_DRAWER_ANIMATING_WIDTH){x=Math.min(MAX_HOME_DRAWER_ICON_DISTANCE,drawerRevealX.get()/MAX_HOME_DRAWER_ANIMATING_WIDTH*MAX_HOME_DRAWER_ICON_DISTANCE);}return{transform:[{translateX:withSpring(x,HOME_DRAWER_FLING_PHYSICS)}]};}"
};
const __initData9 = {
code: "function useHomeDrawerGestureTsx9(){const{drawerRevealX,MAX_HOME_DRAWER_ANIMATING_WIDTH,UNREAD_INDICATOR_ANIMATION_DISTANCE,withSpring,HOME_DRAWER_FLING_PHYSICS}=this.__closure;let left=0;if(drawerRevealX.get()<MAX_HOME_DRAWER_ANIMATING_WIDTH){left=-Math.min(UNREAD_INDICATOR_ANIMATION_DISTANCE,drawerRevealX.get()/MAX_HOME_DRAWER_ANIMATING_WIDTH*UNREAD_INDICATOR_ANIMATION_DISTANCE);}return{transform:[{translateX:withSpring(left,HOME_DRAWER_FLING_PHYSICS)}]};}"
};
const __initData10 = {
code: "function settleDrawer_useHomeDrawerGestureTsx10(shouldOpen){const{panelX,MaxX,runOnJS,setHomeDrawerState}=this.__closure;panelX.set(shouldOpen?MaxX:0);runOnJS(setHomeDrawerState)(shouldOpen);}"
};
const __initData11 = {
code: "function shouldOpenFromPosition_useHomeDrawerGestureTsx11(){const{panelX,FRACTION_OF_WIDTH_FOR_DRAWER_TO_REMAIN_OPEN,MaxX,INITIAL_OPEN_WIDTH,dragOffsetX}=this.__closure;if(panelX.get()===0)return false;if(panelX.get()>FRACTION_OF_WIDTH_FOR_DRAWER_TO_REMAIN_OPEN*MaxX)return true;if(panelX.get()>=INITIAL_OPEN_WIDTH&&dragOffsetX.get()>0)return true;return false;}"
};
const __initData12 = {
code: "function useHomeDrawerGestureTsx12(){const{panelX,MaxX,settleDrawer,shouldOpenFromPosition,isPanelTouchActive,runOnJS,noteInteraction,GestureState,dragOffsetX}=this.__closure;if(panelX.get()>0&&panelX.get()<MaxX){settleDrawer(shouldOpenFromPosition());}isPanelTouchActive.set(false);runOnJS(noteInteraction)();GestureState.set({active:false,initialX:0,initialY:0,panelX:0});dragOffsetX.set(0);}"
};
const __initData13 = {
code: "function useHomeDrawerGestureTsx13(event){const{FLING_MIN_VELOCITY,dragOffsetX,FLING_MIN_DISTANCE,INITIAL_OPEN_WIDTH,runOnJS,triggerHapticFeedback,HapticFeedbackTypes,shouldOpenFromPosition,settleDrawer,GestureState,trackServerDrawerInteract,ServerDrawerInteractAction}=this.__closure;let shouldOpen;if(event.velocityX>FLING_MIN_VELOCITY&&dragOffsetX.get()>FLING_MIN_DISTANCE){shouldOpen=true;if(dragOffsetX.get()<INITIAL_OPEN_WIDTH){runOnJS(triggerHapticFeedback)(HapticFeedbackTypes.IMPACT_MEDIUM);}}else if(event.velocityX<-FLING_MIN_VELOCITY&&dragOffsetX.get()<-FLING_MIN_DISTANCE){shouldOpen=false;runOnJS(triggerHapticFeedback)(HapticFeedbackTypes.SOFT);}else{shouldOpen=shouldOpenFromPosition();}settleDrawer(shouldOpen);const wasOpenAtStart=GestureState.get().panelX>0;if(shouldOpen){runOnJS(trackServerDrawerInteract)(ServerDrawerInteractAction.OPEN);}else if(!wasOpenAtStart){runOnJS(trackServerDrawerInteract)(ServerDrawerInteractAction.PEEK);}}"
};
const __initData14 = {
code: "function useHomeDrawerGestureTsx14(event){const{GestureState,dragOffsetX,INITIAL_OPEN_WIDTH,panelX,DRAWER_RESISTANCE}=this.__closure;if(!GestureState.get().active)return;const newXOffset=event.absoluteX-GestureState.get().initialX;dragOffsetX.set(newXOffset);const basePosition=newXOffset+GestureState.get().panelX;if(GestureState.get().panelX===0&&newXOffset>=0&&newXOffset<INITIAL_OPEN_WIDTH){panelX.set(Math.max(basePosition/DRAWER_RESISTANCE,0));}else{panelX.set(Math.max(basePosition,0));}}"
};
const __initData15 = {
code: "function useHomeDrawerGestureTsx15(event,manager){const{GestureState,panelX,ACTIVATION_MIN_DISTANCE}=this.__closure;if(GestureState.get().active)return;const touchX=event.changedTouches[0].absoluteX;const touchY=event.changedTouches[0].absoluteY;const absoluteXDiff=Math.abs(touchX-GestureState.get().initialX);const absoluteYDiff=Math.abs(touchY-GestureState.get().initialY);if(absoluteYDiff>absoluteXDiff||panelX.get()===0&&touchX<GestureState.get().initialX||panelX.get()>0&&touchX>GestureState.get().initialX){manager.fail();return;}if(absoluteXDiff<ACTIVATION_MIN_DISTANCE){return;}if(panelX.get()===0&&touchX>GestureState.get().initialX){GestureState.set({...GestureState.get(),active:true,initialX:touchX,panelX:panelX.get()});manager.activate();}else if(touchX<GestureState.get().initialX){GestureState.set({...GestureState.get(),active:true,initialX:touchX,panelX:panelX.get()});manager.activate();}}"
};
const __initData16 = {
code: "function useHomeDrawerGestureTsx16(event){const{isPanelTouchActive,GestureState,panelX}=this.__closure;isPanelTouchActive.set(true);GestureState.set({active:false,initialX:event.absoluteX,initialY:event.absoluteY,panelX:panelX.get()});}"
};
const context = createContext({
gesture: Gesture.Pan(),
panelStyles: {},
GestureState: createFakeSharedValue({
active: false,
initialX: 0,
initialY: 0,
panelX: 0
}),
panelX: createFakeSharedValue(0),
panelSpringTranslateX: createFakeSharedValue(0),
guildsBarLabelDrawerStyle: {},
guildsBarIconDrawerStyle: {},
guildsBarUnreadDrawerStyle: {}
});
exports.HOME_DRAWER_FLING_PHYSICS = HOME_DRAWER_FLING_PHYSICS;
export function useHomeGesture() {
let c21462_11, c21462_12, c21462_13, isFocused, sharedValue3, derivedValue, landOnHome, c21462_18, ref, derivedValue2, derivedValue3, animatedStyle, animatedStyle2, animatedStyle3, animatedStyle4, memo;
const config = MobileHomeDrawerExperiment.useConfig({
location: "gesture"
});
let enableHome = config.enableHome;
const { enablePeekHint, landOnHome: landOnHome2 } = config;
const r40 = HomeDrawerStore();
const { panelX, GestureState, updateMaxX, MaxX, setPanelX, isPanelTouchActive, noteInteraction } = r40;
const sharedValue = useSharedValue(0);
const sharedValue2 = useSharedValue(false);
const navigation = useNavigation();
const callback = useCallback((a0) => {
AnalyticsUtils.track(AnalyticEvents.SERVER_DRAWER_INTERACT, {
action: a0
});
}, []);
const W = () => sharedValue.get() >= INITIAL_OPEN_WIDTH;
W.__closure = {
dragOffsetX: sharedValue,
INITIAL_OPEN_WIDTH
};
W.__workletHash = 2525772891435;
W.__initData = __initData;
const C = function C(a0, a1) {
if (GestureState.get().active && a1 !== null && a0 !== a1) {
const r20 = _ReanimatedRexport.runOnJS(_HapticUtils_native.triggerHapticFeedback);
if (a0) {
r20(_HapticUtils_native.HapticFeedbackTypes.IMPACT_MEDIUM);
} else {
r20(_HapticUtils_native.HapticFeedbackTypes.SOFT);
}
}
};
C.__closure = {
GestureState,
runOnJS: _ReanimatedRexport.runOnJS,
triggerHapticFeedback: _HapticUtils_native.triggerHapticFeedback,
HapticFeedbackTypes: _HapticUtils_native.HapticFeedbackTypes
};
C.__workletHash = 11947599708940;
C.__initData = __initData2;
useAnimatedReaction(W, C);
const windowDimensions_native = useWindowDimensions_native();
c21462_11 = windowDimensions_native;
const safeAreaInsets_native = useSafeAreaInsets_native();
c21462_12 = safeAreaInsets_native;
const isChatBesideChannelList = useChatLayout().isChatBesideChannelList;
if (enableHome) {
enableHome = !isChatBesideChannelList;
}
c21462_13 = enableHome;
const isFocused2 = useIsFocused();
isFocused = enableHome ? isFocused2 : enableHome;
sharedValue3 = useSharedValue(0);
useHomeDrawerPeekHint(enableHome ? enablePeekHint : enableHome, sharedValue3);
const ne = () => panelX.get() + sharedValue3.get();
ne.__closure = {
panelX,
peekX: sharedValue3
};
ne.__workletHash = 4654854314200;
ne.__initData = __initData3;
derivedValue = useDerivedValue(ne);
const state = navigation.getState();
const r4 = state == null;
let r106 = void 0;
if (!r4) {
const routes = state.routes;
const r107 = routes == null;
r106 = void 0;
if (!r107) {
let r32 = state?.index;
if (r32 == null) {
r32 = 0;
}
r106 = routes[r32];
}
}
const r109 = coerceGuildsRoute(r106);
let r110 = enableHome;
if (r110) {
let r112 = r109 == null ? void 0 : r109.params?.drawerOpen;
if (r112 == null) {
r112 = landOnHome2;
}
r110 = r112;
}
landOnHome = r110;
const initialPanelX = landOnHome ? computeMaxX(windowDimensions_native, safeAreaInsets_native) : 0;
c21462_18 = initialPanelX;
useEffect(() => {
if (c21462_13) {
updateMaxX(c21462_11, c21462_12);
} else {
updateMaxX({
width: 0,
height: 0
}, {
top: 0,
bottom: 0,
left: 0,
right: 0
});
}
}, [windowDimensions_native, safeAreaInsets_native, updateMaxX, enableHome]);
useEffect(() => {
if (!c21462_13) {
panelX.set(0);
_NavigationRouteUtils_native.setHomeDrawerState(false);
}
}, [enableHome, panelX]);
useEffect(() => {
const handleStateChange2 = function handleStateChange(a0) {
const state = a0.data.state;
const r3 = state == null;
let r15 = void 0;
if (!r3) {
const routes = state.routes;
const r16 = routes == null;
r15 = void 0;
if (!r16) {
let r8 = state?.index;
if (r8 == null) {
r8 = 0;
}
r15 = routes[r8];
}
}
const r18 = coerceGuildsRoute(r15);
if (r18 != null && c21462_13) {
const r25 = r18.params?.drawerOpen === true;
setPanelX(r25 ? "open" : "closed");
const state2 = HomeDrawerSubtitleStore.getState();
if (r25) {
state2.startTimer();
} else {
state2.stopTimer();
}
}
};
navigation.addListener("state", handleStateChange2);
return () => {
navigation.removeListener("state", handleStateChange2);
HomeDrawerSubtitleStore.getState().stopTimer();
};
}, [navigation, setPanelX, enableHome]);
ref = useRef(false);
useLayoutEffect(() => {
if (c21462_13 && !ref.current) {
panelX.set(c21462_18);
if (landOnHome) {
HomeDrawerSubtitleStore.getState().startTimer();
}
ref.current = true;
}
}, [enableHome, landOnHome, initialPanelX, panelX]);
useEffect(() => {
if (ref.current) {
sharedValue2.set(true);
}
}, [enableHome, sharedValue2]);
const Ie = function Ie() {
return sharedValue2.get() ? _spring.withSpring(panelX.get(), GestureState.get().active ? HOME_GESTURE_DRAG_PHYSICS : HOME_DRAWER_FLING_PHYSICS, "animate-always") : c21462_18;
};
Ie.__closure = {
isDrawerInitialized: sharedValue2,
initialPanelX,
withSpring: _spring.withSpring,
panelX,
GestureState,
HOME_GESTURE_DRAG_PHYSICS,
HOME_DRAWER_FLING_PHYSICS
};
Ie.__workletHash = 11078734703352;
Ie.__initData = __initData4;
derivedValue2 = useDerivedValue(Ie);
const ge = () => derivedValue2.get() + sharedValue3.get();
ge.__closure = {
panelGestureSpringX: derivedValue2,
peekX: sharedValue3
};
ge.__workletHash = 2927026959998;
ge.__initData = __initData5;
derivedValue3 = useDerivedValue(ge);
const Se = () => ({
flex: 1,
marginTop: c21462_12.top,
transform: [{
translateX: derivedValue3.get()
}]
});
Se.__closure = {
safeAreaInsets: safeAreaInsets_native,
panelSpringTranslateX: derivedValue3
};
Se.__workletHash = 13544610996653;
Se.__initData = __initData6;
animatedStyle = useAnimatedStyle(Se);
const Ae = function Ae() {
const r13 = derivedValue.get() < MAX_HOME_DRAWER_ANIMATING_WIDTH ? Math.min(12, derivedValue.get() / MAX_HOME_DRAWER_ANIMATING_WIDTH * 12) : 0;
const r23 = derivedValue.get() / 150;
const r1 = derivedValue.get() >= MAX_HOME_DRAWER_ANIMATING_WIDTH ? 1 : 0.98;
const r29 = 0 + r23 * 1;
return {
transform: [{
translateX: _spring.withSpring(r13, HOME_DRAWER_FLING_PHYSICS)
}, {
scale: _spring.withSpring(r1, HOME_DRAWER_FLING_PHYSICS)
}],
opacity: _spring.withSpring(_ReanimatedRexport.clamp(r29, 0, 1), HOME_DRAWER_FLING_PHYSICS)
};
};
Ae.__closure = {
drawerRevealX: derivedValue,
MAX_HOME_DRAWER_ANIMATING_WIDTH,
GUILD_DESCRIPTION_ANIMATION_DISTANCE: 12,
MIN_HOME_DRAWER_TEXT_OPACITY: 0,
MIN_HOME_DRAWER_OPEN_WIDTH: 150,
GUILD_LABEL_UNSNAPPED_SCALE: 0.98,
withSpring: _spring.withSpring,
HOME_DRAWER_FLING_PHYSICS,
clamp: _ReanimatedRexport.clamp
};
Ae.__workletHash = 11639414708115;
Ae.__initData = __initData7;
animatedStyle2 = useAnimatedStyle(Ae);
const De = function De() {
return {
transform: [{
translateX: _spring.withSpring(derivedValue.get() < MAX_HOME_DRAWER_ANIMATING_WIDTH ? Math.min(8, derivedValue.get() / MAX_HOME_DRAWER_ANIMATING_WIDTH * 8) : 0, HOME_DRAWER_FLING_PHYSICS)
}]
};
};
De.__closure = {
drawerRevealX: derivedValue,
MAX_HOME_DRAWER_ANIMATING_WIDTH,
MAX_HOME_DRAWER_ICON_DISTANCE: 8,
withSpring: _spring.withSpring,
HOME_DRAWER_FLING_PHYSICS
};
De.__workletHash = 16360618332998;
De.__initData = __initData8;
animatedStyle3 = useAnimatedStyle(De);
const pe = function pe() {
return {
transform: [{
translateX: _spring.withSpring(derivedValue.get() < MAX_HOME_DRAWER_ANIMATING_WIDTH ? -Math.min(4, derivedValue.get() / MAX_HOME_DRAWER_ANIMATING_WIDTH * 4) : 0, HOME_DRAWER_FLING_PHYSICS)
}]
};
};
pe.__closure = {
drawerRevealX: derivedValue,
MAX_HOME_DRAWER_ANIMATING_WIDTH,
UNREAD_INDICATOR_ANIMATION_DISTANCE: 4,
withSpring: _spring.withSpring,
HOME_DRAWER_FLING_PHYSICS
};
pe.__workletHash = 8561772429103;
pe.__initData = __initData9;
animatedStyle4 = useAnimatedStyle(pe);
memo = useMemo(() => {
let settleDrawer2, shouldOpenFromPosition2;
const settleDrawer = function settleDrawer(a0) {
panelX.set(a0 ? MaxX : 0);
_ReanimatedRexport.runOnJS(_NavigationRouteUtils_native.setHomeDrawerState)(a0);
};
settleDrawer.__closure = {
panelX,
MaxX,
runOnJS: _ReanimatedRexport.runOnJS,
setHomeDrawerState: _NavigationRouteUtils_native.setHomeDrawerState
};
settleDrawer.__workletHash = 8226756372642;
settleDrawer.__initData = __initData10;
settleDrawer2 = settleDrawer;
const shouldOpenFromPosition = function shouldOpenFromPosition() {
return panelX.get() !== 0 && (panelX.get() > 0.5 * MaxX || panelX.get() >= INITIAL_OPEN_WIDTH && sharedValue.get() > 0);
};
shouldOpenFromPosition.__closure = {
panelX,
FRACTION_OF_WIDTH_FOR_DRAWER_TO_REMAIN_OPEN: 0.5,
MaxX,
INITIAL_OPEN_WIDTH,
dragOffsetX: sharedValue
};
shouldOpenFromPosition.__workletHash = 11654084007114;
shouldOpenFromPosition.__initData = __initData11;
shouldOpenFromPosition2 = shouldOpenFromPosition;
const r44 = Gesture.Pan().enabled(isFocused).manualActivation(true).shouldCancelWhenOutside(false).maxPointers(1);
const _ = function _(a0) {
isPanelTouchActive.set(true);
GestureState.set({
active: false,
initialX: a0.absoluteX,
initialY: a0.absoluteY,
panelX: panelX.get()
});
};
_.__closure = {
isPanelTouchActive,
GestureState,
panelX
};
_.__workletHash = 8825829705900;
_.__initData = __initData16;
const r49 = r44.onBegin(_);
const r51 = function(a0, a1) {
L14: {
if (!GestureState.get().active) {
L13: {
const absoluteX = a0.changedTouches[0].absoluteX;
const absoluteY = a0.changedTouches[0].absoluteY;
const r26 = Math.abs(absoluteX - GestureState.get().initialX);
if (!(Math.abs(absoluteY - GestureState.get().initialY) > r26)) {
if (panelX.get() === 0 && absoluteX < GestureState.get().initialX) {
break L13;
}
if (panelX.get() > 0 && absoluteX > GestureState.get().initialX) {
break L13;
}
if (r26 < 10) {
break L14;
}
if (!(panelX.get() === 0 && absoluteX > GestureState.get().initialX || absoluteX < GestureState.get().initialX)) {
break L14;
}
GestureState.set({
...GestureState.get(),
active: true,
initialX: absoluteX,
panelX: panelX.get()
});
a1.activate();
break L14;
}
}
a1.fail();
}
}
};
r51.__closure = {
GestureState,
panelX,
ACTIVATION_MIN_DISTANCE: 10
};
r51.__workletHash = 7484113391171;
r51.__initData = __initData15;
const r55 = r49.onTouchesMove(r51);
const n = function n(a0) {
L6: {
if (GestureState.get().active) {
const r15 = a0.absoluteX - GestureState.get().initialX;
sharedValue.set(r15);
const r21 = r15 + GestureState.get().panelX;
if (GestureState.get().panelX === 0 && r15 >= 0 && r15 < INITIAL_OPEN_WIDTH) {
panelX.set(Math.max(r21 / 3, 0));
break L6;
}
panelX.set(Math.max(r21, 0));
}
}
};
n.__closure = {
GestureState,
dragOffsetX: sharedValue,
INITIAL_OPEN_WIDTH,
panelX,
DRAWER_RESISTANCE: 3
};
n.__workletHash = 15118338555898;
n.__initData = __initData14;
const r61 = r55.onChange(n);
const t = function t(a0) {
let r3;
L16: {
if (a0.velocityX > 50 && sharedValue.get() > 40) {
const r67 = sharedValue.get() < INITIAL_OPEN_WIDTH;
r3 = true;
if (!r67) {
break L16;
}
_ReanimatedRexport.runOnJS(_HapticUtils_native.triggerHapticFeedback)(_HapticUtils_native.HapticFeedbackTypes.IMPACT_MEDIUM);
r3 = true;
} else if (a0.velocityX < -50 && sharedValue.get() < -40) {
_ReanimatedRexport.runOnJS(_HapticUtils_native.triggerHapticFeedback)(_HapticUtils_native.HapticFeedbackTypes.SOFT);
r3 = false;
} else {
r3 = panelX.get() !== 0 && (panelX.get() > 0.5 * MaxX || panelX.get() >= INITIAL_OPEN_WIDTH && sharedValue.get() > 0);
}
}
panelX.set(r3 ? MaxX : 0);
_ReanimatedRexport.runOnJS(_NavigationRouteUtils_native.setHomeDrawerState)(r3);
const r114 = GestureState.get().panelX > 0;
if (r3) {
_ReanimatedRexport.runOnJS(callback)(ServerDrawerInteractAction.OPEN);
} else if (!r114) {
_ReanimatedRexport.runOnJS(callback)(ServerDrawerInteractAction.PEEK);
}
};
t.__closure = {
FLING_MIN_VELOCITY: 50,
dragOffsetX: sharedValue,
FLING_MIN_DISTANCE: 40,
INITIAL_OPEN_WIDTH,
runOnJS: _ReanimatedRexport.runOnJS,
triggerHapticFeedback: _HapticUtils_native.triggerHapticFeedback,
HapticFeedbackTypes: _HapticUtils_native.HapticFeedbackTypes,
shouldOpenFromPosition: shouldOpenFromPosition2,
settleDrawer: settleDrawer2,
GestureState,
trackServerDrawerInteract: callback,
ServerDrawerInteractAction
};
t.__workletHash = 11139594764616;
t.__initData = __initData13;
const r77 = r61.onEnd(t);
const e = function e() {
if (panelX.get() > 0 && panelX.get() < MaxX) {
const r4 = panelX.get() !== 0 && (panelX.get() > 0.5 * MaxX || panelX.get() >= INITIAL_OPEN_WIDTH && sharedValue.get() > 0);
panelX.set(r4 ? MaxX : 0);
_ReanimatedRexport.runOnJS(_NavigationRouteUtils_native.setHomeDrawerState)(r4);
}
isPanelTouchActive.set(false);
_ReanimatedRexport.runOnJS(noteInteraction)();
GestureState.set({
active: false,
initialX: 0,
initialY: 0,
panelX: 0
});
sharedValue.set(0);
};
e.__closure = {
panelX,
MaxX,
settleDrawer: settleDrawer2,
shouldOpenFromPosition: shouldOpenFromPosition2,
isPanelTouchActive,
runOnJS: _ReanimatedRexport.runOnJS,
noteInteraction,
GestureState,
dragOffsetX: sharedValue
};
e.__workletHash = 15210416953749;
e.__initData = __initData12;
return r77.onFinalize(e);
}, [GestureState, panelX, sharedValue, isFocused, MaxX, isPanelTouchActive, noteInteraction, callback]);
return {
gesture: memo,
panelStyles: animatedStyle,
homeDrawerState: _slicedToArray(useState(() => ({
gesture: memo,
panelStyles: animatedStyle,
GestureState,
panelX,
panelSpringTranslateX: derivedValue3,
guildsBarLabelDrawerStyle: animatedStyle2,
guildsBarIconDrawerStyle: animatedStyle3,
guildsBarUnreadDrawerStyle: animatedStyle4
})), 1)[0]
};
}
export { context as HomeDrawerStateContext };
@@ -0,0 +1,40 @@
// Metro module 14980 (f14981).
import JoinedThreadsStore from "../../threads/JoinedThreadsStore";
import { isThread } from "../../../records/ChannelRecord";
import ChannelStore from "../../../stores/ChannelStore";
import TypingStore from "../../../stores/TypingStore";
import { areArraysShallowEqual } from "../../../_bundle/shallowEqual";
import { useIsHomeDrawerChannelMuted } from "./isHomeDrawerChannelMuted";
import { useIsHomeDrawerChannelInChannelList } from "./isHomeDrawerChannelInChannelList";
import { useStateFromStores } from "../../../_bundle/Module589";
import SnowflakeUtils from "../../../utils/SnowflakeUtils";
let c10601_7;
const areHomeDrawerGuildTypingStatesEqual = function areHomeDrawerGuildTypingStatesEqual(a0, a1) {
return a0.typingChannelId === a1.typingChannelId && a0.typingChannelName === a1.typingChannelName && areArraysShallowEqual(a0.typingUserIds, a1.typingUserIds);
};
c10601_7 = {
typingChannelId: void 0,
typingChannelName: void 0,
typingUserIds: []
};
export function useHomeDrawerGuildTyping(a0) {
const isHomeDrawerChannelMuted = useIsHomeDrawerChannelMuted();
const isHomeDrawerChannelInChannelList = useIsHomeDrawerChannelInChannelList();
return useStateFromStores([TypingStore, ChannelStore, JoinedThreadsStore], () => {
const typingUsersByGuild = TypingStore.getTypingUsersByGuild(a0);
const typingChannelId = SnowflakeUtils.keys(typingUsersByGuild).find((item) => {
const basicChannel = ChannelStore.getBasicChannel(item);
let r10 = basicChannel != null && !isHomeDrawerChannelMuted(basicChannel);
if (r10) {
const r15 = isThread(basicChannel.type) && !JoinedThreadsStore.hasJoined(item);
r10 = r15 ? !r15 : isHomeDrawerChannelInChannelList(basicChannel);
}
return r10;
});
return typingChannelId == null ? c10601_7 : {
typingChannelId,
typingChannelName: ChannelStore.getChannel(typingChannelId)?.name,
typingUserIds: Object.keys(typingUsersByGuild[typingChannelId])
};
}, [a0, isHomeDrawerChannelMuted, isHomeDrawerChannelInChannelList], areHomeDrawerGuildTypingStatesEqual);
}
@@ -0,0 +1,183 @@
// Metro module 14934 (f14935).
import { useRef, useState, useCallback, useEffect } from "react";
import AccessibilityStore from "../../a11y/AccessibilityStore";
import HomeDrawerStore from "./HomeDrawerStore";
import { ME } from "../../../Constants";
import { ContentDismissActionType } from "../../dismissible_content/DismissibleContentConstants";
import * as _ReanimatedRexport from "../../reanimated/ReanimatedRexport";
import { Easing, useAnimatedReaction } from "../../reanimated/ReanimatedRexport";
import { DismissibleContent } from "../../../_bundle/Module1358";
import { useIsFocused } from "../../../_bundle/Module1481";
import { useDrawerOpen } from "./useDrawerState";
import { useStateFromStores } from "../../../_bundle/Module589";
import { useGuildsRouteGuildAndChannelId } from "../../main_tabs_v2/navigator/useGuildsRouteGuildId";
import { useIsDismissibleContentDismissed_UNSAFE } from "../../dismissible_content/DismissibleContentUnsafeUtils";
import { useSelectedDismissibleContent } from "../../dismissible_content/hooks/useSelectedDismissibleContent";
import { withTiming } from "../../../design/animation/reanimated/timing/timing";
import { withSpring } from "../../../design/animation/reanimated/spring/spring";
import { HOME_DRAWER_FLING_PHYSICS } from "./useHomeDrawerGesture";
let c10562_8 = 2000;
const easing = Easing.inOut(Easing.cubic);
let c10562_10 = [];
let c10562_11 = [DismissibleContent.HOME_DRAWER_SWIPE_PEEK_NUX];
const __initData = {
code: "function useHomeDrawerPeekHintTsx1(){const{gestureState,panelX,PEEK_HINT_DRAWER_DRAG_THRESHOLD}=this.__closure;return gestureState.get().active&&panelX.get()>PEEK_HINT_DRAWER_DRAG_THRESHOLD;}"
};
const __initData2 = {
code: "function useHomeDrawerPeekHintTsx2(isDragged,wasDragged){const{isPeekGranted,runOnJS,handleDrawerDragged}=this.__closure;if(!isPeekGranted||wasDragged==null)return;if(isDragged&&!wasDragged){runOnJS(handleDrawerDragged)();}}"
};
export const PEEK_HINT_DISTANCE = 40;
export function useHomeDrawerPeekHint(a0, a1) {
let c21465_7, ref, ref2, ref3, ref4, ref5, callback, c21465_17, callback2, callback3;
let r6 = a0;
let c21465_0 = a1;
const r23 = HomeDrawerStore();
const { panelX, gestureState, lastInteractionAt, isPanelTouchActive, noteInteraction } = r23;
const isFocused = useIsFocused();
const drawerOpen = useDrawerOpen(a0);
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
const [r40] = useGuildsRouteGuildAndChannelId();
const r2 = !useIsDismissibleContentDismissed_UNSAFE(DismissibleContent.HOME_DRAWER_SWIPE_PEEK_NUX);
if (a0) {
r6 = isFocused;
}
if (r6) {
r6 = r40 != null;
}
if (r6) {
r6 = r40 !== ME;
}
if (r6) {
r6 = !drawerOpen;
}
if (r6) {
r6 = !stateFromStores;
}
if (r6) {
r6 = r2;
}
c21465_7 = r6;
ref = useRef(false);
const [state, setState] = useState(false);
if (state ? !r6 : state) {
setState(false);
}
let [r67, current] = useSelectedDismissibleContent(state && r6 ? c10562_11 : c10562_10, void 0, true);
ref2 = useRef(null);
ref3 = useRef(null);
ref4 = useRef(false);
ref5 = useRef(null);
callback = useCallback(() => {
if (ref2.current != null) {
clearTimeout(ref2.current);
ref2.current = null;
}
ref4.current = true;
c21465_0.set(withTiming(40, {
duration: 1500,
easing
}));
ref3.current = setTimeout(() => {
ref3.current = null;
ref4.current = false;
c21465_0.set(withSpring(0, HOME_DRAWER_FLING_PHYSICS));
const current2 = ref5.current;
if (current2 != null) {
current2.call(ref5, ContentDismissActionType.AUTO_DISMISS);
}
setState(false);
}, 2500);
}, [a1]);
const isPeekGranted = r67 === DismissibleContent.HOME_DRAWER_SWIPE_PEEK_NUX;
c21465_17 = isPeekGranted;
useEffect(() => {
if (c21465_17 && !ref4.current) {
ref5.current = current;
callback();
}
}, [isPeekGranted, callback, current]);
callback2 = useCallback(() => {
if (ref2.current != null) {
clearTimeout(ref2.current);
ref2.current = null;
}
if (ref3.current != null) {
clearTimeout(ref3.current);
ref3.current = null;
}
if (ref4.current) {
ref4.current = false;
c21465_0.set(withSpring(0, HOME_DRAWER_FLING_PHYSICS));
}
}, [a1]);
useEffect(() => {
if (c21465_7 && !state && !ref.current) {
noteInteraction();
const r5 = setTimeout;
const checkIdle2 = function checkIdle() {
ref2.current = null;
let r1 = c10562_8 - (Date.now() - lastInteractionAt.current);
if (!isPanelTouchActive.get() && !(0 < r1)) {
setState(true);
} else {
const r22 = setTimeout;
if (!(0 < r1)) {
r1 = c10562_8;
}
ref2.current = r22(checkIdle2, r1);
}
};
ref2.current = r5(checkIdle2, c10562_8);
return () => {
if (ref2.current != null) {
clearTimeout(ref2.current);
ref2.current = null;
}
};
}
}, [r6, state, noteInteraction, lastInteractionAt, isPanelTouchActive]);
useEffect(() => {
if (drawerOpen) {
ref.current = true;
callback2();
}
}, [drawerOpen, callback2]);
useEffect(() => {
if (c21465_7 ? !c21465_7 : ref4.current) {
callback2();
const current2 = ref5.current;
if (current2 != null) {
current2.call(ref5, ContentDismissActionType.AUTO_DISMISS);
}
}
}, [r6, callback2]);
callback3 = useCallback(() => {
callback2();
const current2 = ref5.current;
if (current2 != null) {
current2.call(ref5, ContentDismissActionType.INDIRECT_ACTION);
}
setState(false);
}, [callback2]);
const V = () => gestureState.get().active && panelX.get() > 8;
V.__closure = {
gestureState,
panelX,
PEEK_HINT_DRAWER_DRAG_THRESHOLD: 8
};
V.__workletHash = 15765003051494;
V.__initData = __initData;
const Q = function Q(a0, a1) {
if (c21465_17 && a1 != null && a0 && !a1) {
_ReanimatedRexport.runOnJS(callback3)();
}
};
Q.__closure = {
isPeekGranted,
runOnJS: _ReanimatedRexport.runOnJS,
handleDrawerDragged: callback3
};
Q.__workletHash = 10054961085184;
Q.__initData = __initData2;
useAnimatedReaction(V, Q);
}