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

+34
View File
@@ -0,0 +1,34 @@
// Metro module 10046 (f10047).
import { useMemo, forwardRef } from "react";
import AccessibilityStore from "../../a11y/AccessibilityStore";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { useMobileVisualRefreshConfig } from "../../themes/experiments/MobileVisualRefreshExperiment";
import { GestureDetector, Gesture } from "../../../_bundle/Module5273";
import Module10047 from "../../../_bundle/Module10047";
import { TTIFirstContentfulPaint } from "../../tti_analytics/native/TTIFirstContentfulPaint";
import { useStateFromStores } from "../../../_bundle/Module589";
import Module9466 from "../../../_bundle/Module9466";
let useStyles;
const DCDChatList = function DCDChatList() {
const styles = useStyles();
const chatInputFloating = useMobileVisualRefreshConfig({
location: "DCDChatList"
}).chatInputFloating;
return <GestureDetector gesture={useMemo(() => Gesture.Native().disallowInterruption(true).shouldCancelWhenOutside(false), [])}>
<Module10047 style={styles.chatList} floatingChatInputEnabled={chatInputFloating}>
<TTIFirstContentfulPaint label="chat_list_android" />
</Module10047>
</GestureDetector>;
};
useStyles = createStyles({
chatList: {
flex: 1
}
});
const r30 = forwardRef(function(a0, a1) {
return <Module9466 {...a0} roleStyle={useStateFromStores([AccessibilityStore], () => AccessibilityStore.roleStyle)} ref={a1}>
<DCDChatList />
{a0.children}
</Module9466>;
});
export default r30;
@@ -0,0 +1,23 @@
// Metro module 9467 (f9468).
let c6244_0 = new WeakMap();
export function getAndIncrementChangesetIdForChat(a0) {
let r7 = c6244_0.get(a0);
if (r7 == null) {
r7 = 0;
}
const r8 = r7 + 1;
c6244_0.set(a0, r8);
return r8;
}
export function getChangesetIdForChat(a0) {
const r2 = a0 == null;
let r3 = 0;
if (!r2) {
let r8 = c6244_0.get(a0);
if (r8 == null) {
r8 = 0;
}
r3 = r8;
}
return r3;
}
@@ -0,0 +1,211 @@
// Metro module 10142 (f10143).
import { memo, useState, useEffect } from "react";
import { View } from "react-native";
import AccessibilityStore from "../../a11y/AccessibilityStore";
import GatewayConnectionStore from "../../gateway/GatewayConnectionStore";
import MessageStore from "../../../stores/MessageStore";
import SelectedChannelStore from "../../../stores/SelectedChannelStore";
import UserStore from "../../../stores/UserStore";
import AppStateStore from "../../../stores/native/AppStateStore";
import { AppStates } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import AlertActionCreators from "../../../actions/native/AlertActionCreators";
import { useStateFromStoresObject, useStateFromStores } from "../../../_bundle/Module589";
import { Text } from "../../../design/components/Text/native/Text";
import { ChatLoadingIndicatorExperiment } from "./ChatLoadingIndicatorExperiment";
import * as _ReanimatedRexport from "../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useAnimatedStyle } from "../../reanimated/ReanimatedRexport";
import * as _timing from "../../../design/animation/reanimated/timing/timing";
import * as _index_native from "../../../intl/index.native";
import { intl } from "../../../intl/index.native";
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
let useStyles, Component2, __initData;
const openLoadingIndicatorDebugBody = function openLoadingIndicatorDebugBody() {
const currentUser = UserStore.getCurrentUser();
if ((currentUser == null ? void 0 : currentUser.isStaff()) || (currentUser == null ? void 0 : currentUser.isStaffPersonal())) {
AlertActionCreators.openLazy({
importer: () => import("../../../components_native/common/Alert").then(({ default: Component }) => (a0) => <Component {...a0} title="Chat Loading indicator">
<Component2 />
</Component>),
isDismissable: true
});
}
};
useStyles = createStyles({
container: {
flexDirection: "row",
alignItems: "center",
gap: 4
},
pulse: {
height: 8,
width: 8,
borderRadius: Module712.radii.round,
backgroundColor: Module712.colors.BACKGROUND_BRAND
}
});
Component2 = memo(function() {
const stateFromStoresObject = useStateFromStoresObject([MessageStore, GatewayConnectionStore, SelectedChannelStore], () => {
const channelId = SelectedChannelStore.getChannelId();
const isConnected = GatewayConnectionStore.isConnected();
if (channelId == null) {
return {
messagesCached: false,
messagesReady: false,
connected: isConnected
};
}
const messages = MessageStore.getMessages(channelId);
return {
messagesCached: messages.cached,
messagesReady: messages.ready,
connected: isConnected
};
});
let messagesCached = stateFromStoresObject.messagesCached;
const { messagesReady, connected } = stateFromStoresObject;
let color2 = "text-feedback-critical";
const color = messagesCached ? "text-feedback-positive" : "text-feedback-critical";
let r39 = "false";
const r48 = [<>
messages.cached
:
{" "}
<Text variant="text-md/normal" color={color}>
{messagesCached ? "true" : "false"}
</Text>
{messagesCached !== false ? <Text variant="text-md/normal" color="text-muted">
{" "}
{"(should be "}
false
{" to hide loading indicator)"}
</Text> : null}
</>, "\n", <>
messages.ready
:
{" "}
<Text variant="text-md/normal" color={messagesReady ? "text-feedback-positive" : "text-feedback-critical"}>
{messagesReady ? "true" : "false"}
</Text>
{messagesReady !== true ? <Text variant="text-md/normal" color="text-muted">
{" "}
{"(should be "}
true
{" to hide loading indicator)"}
</Text> : null}
</>, "\n", <>
connected
:
{" "}
<Text variant="text-md/normal" color={connected ? "text-feedback-positive" : "text-feedback-critical"}>
{connected ? "true" : "false"}
</Text>
{connected !== true ? <Text variant="text-md/normal" color="text-muted">
{" "}
{"(should be "}
true
{" to hide loading indicator)"}
</Text> : null}
</>, "\n", ,];
if (!messagesCached) {
messagesCached = !messagesReady;
}
if (!messagesCached) {
messagesCached = !connected;
}
const r88 = ["should show chat indicator", ":", " ", , ,];
if (messagesCached) {
color2 = "text-feedback-positive";
}
if (messagesCached) {
r39 = "true";
}
r88[3] = <Text variant="text-md/normal" color={color2}>{r39}</Text>;
r88[4] = null;
r48[6] = <>{r88}</>;
return <Text variant="text-md/normal" color="text-default">{r48}</Text>;
});
__initData = {
code: "function ChatLoadingIndicatorTsx1(){const{useReducedMotion,withRepeat,withSequence,withTiming,Easing}=this.__closure;if(useReducedMotion){return{transform:[]};}return{transform:[{scale:withRepeat(withSequence(withTiming(1,{duration:0}),withTiming(0.5,{duration:1500,easing:Easing.bezier(0.4,0,0.2,1)}),withTiming(1,{duration:1500,easing:Easing.bezier(0.4,0,0.2,1)})),-1)}]};}"
};
export function useShouldChannelShowLoadingIndicator(c17725_0) {
const enabled = ChatLoadingIndicatorExperiment.useConfig({
location: "ChatLoadingIndicatorGuard"
}).enabled;
const stateFromStores = useStateFromStores([MessageStore, GatewayConnectionStore, AppStateStore], () => {
if (enabled) {
if (c17725_0 == null) {
return false;
}
if (AppStateStore.getState() !== AppStates.ACTIVE) {
return false;
}
const messages = MessageStore.getMessages(c17725_0);
const isConnected = GatewayConnectionStore.isConnected();
return messages.cached || !messages.ready || !isConnected;
}
return false;
});
const [state, setState] = useState(false);
useEffect(() => {
if (stateFromStores) {
let c26626_0 = setTimeout(() => {
setState(true);
}, 3000);
return () => {
clearTimeout(c26626_0);
};
}
setState(false);
}, [stateFromStores]);
return state;
}
export function ChannelHeaderLoadingIndicator() {
const styles = useStyles();
const stateFromStores2 = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
const stateFromStores3 = useStateFromStores([UserStore], () => {
const currentUser = UserStore.getCurrentUser();
return (currentUser == null ? void 0 : currentUser.isStaff()) || (currentUser == null ? void 0 : currentUser.isStaffPersonal());
});
const t = function t() {
let r56;
const r7 = {
transform: null
};
if (stateFromStores2) {
r7.transform = [];
r56 = r7;
} else {
r7.transform = [{
scale: _ReanimatedRexport.withRepeat(_ReanimatedRexport.withSequence(_timing.withTiming(1, {
duration: 0
}), _timing.withTiming(0.5, {
duration: 1500,
easing: _ReanimatedRexport.Easing.bezier(0.4, 0, 0.2, 1)
}), _timing.withTiming(1, {
duration: 1500,
easing: _ReanimatedRexport.Easing.bezier(0.4, 0, 0.2, 1)
})), -1)
}];
r56 = r7;
}
return r56;
};
t.__closure = {
useReducedMotion: stateFromStores2,
withRepeat: _ReanimatedRexport.withRepeat,
withSequence: _ReanimatedRexport.withSequence,
withTiming: _timing.withTiming,
Easing: _ReanimatedRexport.Easing
};
t.__workletHash = 17454673879926;
t.__initData = __initData;
const r69 = <View style={styles.container}>
<ReanimatedRexport.View style={[styles.pulse, useAnimatedStyle(t)]} />
<Text variant="text-xs/medium" color="text-muted">
{intl.string(_index_native.t.JwIJMV)}
</Text>
</View>;
return stateFromStores3 ? <PressableOpacity onPress={openLoadingIndicatorDebugBody}>{r69}</PressableOpacity> : r69;
}
@@ -0,0 +1,15 @@
// Metro module 10143 (f10144).
import { createApexExperiment } from "../../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2026-01-chat-loading-indicator",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
export { apexExperiment as ChatLoadingIndicatorExperiment };
+30
View File
@@ -0,0 +1,30 @@
// Metro module 11150 (f11151).
import { TTIMeasurementView } from "../../tti_analytics/native/TTIMeasurementView";
import TTITracker from "../../tti_analytics/TTITracker";
export function ChatTTITracker(props) {
let r20, r23;
const messages = props.messages;
const r7 = messages.length > 0 ? <TTIMeasurementView key="cached_messages_tti" nativeID="cached_messages_tti" onMeasurement={function onMeasurement(event) {
TTITracker.displayMessagesWithCache.record(event.nativeEvent.timestamp);
}} /> : null;
L6: {
r20 = [r7, ,];
if (!messages.hasFetched) {
const ready = messages.ready;
r23 = null;
if (!ready) {
break L6;
}
const cached = messages.cached;
r23 = null;
if (cached) {
break L6;
}
}
r23 = <TTIMeasurementView key="latest_messages_tti" nativeID="latest_messages_tti" onMeasurement={function onMeasurement(event) {
TTITracker.displayLatestMessages.record(event.nativeEvent.timestamp);
}} />;
}
r20[1] = r23;
return <>{r20}</>;
}
+89
View File
@@ -0,0 +1,89 @@
// Metro module 10487 (f10488).
import { NativeEventEmitter, NativeModules } from "react-native";
const DCDChatBlockerManager = NativeModules.DCDChatBlockerManager;
class ChatUpdatesQueue {
constructor(a0, a1) {
let c18008_0 = this;
this.blockers = new Set();
this.queue = [];
this.queueStartTimestamp = null;
this.setOnFlushItem = (a0) => {
c18008_0.onFlushItem = a0;
};
this.getReactTag = a0;
this.onFlushItem = a1;
this.eventEmitter = new NativeEventEmitter(DCDChatBlockerManager);
this.addBlockerSubscription = this.eventEmitter.addListener("AddBlocker", ({ blockerId, reactTag }) => {
const reactTag2 = this.getReactTag();
if (reactTag != null && reactTag === reactTag2) {
this.addBlocker(blockerId);
}
});
this.removeBlockerSubscription = this.eventEmitter.addListener("RemoveBlocker", ({ blockerId, reactTag }) => {
const reactTag2 = this.getReactTag();
if (reactTag != null && reactTag === reactTag2) {
this.removeBlocker(blockerId);
}
});
}
hasUpdates() {
return this.queue.length > 0;
}
get isBlocking() {
return this.hasUpdates() || this.blockers.size > 0;
}
addBlocker(a0) {
if (a0 != null) {
this.blockers.add(a0);
}
}
removeBlocker(a0) {
if (a0 != null) {
this.blockers.delete(a0);
if (this.blockers.size === 0) {
this.flush();
}
}
}
add(a0) {
if (this.queueStartTimestamp == null) {
this.queueStartTimestamp = Date.now();
}
this.queue.push(a0);
let r2 = this.queue.length > 100;
const r17 = this.queueStartTimestamp != null && Date.now() - this.queueStartTimestamp > 30000;
if (!r2) {
r2 = r17;
}
if (r2) {
this.blockers.clear();
this.flush();
}
}
tryFlush() {
if (this.blockers.size === 0) {
this.flush();
}
}
clear() {
this.queue = [];
this.queueStartTimestamp = null;
}
flush() {
this.queueStartTimestamp = null;
this.queue.forEach((item) => {
if (item != null) {
const onFlushItem = this.onFlushItem;
if (onFlushItem != null) {
onFlushItem.call(this, item);
}
}
});
this.queue = [];
}
cleanup() {
this.addBlockerSubscription.remove();
this.removeBlockerSubscription.remove();
}
}
export default ChatUpdatesQueue;
+222
View File
@@ -0,0 +1,222 @@
// Metro module 10413 (f10414).
import * as Module19 from "react";
import { useEffect, useMemo, useRef, useCallback, useLayoutEffect } from "react";
import { StyleSheet } from "react-native";
import GatewayConnectionStore from "../../gateway/GatewayConnectionStore";
import { createChannelRecord } from "../../../records/ChannelRecord";
import ChannelStore from "../../../stores/ChannelStore";
import MessageStore from "../../../stores/MessageStore";
import { ChannelTypes } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { dismissKeyboard } from "../../../utils/native/ChatInputUtils";
import { useStateFromStores, useStateFromStoresObject } from "../../../_bundle/Module589";
import { intl, t } from "../../../intl/index.native";
import { useIsChannelContentGated } from "../../age_gate/AgeGateUtils";
import { useGetSpoilerGatingChannelId } from "../../spoiler_channels/SpoilerChannelUtils";
import useInitialValue from "../../../hooks/useInitialValue";
import VisibleMessagesWindowHandler from "../../messages/native/VisibleMessagesWindowHandler";
import useIsSelectedResourceChannel from "../../guild_onboarding_home/useIsSelectedResourceChannel";
import { trackAppUIViewed } from "../../tti_analytics/native/TTIAnalyticsUtils";
import LazyLoadedThreadManager from "../../threads/LazyLoadedThreadManager";
import { fetchSummaries } from "../../summaries/SummaryActionCreators";
import { clearOldestUnreadMessageId } from "../../../actions/ReadStateActionCreators";
import ChatViewWrapper from "./ChatViewWrapper";
import ChatViewStickyHeader from "./ChatViewStickyHeader";
import Messages from "../../messages/native/Messages";
import ChatInput from "../../chat_input/native/ChatInput";
import ChatBeginningRow from "../../../components_native/chat/ChatBeginningRow";
import { isAndroid } from "../../../utils/PlatformUtils";
import PortalKeyboardInlineComponent_ios from "../../keyboard/native/PortalKeyboardInlineComponent.ios";
import ChatPlaceholder from "./placeholder/ChatPlaceholder";
import JumpToPresentButton from "../../../components_native/chat/JumpToPresentButton";
import ChannelSafeAreaBottom_android from "../../main_tabs_v2/native/channel/ChannelSafeAreaBottom.android";
import VoiceMessageOverlay from "../../voice_messages/native/components/VoiceMessageOverlay";
import StartupProfiler, { Profiles } from "../../app_startup/StartupProfiler";
import ChatViewPopups from "./ChatViewPopups";
import ThemedGradient from "../../client_themes/native/ThemedGradient";
import TTITracker from "../../tti_analytics/TTITracker";
import { shouldNSFWGateGuild } from "../../age_gate/native/AgeGateUtils";
import NsfwGateChat from "../../age_gate/native/components/NsfwGateChat";
import * as _native from "../../../design/void/native";
import GuildNSFW from "../../../components_native/warnings/GuildNSFW";
import ChannelSpoiler from "../../spoiler_channels/native/ChannelSpoiler";
import GuildDirectory from "../../directory_channels/native/components/GuildDirectory";
import ForumChannel from "../../forums/native/ForumChannel";
const useStyles = createStyles({
empty: {
flex: 1,
borderTopWidth: StyleSheet.hairlineWidth,
borderTopColor: Module712.colors.BORDER_SUBTLE
},
messages: {
flex: 1,
overflow: "hidden"
},
chat: {
backgroundColor: Module712.colors.CHANNEL_BACKGROUND_DEFAULT,
justifyContent: "flex-start",
overflow: "hidden",
flex: 1
}
});
const r54 = Module19.memo(function ChatView(props) {
let r128, r134;
let alwaysRespectKeyboard2 = props.alwaysRespectKeyboard;
if (alwaysRespectKeyboard2 === void 0) {
alwaysRespectKeyboard2 = false;
}
let stateFromStores, channel, ref, ref2, ref3, visibleMessagesWindowHandler, isResourceChannel, shouldRenderPlaceholder, shouldRenderBegginingRow, callback, callback2, callback3, callback4;
const alwaysRespectKeyboard = alwaysRespectKeyboard2;
const { channelId, chatInputRef, disableGradient = false, guildId, HACK_fixModalInteraction, screenIndex, secondaryTextFieldRef, setNoExtractUI } = props;
stateFromStores = void 0;
channel = void 0;
ref = void 0;
ref2 = void 0;
ref3 = void 0;
visibleMessagesWindowHandler = void 0;
isResourceChannel = void 0;
shouldRenderPlaceholder = void 0;
shouldRenderBegginingRow = void 0;
callback = void 0;
callback2 = void 0;
callback3 = void 0;
callback4 = void 0;
const styles = useStyles();
useEffect(() => {
if (!alwaysRespectKeyboard) {
dismissKeyboard();
}
}, [channelId, alwaysRespectKeyboard]);
let r37 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId));
stateFromStores = r37;
const memo = useMemo(() => ({
channel: stateFromStores == null ? createChannelRecord({
id: channelId,
type: ChannelTypes.GUILD_TEXT,
name: intl.string(t.ZTNur7)
}) : stateFromStores,
channelIsLoading: stateFromStores == null
}), [stateFromStores, channelId]);
const channelIsLoading = memo.channelIsLoading;
channel = memo.channel;
const isChannelContentGated = useIsChannelContentGated(channel);
if (stateFromStores == null) {
r37 = null;
}
const getSpoilerGatingChannelId = useGetSpoilerGatingChannelId(r37);
ref = useRef(channelId);
ref2 = useRef(null);
ref3 = useRef(null);
visibleMessagesWindowHandler = useInitialValue(() => new VisibleMessagesWindowHandler());
isResourceChannel = useIsSelectedResourceChannel(channelId);
const stateFromStoresObject = useStateFromStoresObject([MessageStore], () => {
const messages = MessageStore.getMessages(channelId);
const shouldRenderPlaceholder2 = messages.length === 0 && (messages.loadingMore || !messages.ready);
const hasMoreBefore = messages.hasMoreBefore;
return {
shouldRenderPlaceholder: shouldRenderPlaceholder2,
shouldRenderBegginingRow: hasMoreBefore ? !hasMoreBefore : !isResourceChannel
};
}, [channelId, isResourceChannel]);
shouldRenderPlaceholder = stateFromStoresObject.shouldRenderPlaceholder;
shouldRenderBegginingRow = stateFromStoresObject.shouldRenderBegginingRow;
callback = useCallback((a0) => {
const current = ref3.current;
if (current != null) {
current.onChatViewScrolled(a0);
}
}, []);
callback2 = useCallback((a0) => {
const keyCommand = a0.nativeEvent.keyCommand;
const current = chatInputRef.current;
if (current != null) {
current.handlePressKey(keyCommand);
}
}, [chatInputRef]);
callback3 = useCallback(() => {
const current = ref2.current;
if (current != null) {
current.scrollToNewMessages();
}
}, [ref2]);
callback4 = useCallback(() => {
const current = ref2.current;
if (current != null) {
current.jumpToPresent();
}
}, [ref2]);
useLayoutEffect(() => trackAppUIViewed(), []);
useEffect(() => {
LazyLoadedThreadManager.loadThread(channelId);
fetchSummaries(channelId);
}, [channelId]);
useEffect(() => {
ref.current = channel.id;
}, [channel.id]);
useEffect(() => () => {
clearOldestUnreadMessageId(ref.current);
}, []);
const props2 = {
profile: Profiles.ChatView,
children: null
};
const children = [<ChatViewPopups channelId={channelId} guildId={guildId} />, , ,];
const r116 = disableGradient ? null : <ThemedGradient absolute />;
L31: {
children[1] = r116;
if (shouldNSFWGateGuild(guildId)) {
r128 = <NsfwGateChat />;
TTITracker.setInterstitial("NsfwGateChat");
} else {
const renderMessagesWrapper = function renderMessagesWrapper() {
return <>
<ChatViewWrapper style={styles.messages} channelId={channelId} stickyHeader={<ChatViewStickyHeader channel={channel} ref={ref3} scrollToNewMessages={callback3} />}>
<Messages alwaysRespectKeyboard={alwaysRespectKeyboard} channel={channel} screenIndex={screenIndex} chatInputRef={chatInputRef} HACK_fixModalInteraction={HACK_fixModalInteraction} isResourceChannel={isResourceChannel} onPressKey={callback2} onScroll={callback} ref={ref2} style={styles.chat} visibleMessagesWindowHandler={visibleMessagesWindowHandler}>
<ChatInput ref={chatInputRef} channel={channel} isResourceChannel={isResourceChannel} screenIndex={screenIndex} secondaryTextFieldRef={secondaryTextFieldRef} setNoExtractUI={setNoExtractUI} onJumpToPresent={callback4} />
<ChatBeginningRow channelId={channelId} guildId={channel.getGuildId()} shouldRender={shouldRenderBegginingRow} />
</Messages>
{isAndroid() ? null : <PortalKeyboardInlineComponent_ios channelId={channel.id} messagesRef={ref2} />}
{shouldRenderPlaceholder ? <ChatPlaceholder screenIndex={screenIndex} /> : null}
{isAndroid() ? <JumpToPresentButton channelId={channelId} screenIndex={screenIndex} onJumpToPresent={callback4} /> : null}
</ChatViewWrapper>
<ChannelSafeAreaBottom_android channelId={channelId} />
<VoiceMessageOverlay channelId={channelId} />
</>;
};
if (channelIsLoading && !GatewayConnectionStore.isConnected()) {
r128 = renderMessagesWrapper();
break L31;
}
L28: {
if (channelIsLoading) {
r134 = <_native.EmptyState style={styles.empty} title={intl.string(t.ai6Lbr)} body={intl.string(t["LTr+x9"])} />;
TTITracker.setInterstitial("EmptyState");
} else if (isChannelContentGated) {
r134 = <GuildNSFW guildId={guildId} channelId={channelId} />;
TTITracker.setInterstitial("GuildNSFW");
} else {
if (getSpoilerGatingChannelId != null && getSpoilerGatingChannelId != null) {
r134 = <ChannelSpoiler key={channelId} guildId={guildId} channelId={getSpoilerGatingChannelId} />;
TTITracker.setInterstitial("ChannelSpoiler");
break L28;
}
if (channel.isDirectory()) {
r134 = <GuildDirectory channel={channel} guildId={guildId} />;
TTITracker.setInterstitial("GuildDirectory");
} else if (channel.isForumLikeChannel()) {
r134 = <ForumChannel channel={channel} />;
TTITracker.setInterstitial("ForumChannel");
} else {
r134 = renderMessagesWrapper();
}
}
}
r128 = r134;
}
}
children[2] = r128;
props2.children = children;
return <StartupProfiler {...props2} />;
});
export default r54;
+37
View File
@@ -0,0 +1,37 @@
// Metro module 11742 (f11743).
import { useRef, useEffect, memo } from "react";
import useIsHubRealNamePromptShowing from "../../hub/useIsHubRealNamePromptShowing";
import { useShowWelcomeModal, openWelcomeActionSheet } from "../../../utils/native/WelcomeScreenUtils";
import GuildDirectoryNicknameUpsellModalActionCreators from "../../directory_channels/native/components/GuildDirectoryNicknameUpsellModalActionCreators";
export function ChatViewPopups({ channelId, guildId }) {
const ref = useRef(false);
const isHubRealNamePromptShowing = useIsHubRealNamePromptShowing(guildId);
let c19124_2 = isHubRealNamePromptShowing;
const showWelcomeModal = useShowWelcomeModal(guildId, channelId);
useEffect(() => {
if (!ref.current) {
if (c19124_2) {
GuildDirectoryNicknameUpsellModalActionCreators.open({
guildId,
onHide: () => {
ref.current = false;
return false;
}
});
ref.current = true;
} else if (showWelcomeModal) {
openWelcomeActionSheet({
guildId,
onHide: () => {
ref.current = false;
return false;
}
});
ref.current = true;
}
}
}, [guildId, showWelcomeModal, isHubRealNamePromptShowing]);
return null;
}
const r17 = memo(ChatViewPopups);
export default r17;
@@ -0,0 +1,39 @@
// Metro module 10430 (f10431).
import { memo, forwardRef, useState, useImperativeHandle } from "react";
import { LOCATION_CONTEXT_MOBILE } from "../../self_mod/Constants";
import { useStrangerDangerWarning } from "../../self_mod/stranger_danger/hooks/useStrangerDangerWarning";
import { useInappropriateConversationBannerForChannel } from "../../self_mod/inappropriate_conversation/hooks/useInappropriateConversationBannerForChannel";
import { useLikelyAtoWarning } from "../../ato_alerts/hooks/useLikelyAtoWarning";
import LikelyAtoWarningBanner from "../../ato_alerts/native/components/LikelyAtoWarningBanner";
import StrangerDangerWarningBanner from "../../self_mod/stranger_danger/native/components/StrangerDangerWarningBanner";
import InappropriateConversationWarningBanner from "../../self_mod/inappropriate_conversation/native/components/InappropriateConversationWarningBanner";
import useUnreadSettingNotice from "../../notifications/settings_unread_notice/utils/useUnreadSettingNotice";
import ForumPostActionBar from "../../forums/native/ForumPostActionBar";
import UnreadSettingNotice from "../../notifications/settings_unread_notice/native/UnreadSettingNotice";
import ChatBanner from "../../messages/native/ChatBanner";
const ChatViewStickyHeaderAccountSafetyWarnings = function ChatViewStickyHeaderAccountSafetyWarnings(props) {
const { channelId, senderId } = props;
const strangerDangerWarning = useStrangerDangerWarning(channelId);
const inappropriateConversationBannerForChannel = useInappropriateConversationBannerForChannel(channelId, LOCATION_CONTEXT_MOBILE);
const likelyAtoWarning = useLikelyAtoWarning(channelId);
return likelyAtoWarning != null ? <LikelyAtoWarningBanner channelId={channelId} warningId={likelyAtoWarning.id} senderId={senderId} /> : strangerDangerWarning != null ? <StrangerDangerWarningBanner channelId={channelId} warningId={strangerDangerWarning.id} senderId={senderId} /> : inappropriateConversationBannerForChannel != null ? <InappropriateConversationWarningBanner channelId={channelId} warningId={inappropriateConversationBannerForChannel.id} senderId={senderId} /> : null;
};
const r30 = memo(forwardRef(function({ channel, scrollToNewMessages }, a1) {
const [state, setState] = useState(false);
const unreadSettingNotice = useUnreadSettingNotice(channel);
const { showUnreadsNotice, clearUnreadsNotice } = unreadSettingNotice;
useImperativeHandle(a1, () => ({
onChatViewScrolled: ({ isFirstMessageVisible }) => {
if (channel.isForumPost()) {
setState(!isFirstMessageVisible);
}
}
}));
return <>
{channel.isForumPost() ? state ? <ForumPostActionBar channel={channel} /> : null : null}
{channel.isDM() ? <ChatViewStickyHeaderAccountSafetyWarnings channelId={channel.id} senderId={channel.getRecipientId()} /> : null}
{showUnreadsNotice ? <UnreadSettingNotice channel={channel} clearUnreadsNotice={clearUnreadsNotice} /> : null}
<ChatBanner channel={channel} handleScrollToNewMessages={scrollToNewMessages} />
</>;
}));
export default r30;
@@ -0,0 +1,4 @@
// Metro module 10891 (f10892).
import { createContext } from "react";
const context = createContext(null);
export default context;
+6
View File
@@ -0,0 +1,6 @@
// Metro module 10418 (f10419).
import { isAnimatedAndroidKeyboard } from "../../keyboard/native/AnimatedKeyboardExperiment";
import ChatViewWrapperAnimatedKeyboard from "./ChatViewWrapperAnimatedKeyboard";
import ChatViewWrapperBase from "./ChatViewWrapperBase";
const r16 = isAnimatedAndroidKeyboard() ? ChatViewWrapperAnimatedKeyboard : ChatViewWrapperBase;
export default r16;
@@ -0,0 +1,110 @@
// Metro module 10420 (f10421).
import { memo, useMemo } from "react";
import { View } from "react-native";
import ReanimatedRexport, { Easing, useSharedValue, useAnimatedReaction, useAnimatedStyle } from "../../reanimated/ReanimatedRexport";
import { timingStandardDuration } from "../../../design/animation/reanimated/timing/timingPresets";
import useChannelSafeAreaHeightSharedValue_android from "../../main_tabs_v2/native/channel/useChannelSafeAreaHeightSharedValue.android";
import * as _timing from "../../../design/animation/reanimated/timing/timing";
import useCustomKeyboardHeight from "../../keyboard/native/useCustomKeyboardHeight";
import useChannelSafeAreaBottomStyles from "../../main_tabs_v2/native/channel/useChannelSafeAreaBottomStyles";
import useChatViewPointerEvents_android from "./useChatViewPointerEvents.android";
import { LayerScope } from "../../../design/components/Layers/native/LayerScope.native";
import { StickyWrapper } from "../../../design/components/Sticky/native/StickyWrapper.native";
const INSET_ANIMATION_CONFIG2 = {
duration: timingStandardDuration,
easing: Easing.bezier(0.2, 0, 0, 1)
};
const __initData = {
code: "function ChatViewWrapperAnimatedKeyboardTsx1(){const{animatedHeight}=this.__closure;return animatedHeight.get();}"
};
const __initData2 = {
code: "function ChatViewWrapperAnimatedKeyboardTsx2(height,heightPrev){const{animatedAdjustedMargin,animatedAdjustedMarginPending}=this.__closure;if(heightPrev==null){return;}if(height<heightPrev){animatedAdjustedMargin.set(height);animatedAdjustedMarginPending.set(-1);}else{animatedAdjustedMarginPending.set(height);}}"
};
const __initData3 = {
code: "function ChatViewWrapperAnimatedKeyboardTsx3(){const{animatedAdjustedMargin,withTiming,animatedHeight,INSET_ANIMATION_CONFIG2,animatedAdjustedMarginPending}=this.__closure;return{flex:1,marginTop:animatedAdjustedMargin.get(),transform:[{translateY:withTiming(-animatedHeight.get(),INSET_ANIMATION_CONFIG2,'respect-motion-settings',function(finished){if(!finished){return;}if(animatedAdjustedMarginPending.get()!==-1){animatedAdjustedMargin.set(animatedAdjustedMarginPending.get());animatedAdjustedMarginPending.set(-1);}})}]};}"
};
const __initData4 = {
code: "function ChatViewWrapperAnimatedKeyboardTsx4(finished){const{animatedAdjustedMarginPending,animatedAdjustedMargin}=this.__closure;if(!finished){return;}if(animatedAdjustedMarginPending.get()!==-1){animatedAdjustedMargin.set(animatedAdjustedMarginPending.get());animatedAdjustedMarginPending.set(-1);}}"
};
let Component = memo(function({ channelId }) {
const height = useCustomKeyboardHeight();
return <View style={[useChannelSafeAreaBottomStyles(channelId), useMemo(() => ({
position: "absolute",
bottom: -height,
height,
right: 0,
left: 0
}), [height])]} />;
});
export default function ChatViewWrapperAnimatedKeyboard(props) {
const { channelId, children, stickyHeader, style } = props;
const chatViewPointerEvents_android = useChatViewPointerEvents_android(channelId);
const channelSafeAreaHeightSharedValue_android = useChannelSafeAreaHeightSharedValue_android();
let c17942_0 = channelSafeAreaHeightSharedValue_android;
const sharedValue = useSharedValue(channelSafeAreaHeightSharedValue_android.get());
const sharedValue2 = useSharedValue(-1);
const n = () => c17942_0.get();
n.__closure = {
animatedHeight: channelSafeAreaHeightSharedValue_android
};
n.__workletHash = 9219066704490;
n.__initData = __initData;
const r36 = function t(a0, a1) {
if (a1 != null) {
if (a0 < a1) {
sharedValue.set(a0);
sharedValue2.set(-1);
} else {
sharedValue2.set(a0);
}
}
};
r36.__closure = {
animatedAdjustedMargin: sharedValue,
animatedAdjustedMarginPending: sharedValue2
};
r36.__workletHash = 15141457454312;
r36.__initData = __initData2;
useAnimatedReaction(n, r36);
const r43 = () => {
const r2 = {
flex: 1,
marginTop: sharedValue.get(),
transform: null
};
const r16 = -c17942_0.get();
const r24 = function t(a0) {
if (a0 ? sharedValue2.get() !== -1 : a0) {
sharedValue.set(sharedValue2.get());
sharedValue2.set(-1);
}
};
r24.__closure = {
animatedAdjustedMarginPending: sharedValue2,
animatedAdjustedMargin: sharedValue
};
r24.__workletHash = 16224255032954;
r24.__initData = __initData4;
r2.transform = [{
translateY: _timing.withTiming(r16, INSET_ANIMATION_CONFIG2, "respect-motion-settings", r24)
}];
return r2;
};
r43.__closure = {
animatedAdjustedMargin: sharedValue,
withTiming: _timing.withTiming,
animatedHeight: channelSafeAreaHeightSharedValue_android,
INSET_ANIMATION_CONFIG2,
animatedAdjustedMarginPending: sharedValue2
};
r43.__workletHash = 7205645695043;
r43.__initData = __initData3;
return <LayerScope>
<StickyWrapper header={stickyHeader} style={style} pointerEvents={chatViewPointerEvents_android}>
<ReanimatedRexport.View style={useAnimatedStyle(r43)}>
<View style={style}>{children}</View>
<Component channelId={channelId} />
</ReanimatedRexport.View>
</StickyWrapper>
</LayerScope>;
};
@@ -0,0 +1,10 @@
// Metro module 10429 (f10430).
import useChatViewPointerEvents_android from "./useChatViewPointerEvents.android";
import { LayerScope } from "../../../design/components/Layers/native/LayerScope.native";
import { StickyWrapper } from "../../../design/components/Sticky/native/StickyWrapper.native";
export default function ChatViewWrapperBase(props) {
const { channelId, children } = props;
return <LayerScope>
<StickyWrapper header={props.stickyHeader} style={props.style} pointerEvents={useChatViewPointerEvents_android(channelId)}>{children}</StickyWrapper>
</LayerScope>;
};
+183
View File
@@ -0,0 +1,183 @@
// Metro module 9465 (f9466).
import { NativeModules, findNodeHandle } from "react-native";
import { isIOS } from "../../../utils/PlatformUtils";
import { Commands } from "../../../_bundle/Module9466";
import SentryUtils_native from "../../../utils/SentryUtils.native";
import { isFabric } from "../../../utils/native/FabricUtils";
import { getAndIncrementChangesetIdForChat } from "./ChatChangesetUpdateTracker";
import Module9468 from "../../../_bundle/Module9468";
let c6242_5 = {
TOP: 0,
0: "TOP",
MIDDLE: 1,
1: "MIDDLE",
BOTTOM: 2,
2: "BOTTOM",
NONE: 3,
3: "NONE"
};
const r25 = {
SCROLL: 0,
0: "SCROLL",
FOCUS_ONLY: 1,
1: "FOCUS_ONLY"
};
const r29 = {
scrollTo: function scrollTo(a0, a1, a2) {
if (a0 != null) {
const r3 = a2 == null ? {} : a2;
const { animated = false, highlight = false, position = c6242_5.TOP } = r3;
if (isIOS()) {
const r30 = findNodeHandle(a0);
if (r30 != null) {
NativeModules.DCDChatManager.scrollTo(r30, a1, animated, highlight, position);
}
} else {
Commands.scrollTo(a0, a1, animated, highlight, position);
}
}
},
scrollToBottom: function scrollToBottom(a0, a1) {
if (a0 != null) {
if (isIOS()) {
const r17 = findNodeHandle(a0);
if (r17 != null) {
NativeModules.DCDChatManager.scrollToBottom(r17, a1);
}
} else {
Commands.scrollToBottom(a0, a1);
}
}
},
scrollToTop: function scrollToTop(a0, a1) {
if (a0 != null && isIOS()) {
const r11 = findNodeHandle(a0);
if (r11 != null) {
NativeModules.DCDChatManager.scrollToTop(r11, a1);
}
}
},
scrollToRelativeOffset: function scrollToRelativeOffset(a0, a1, a2) {
if (a0 != null && isIOS()) {
const r6 = findNodeHandle(a0);
if (r6 != null) {
NativeModules.DCDChatManager.scrollToRelativeOffset(r6, a1, a2);
}
}
},
scrollIntoView: function scrollIntoView(a0, a1, a2) {
if (a0 != null) {
const r2 = a2 == null ? {} : a2;
const { animated = false, highlight = false } = r2;
if (isIOS()) {
const r27 = findNodeHandle(a0);
if (r27 != null) {
NativeModules.DCDChatManager.scrollIntoView(r27, a1, animated, highlight);
}
} else {
Commands.scrollIntoView(a0, a1, animated, highlight);
}
}
},
updateRows: function updateRows(a0, a1) {
L28: {
if (a0 != null) {
if (isIOS() && isFabric()) {
const andIncrementChangesetIdForChat2 = getAndIncrementChangesetIdForChat(a0);
const rows = a1.rows;
let forceReload2 = a1.forceReload;
if (forceReload2 == null) {
forceReload2 = false;
}
SentryUtils_native.addBreadcrumb({
category: "chat.dispatch",
message: `updateRows dispatch id=${andIncrementChangesetIdForChat2} ops=${rows.length}`,
data: {
changesetUpdateId: andIncrementChangesetIdForChat2,
opCount: rows.length,
rows,
forceReload: forceReload2
}
});
const r83 = JSON.stringify(a1.rows);
const isLoadingAtTop2 = a1.isLoadingAtTop;
const r87 = a1.scrollData != null ? JSON.stringify(a1.scrollData) : "";
let HACK_iOSForceAnimations2 = a1.HACK_iOSForceAnimations;
if (HACK_iOSForceAnimations2 == null) {
HACK_iOSForceAnimations2 = false;
}
let forceReload3 = a1.forceReload;
if (forceReload3 == null) {
forceReload3 = false;
}
let isAnimated2 = a1.isAnimated;
if (isAnimated2 == null) {
isAnimated2 = true;
}
Commands.updateRows(a0, r83, isLoadingAtTop2, r87, andIncrementChangesetIdForChat2, HACK_iOSForceAnimations2, forceReload3, isAnimated2);
break L28;
}
const r17 = findNodeHandle(a0);
if (r17 == null) {
return void 0;
}
const r16 = isIOS() ? NativeModules.DCDChatManager : Module9468;
const r14 = JSON.stringify(a1.rows);
const isLoadingAtTop = a1.isLoadingAtTop;
const r11 = a1.scrollData != null ? JSON.stringify(a1.scrollData) : null;
const andIncrementChangesetIdForChat = getAndIncrementChangesetIdForChat(a0);
let HACK_iOSForceAnimations = a1.HACK_iOSForceAnimations;
if (HACK_iOSForceAnimations == null) {
HACK_iOSForceAnimations = false;
}
let forceReload = a1.forceReload;
if (forceReload == null) {
forceReload = false;
}
let isAnimated = a1.isAnimated;
if (isAnimated == null) {
isAnimated = true;
}
r16.updateRows(r17, r14, isLoadingAtTop, r11, andIncrementChangesetIdForChat, HACK_iOSForceAnimations, forceReload, isAnimated);
}
}
},
clearRows: function clearRows(a0) {
L10: {
if (a0 != null) {
if (isIOS() && isFabric()) {
Commands.clearRows(a0, getAndIncrementChangesetIdForChat(a0));
break L10;
}
const r8 = findNodeHandle(a0);
if (r8 == null) {
return void 0;
}
(isIOS() ? NativeModules.DCDChatManager : Module9468).clearRows(r8, getAndIncrementChangesetIdForChat(a0));
}
}
},
fadeIn: function fadeIn(a0) {
if (a0 != null && isIOS()) {
if (isFabric()) {
Commands.fadeIn(a0);
} else {
const r15 = findNodeHandle(a0);
if (r15 != null) {
NativeModules.DCDChatManager.fadeIn(r15);
}
}
}
},
focus: function focus(a0, a1) {
if (isIOS() && a0 != null) {
const r5 = findNodeHandle(a0);
if (r5 != null) {
NativeModules.DCDChatManager.focus(r5, a1);
}
}
}
};
export default r29;
export { c6242_5 as ChatScrollPosition };
export { r25 as ChatScrollType };
@@ -0,0 +1,91 @@
// Metro module 16657 (f16658).
import { NativeModules } from "react-native";
import LocaleStore from "../../user_settings/LocaleStore";
import AuthenticationStore from "../../../stores/AuthenticationStore";
import { isIOS, isAndroid } from "../../../utils/PlatformUtils";
import { shouldEnableYYTextReplacement } from "../../messages/YYTextReplacementExperiment";
import { isIOSPushNotificationRawPayloadFixExperimentEnabled } from "../../notifications/IOSPushNotificationRawPayloadFixExperiment";
import VideoStutterMitigationExperiment from "../../media_engine/VideoStutterMitigationExperiment";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import NotificationLoadMessagesExperiment from "../../cache/NotificationLoadMessagesExperiment";
import { getAPIBaseURL } from "../../../_bundle/sendRequest";
import AutomaticLifecycleManager from "../../../lib/AutomaticLifecycleManager";
let updateIOSExperiments, updateAndroidExperiments;
const syncYYTextReplacementExperiment = function syncYYTextReplacementExperiment() {
if (isIOS()) {
const NSUserDefaultsBridge = NativeModules.NSUserDefaultsBridge;
if (NSUserDefaultsBridge != null) {
const setShouldEnableYYTextReplacement = NSUserDefaultsBridge.setShouldEnableYYTextReplacement;
if (setShouldEnableYYTextReplacement != null) {
setShouldEnableYYTextReplacement.call(NSUserDefaultsBridge, shouldEnableYYTextReplacement({
location: "NativeExperimentBridgeManager"
}));
}
}
}
};
updateIOSExperiments = function updateIOSExperiments() {
if (isIOS()) {
const NSUserDefaultsBridge = NativeModules.NSUserDefaultsBridge;
if (NSUserDefaultsBridge != null) {
const setShouldEnableYYTextReplacement = NSUserDefaultsBridge.setShouldEnableYYTextReplacement;
if (setShouldEnableYYTextReplacement != null) {
setShouldEnableYYTextReplacement.call(NSUserDefaultsBridge, shouldEnableYYTextReplacement({
location: "NativeExperimentBridgeManager"
}));
}
}
}
const NSUserDefaultsBridge2 = NativeModules.NSUserDefaultsBridge;
if (NSUserDefaultsBridge2 != null) {
const setShouldFixPushNotificationRawPayload = NSUserDefaultsBridge2.setShouldFixPushNotificationRawPayload;
if (setShouldFixPushNotificationRawPayload != null) {
setShouldFixPushNotificationRawPayload.call(NSUserDefaultsBridge2, isIOSPushNotificationRawPayloadFixExperimentEnabled());
}
}
if (VideoStutterMitigationExperiment.getConfig({
location: "NativeExperimentBridgeManager"
}).enabled) {
const RNVVideo = NativeModules.RNVVideo;
if (RNVVideo != null) {
RNVVideo.setOptimizeConfigureAudio(true);
}
const RNVVideo2 = NativeModules.RNVVideo;
if (RNVVideo2 != null) {
RNVVideo2.setUseBackgroundProgressQueue(true);
}
}
};
updateAndroidExperiments = function updateAndroidExperiments() {
const headers = {
"X-Super-Properties": AnalyticsUtils.getSuperPropertiesBase64(),
"X-Fingerprint": AuthenticationStore.getFingerprint(),
"X-Installation-ID": AuthenticationStore.getInstallationForTracking(),
"X-Discord-Locale": LocaleStore.locale
};
const config = NotificationLoadMessagesExperiment.getConfig({
location: "NativeExperimentBridgeManager"
});
const { enabled, limit, cooldownMs, debounceMs } = config;
const NativeCacheModule = NativeModules.NativeCacheModule;
if (NativeCacheModule != null) {
NativeCacheModule.setItem("notificationNetworkRequest", JSON.stringify({
headers,
userId: AuthenticationStore.getId(),
enabled,
apiBaseUrl: getAPIBaseURL(),
urlQueryParams: `?limit=${limit}`,
cooldownMs,
debounceMs
}));
}
};
class NativeExperimentBridgeManager extends AutomaticLifecycleManager {
handleUpdate = isIOS() ? updateIOSExperiments : isAndroid() ? updateAndroidExperiments : () => {};
actions = {
APP_STATE_UPDATE: syncYYTextReplacementExperiment,
POST_CONNECTION_OPEN: this.handleUpdate
};
}
const nativeExperimentBridgeManager = new NativeExperimentBridgeManager();
export default nativeExperimentBridgeManager;
+41
View File
@@ -0,0 +1,41 @@
// Metro module 11428 (f11429).
import * as Module19 from "react";
import { useMemo, useCallback } from "react";
import SlowmodeStore from "../../../stores/SlowmodeStore";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useStateFromStores } from "../../../_bundle/Module589";
import { useCanBypassSlowmode, getSlowmodeIndicatorText, getSlowmodeDescription } from "../SlowmodeUtils";
import ToastActionCreators from "../../toast/native/ToastActionCreators";
import { TimerIcon } from "../../../design/components/Icon/native/redesign/generated/TimerIcon";
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
import { Text } from "../../../design/components/Text/native/Text";
const useStyles = createStyles({
container: {
alignItems: "center",
flexDirection: "row"
},
icon: {
marginLeft: Module712.space.PX_4
}
});
const r34 = Module19.memo(function SlowModeIndicator(props) {
let canBypassSlowmode;
const { channel, hasTypingText, slowmodeType } = props;
canBypassSlowmode = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([SlowmodeStore], () => SlowmodeStore.getSlowmodeCooldownGuess(channel.id, slowmodeType));
canBypassSlowmode = useCanBypassSlowmode(channel);
const memo = useMemo(() => hasTypingText && !canBypassSlowmode ? stateFromStores <= 0 ? null : getSlowmodeIndicatorText(stateFromStores, canBypassSlowmode) : getSlowmodeIndicatorText(stateFromStores, canBypassSlowmode), [hasTypingText, canBypassSlowmode, stateFromStores]);
return <PressableOpacity onPress={useCallback(() => {
ToastActionCreators.open({
key: "CHANNEL_SLOWMODE_INFO",
IconComponent: TimerIcon,
content: getSlowmodeDescription(channel.rateLimitPerUser)
});
}, [channel.rateLimitPerUser])} style={styles.container}>
<Text lineClamp={1} allowFontScaling={false} variant="text-xs/medium" color="interactive-text-default">{memo}</Text>
<TimerIcon style={styles.icon} size="xxs" />
</PressableOpacity>;
});
export default r34;
+146
View File
@@ -0,0 +1,146 @@
// Metro module 11427 (f11428).
import { useCallback, useEffect, memo, useMemo } from "react";
import { View } from "react-native";
import { useChatShowingAutoComplete } from "../../chat_input/native/useChatBottomManagerUIStore";
import { SlowmodeType } from "../../../stores/SlowmodeStore";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useMobileVisualRefreshConfig } from "../../themes/experiments/MobileVisualRefreshExperiment";
import useTypingText from "../useTypingText";
import ReanimatedRexport, { useSharedValue, useAnimatedReaction, useAnimatedStyle } from "../../reanimated/ReanimatedRexport";
import * as _TransitionGroup from "../../../design/components/TransitionGroup/TransitionGroup";
import { TransitionItem } from "../../../design/components/TransitionGroup/TransitionGroup";
import * as _spring from "../../../design/animation/reanimated/spring/spring";
import * as _springPresets from "../../../design/animation/reanimated/spring/springPresets";
import { useToken } from "../../../design/tokens/native/useToken";
import { Ellipsis } from "../../../design/void/native";
import { Text } from "../../../design/components/Text/native/Text";
import SlowModeIndicator from "./SlowModeIndicator";
import { useTypingUserIds } from "../useTypingUsersIds";
let useStyles, __initData, __initData2, __initData3, renderTypingIndicator;
const TypingIndicatorInner = function TypingIndicatorInner(props) {
let sharedValue2;
const { channel: channel2, typingUserIds: typingUserIds2, transitionState, cleanUp } = props;
sharedValue2 = void 0;
const chatInputFloating = useMobileVisualRefreshConfig({
location: "TypingIndicatorInner"
}).chatInputFloating;
const typingText = useTypingText({
channelId: channel2.id,
guildId: channel2.getGuildId(),
typingUserIds: typingUserIds2
});
const sharedValue = useSharedValue(void 0);
const callback = useCallback((a0) => {
sharedValue.set(a0.nativeEvent.layout);
}, [sharedValue]);
const styles = useStyles();
sharedValue2 = useSharedValue(0);
useEffect(() => {
if (transitionState === _TransitionGroup.TransitionStates.YEETED) {
sharedValue2.set(0);
cleanUp();
}
}, [cleanUp, transitionState, sharedValue2]);
const S = () => sharedValue.get();
S.__closure = {
typingIndicatorLayout: sharedValue
};
S.__workletHash = 10758673194436;
S.__initData = __initData;
const f = function f(a0, a1) {
if (a0 !== a1 && a0 != null && a0.y.toFixed(2) === a0.height.toFixed(2)) {
sharedValue2.set(_spring.withSpring(-a0.height, _springPresets.springStandard, "respect-motion-settings"));
}
};
f.__closure = {
translateYValue: sharedValue2,
withSpring: _spring.withSpring,
springStandard: _springPresets.springStandard
};
f.__workletHash = 14874351700395;
f.__initData = __initData2;
useAnimatedReaction(S, f);
const E = function E() {
const r8 = sharedValue.get();
return {
opacity: sharedValue2.get() !== 0 ? transitionState === _TransitionGroup.TransitionStates.YEETED ? 0 : 1 : 0,
top: r8?.height,
transform: [{
translateY: sharedValue2.get()
}]
};
};
E.__closure = {
typingIndicatorLayout: sharedValue,
translateYValue: sharedValue2,
transitionState,
TransitionStates: _TransitionGroup.TransitionStates
};
E.__workletHash = 15240163018691;
E.__initData = __initData3;
const animatedStyle = useAnimatedStyle(E);
const token = useToken(Module712.modules.mobile.CHAT_INPUT_CONTAINER_HORIZONTAL_PADDING);
return <ReanimatedRexport.View style={[styles.typingWrapper, chatInputFloating ? [styles.floatingWrapper, {
paddingLeft: 2 * token
}] : void 0, animatedStyle]} onLayout={callback}>
<View style={styles.wrapperHoriz}>
<View style={styles.horiz}>
{typingText != null ? <Ellipsis /> : null}
<Text style={styles.text} lineClamp={1} maxFontSizeMultiplier={2} variant="text-xs/medium" color="interactive-text-default" ellipsizeMode="tail">{typingText}</Text>
</View>
{channel2.rateLimitPerUser > 0 ? <SlowModeIndicator channel={channel2} hasTypingText={typingText != null} slowmodeType={SlowmodeType.SendMessage} /> : null}
</View>
</ReanimatedRexport.View>;
};
renderTypingIndicator = function renderTypingIndicator(a0, a1, a2, a3) {
return <TypingIndicatorInner key={a0} {...a1} transitionState={a2} cleanUp={a3} />;
};
useStyles = createStyles({
typingWrapper: {
paddingTop: Module712.modules.mobile.CHAT_INPUT_FLOATING_ACCESSORY_PADDING_TOP,
paddingBottom: 4,
paddingHorizontal: 16,
alignSelf: "stretch",
backgroundColor: Module712.colors.MOBILE_TYPING_INDICATOR_BACKGROUND_DEFAULT
},
floatingWrapper: {
backgroundColor: "transparent",
paddingRight: Module712.modules.mobile.CHAT_INPUT_CONTAINER_HORIZONTAL_PADDING
},
wrapperHoriz: {
justifyContent: "space-between",
flexDirection: "row",
alignItems: "center"
},
horiz: {
marginRight: Module712.space.PX_8,
alignItems: "center",
flexDirection: "row",
flex: 1
},
text: {
flex: 1
}
});
__initData = {
code: "function TypingIndicatorTsx1(){const{typingIndicatorLayout}=this.__closure;return typingIndicatorLayout.get();}"
};
__initData2 = {
code: "function TypingIndicatorTsx2(current,prev){const{translateYValue,withSpring,springStandard}=this.__closure;if(current===prev)return;if(current==null)return;if(current.y.toFixed(2)!==current.height.toFixed(2))return;translateYValue.set(withSpring(-current.height,springStandard,'respect-motion-settings'));}"
};
__initData3 = {
code: "function TypingIndicatorTsx3(){const{typingIndicatorLayout,translateYValue,transitionState,TransitionStates}=this.__closure;const layout=typingIndicatorLayout.get();return{opacity:translateYValue.get()===0||transitionState===TransitionStates.YEETED?0:1,top:layout===null||layout===void 0?void 0:layout.height,transform:[{translateY:translateYValue.get()}]};}"
};
const r63 = memo(function({ channel, screenIndex }) {
const chatShowingAutoComplete = useChatShowingAutoComplete(screenIndex);
const typingUserIds = useTypingUserIds(channel.id, 4);
return <TransitionItem item={useMemo(() => channel.rateLimitPerUser > 0 ? chatShowingAutoComplete ? void 0 : {
channel,
typingUserIds
} : typingUserIds.length > 0 ? chatShowingAutoComplete ? void 0 : {
channel,
typingUserIds
} : void 0, [channel, typingUserIds, chatShowingAutoComplete])} renderItem={renderTypingIndicator} />;
});
export default r63;
+79
View File
@@ -0,0 +1,79 @@
// Metro module 9464 (f9465).
import AccessibilityStore from "../../a11y/AccessibilityStore";
import { RowType, SeparatorType } from "../../messages/native/renderer/RowGeneratorConstants";
import { ChatScrollType, ChatScrollPosition } from "./NativeChatUtils";
import { JumpType } from "../../../flow/Client";
function $mk82556($env) {
return (a0) => a0.message != null && a0.message.id === $env[0];
}
export default function computeScrollData(a0) {
const { rows, scrollToMessageId, jumpTargetId, jumpType, shouldInitialScroll } = a0;
let animated = a0.animated;
let scrollPosition = a0.scrollPosition;
const focusTargetId = a0.focusTargetId;
if (shouldInitialScroll && jumpTargetId == null) {
const r23 = rows.findIndex((row) => row.type === RowType.SEPARATOR && row.id === SeparatorType.UNREAD);
const index = r23 !== -1 ? r23 : void 0;
if (index != null) {
if (animated) {
animated = !AccessibilityStore.useReducedMotion;
}
return {
type: ChatScrollType.SCROLL,
index,
animate: animated,
highlight: false,
position: ChatScrollPosition.TOP
};
}
}
const r2 = scrollToMessageId != null;
let r25 = void 0;
if (r2) {
let env17240;
const r26 = env17240 = {};
env17240[0] = scrollToMessageId;
const r28 = rows.findIndex($mk82556(r26));
const index2 = r28 !== -1 ? r28 : void 0;
const r30 = index2 != null;
r25 = void 0;
if (r30) {
if (scrollPosition == null) {
scrollPosition = ChatScrollPosition.TOP;
}
r25 = {
type: ChatScrollType.SCROLL,
index: index2,
animate: AccessibilityStore.useReducedMotion ? !AccessibilityStore.useReducedMotion : jumpType !== JumpType.INSTANT,
highlight: scrollToMessageId === jumpTargetId,
position: scrollPosition
};
}
}
if (r25 == null) {
const r47 = focusTargetId != null;
let r48 = void 0;
if (r47) {
let env17241;
const r49 = env17241 = {};
env17241[0] = focusTargetId;
const r52 = rows.findIndex($mk82556(r49));
const index3 = r52 !== -1 ? r52 : void 0;
r48 = index3 != null ? {
type: ChatScrollType.FOCUS_ONLY,
index: index3
} : void 0;
}
r25 = r48;
}
return r25;
};
export function findMessageRowIndex(a0, a1) {
let env17239;
const r2 = env17239 = {};
env17239[0] = a1;
const r7 = a0.findIndex($mk82556(r2));
if (r7 !== -1) {
return r7;
}
}
@@ -0,0 +1,79 @@
// Metro module 11731 (f11732).
import * as Module19 from "react";
import { useMemo, useRef, useCallback } from "react";
import { StyleSheet } from "react-native";
import { useChatInputContainerHeight } from "../../../chat_input/native/useChatBottomManagerUIStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import useSafeAreaInsetsKeyboardAware_native from "../../../safe_area/useSafeAreaInsetsKeyboardAware.native";
import useWindowDimensions_native from "../../../screen/useWindowDimensions.native";
import useChatPlaceholderAnimatedStyles from "./useChatPlaceholderAnimatedStyles";
import getChatPlaceholderRowHeight from "./getChatPlaceholderRowHeight";
import ChatPlaceholderRow from "./ChatPlaceholderRow";
import ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
const useStyles = createStyles({
placeholder: {
...StyleSheet.absoluteFillObject,
paddingBottom: Module712.space.PX_24,
flexDirection: "column-reverse",
overflow: "hidden"
}
});
const r42 = Module19.memo(function ChatPlaceholder(props) {
let callback;
let ref;
const screenIndex = props.screenIndex;
callback = void 0;
const styles = useStyles();
const chatInputContainerHeight = useChatInputContainerHeight(screenIndex);
const height = useWindowDimensions_native().height;
const safeAreaInsets_native = useSafeAreaInsets_native();
const insets = useSafeAreaInsetsKeyboardAware_native({
isKeyboardAwareOnAndroid: false,
includeKeyboardHeight: true
}).insets;
const r28 = insets.bottom - safeAreaInsets_native.bottom;
const r13 = safeAreaInsets_native.top + insets.bottom;
let c19101_2 = r28;
let c19101_3 = r13;
const memo = useMemo(() => ({
marginBottom: chatInputContainerHeight + c19101_2
}), [chatInputContainerHeight, r28]);
ref = void 0;
ref = useRef([]);
callback = useCallback((a0) => {
let r10 = ref.current[a0];
if (r10 == null) {
const r16 = Math.floor(3 * Math.random()) + 1;
ref.current[a0] = r16;
r10 = r16;
}
return r10;
}, []);
return <ReanimatedRexport.View style={[styles.placeholder, memo, useChatPlaceholderAnimatedStyles({
visible: true,
animated: true
})]} pointerEvents="none">
{useMemo(() => {
const r4 = [];
let key = 0;
let r6 = 0;
while (true) {
const lines = callback(key);
r6 = r6 + getChatPlaceholderRowHeight(lines);
const props = {
lines
};
const r1 = key + 1;
r4.push(<ChatPlaceholderRow key={key} {...props} />);
const r26 = height - chatInputContainerHeight - c19101_3;
key = r1;
if (!(r6 < r26)) {
return r4;
}
}
}, [height, r13, chatInputContainerHeight, callback])}
</ReanimatedRexport.View>;
});
export default r42;
@@ -0,0 +1,59 @@
// Metro module 11734 (f11735).
import { memo } from "react";
import { View } from "react-native";
import { AVATAR_SIZE_MAP, AvatarSizes } from "../../../../design/void/native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { CHAT_PLACEHOLDER_ROW_MARGIN_TOP, CHAT_PLACEHOLDER_ROW_LINE_HEIGHT, CHAT_PLACEHOLDER_ROW_LINE_MARGIN_TOP } from "./getChatPlaceholderRowHeight";
import getChatPlaceholderRowWidth from "./getChatPlaceholderRowWidth";
const height = AVATAR_SIZE_MAP[AvatarSizes.NORMAL];
const useStyles = createStyles({
row: {
paddingLeft: Module712.space.PX_12,
paddingTop: CHAT_PLACEHOLDER_ROW_MARGIN_TOP,
flexDirection: "row"
},
rowInner: {
marginHorizontal: Module712.space.PX_12,
flex: 1
},
placeholderAvatar: {
backgroundColor: Module712.colors.BACKGROUND_MOD_MUTED,
height,
width: height,
borderRadius: Module712.radii.round
},
placeholderText: {
backgroundColor: Module712.colors.BACKGROUND_MOD_MUTED,
height: CHAT_PLACEHOLDER_ROW_LINE_HEIGHT,
borderRadius: Module712.radii.sm
},
placeholderBody: {
marginTop: CHAT_PLACEHOLDER_ROW_LINE_MARGIN_TOP,
width: "100%"
}
});
const r75 = memo(function ChatPlaceholderRow(props) {
const lines = props.lines;
const styles = useStyles();
const r25 = Math.floor(10 * Math.random());
const r18 = Math.floor(50 * Math.random()) + 10;
const r33 = [];
let key = 0;
while (key < lines) {
r33.push(<View key={key} style={[styles.placeholderText, styles.placeholderBody, {
width: `${getChatPlaceholderRowWidth(r25 + key)}%`
}]} />);
key = key + 1;
}
return <View style={styles.row}>
<View style={styles.placeholderAvatar} />
<View style={styles.rowInner}>
<View style={[styles.placeholderText, {
width: `${r18}%`
}]} />
{r33}
</View>
</View>;
});
export default r75;
@@ -0,0 +1,14 @@
// Metro module 11733 (f11734).
import Module712 from "../../../../_bundle/Module712";
import { AVATAR_SIZE_MAP, AvatarSizes } from "../../../../design/void/native";
const PX_24 = Module712.space.PX_24;
let c8035_1 = AVATAR_SIZE_MAP[AvatarSizes.NORMAL];
const PX_16 = Module712.space.PX_16;
const PX_12 = Module712.space.PX_12;
export default function getChatPlaceholderRowHeight(a0) {
return PX_24 + Math.max(c8035_1, PX_16 + a0 * (PX_16 + PX_12));
};
export { PX_24 as CHAT_PLACEHOLDER_ROW_MARGIN_TOP };
export { c8035_1 as CHAT_PLACEHOLDER_ROW_AVATAR_HEIGHT };
export { PX_16 as CHAT_PLACEHOLDER_ROW_LINE_HEIGHT };
export { PX_12 as CHAT_PLACEHOLDER_ROW_LINE_MARGIN_TOP };
@@ -0,0 +1,5 @@
// Metro module 10098 (f10099).
export default function getChatPlaceholderRowWidth(a0) {
const r8 = 10000 * Math.sin(a0);
return 40 * (r8 - Math.floor(r8)) + 60;
};
@@ -0,0 +1,40 @@
// Metro module 11732 (f11733).
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import { STANDARD_EASING } from "../../../../design/void/native";
import { useStateFromStores } from "../../../../_bundle/Module589";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import { useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import * as _timingPresets from "../../../../design/animation/reanimated/timing/timingPresets";
const TIMING_CONFIG = {
duration: 1300,
easing: STANDARD_EASING
};
const __initData = {
code: "function useChatPlaceholderAnimatedStylesTsx1(){const{visible,animated,useReducedMotion,withRepeat,withSequence,withTiming,timingNone,TIMING_CONFIG}=this.__closure;if(!visible){return{opacity:0};}else if(!animated||useReducedMotion){return{opacity:0.7};}return{opacity:withRepeat(withSequence(withTiming(0.3,timingNone),withTiming(0.7,TIMING_CONFIG),withTiming(0.3,TIMING_CONFIG)),-1)};}"
};
export default function useChatPlaceholderAnimatedStyles({ visible, animated }) {
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
const c = function c() {
return visible ? animated && !stateFromStores ? {
opacity: _ReanimatedRexport.withRepeat(_ReanimatedRexport.withSequence(_timing.withTiming(0.3, _timingPresets.timingNone), _timing.withTiming(0.7, TIMING_CONFIG), _timing.withTiming(0.3, TIMING_CONFIG)), -1)
} : {
opacity: 0.7
} : {
opacity: 0
};
};
c.__closure = {
visible,
animated,
useReducedMotion: stateFromStores,
withRepeat: _ReanimatedRexport.withRepeat,
withSequence: _ReanimatedRexport.withSequence,
withTiming: _timing.withTiming,
timingNone: _timingPresets.timingNone,
TIMING_CONFIG
};
c.__workletHash = 3375288363194;
c.__initData = __initData;
return useAnimatedStyle(c);
};
+18
View File
@@ -0,0 +1,18 @@
// Metro module 4043 (f4044).
import { useMemo } from "react";
import useWindowSizeClassifier, { WindowSizeClassifier, getWindowSizeClassifier } from "../../screen/native/useWindowSizeClassifier";
export default function useChatLayout() {
const windowSizeClassifier = useWindowSizeClassifier();
let c13804_0 = windowSizeClassifier;
return useMemo(() => ({
isChatBesideChannelList: c13804_0 >= WindowSizeClassifier.LARGE,
isChatLockedOpen: c13804_0 >= WindowSizeClassifier.XLARGE
}), [windowSizeClassifier]);
};
export function getChatLayout() {
const windowSizeClassifier = getWindowSizeClassifier();
return {
isChatBesideChannelList: windowSizeClassifier >= WindowSizeClassifier.LARGE,
isChatLockedOpen: windowSizeClassifier >= WindowSizeClassifier.XLARGE
};
}
@@ -0,0 +1,4 @@
// Metro module 10427 (f10428).
export default function useChatViewPointerEventsAndroid() {
return "auto";
};
+21
View File
@@ -0,0 +1,21 @@
// Metro module 10889 (f10890).
import { useContext } from "react";
import useChatLayout, { getChatLayout } from "./useChatLayout";
import useBaseAppContainerDimensions, { getBaseAppContainerDimensions } from "../../screen/native/useBaseAppContainerDimensions";
import { useDrawerWidth, getDrawerWidth } from "../../screen/native/drawer/useDrawerWidth";
import ChatViewWidthContext from "./ChatViewWidthContext";
export default function useChatWidth(a0) {
let r9 = useContext(ChatViewWidthContext);
const isChatLockedOpen = useChatLayout().isChatLockedOpen;
const width = useBaseAppContainerDimensions().width;
const drawerWidth = useDrawerWidth();
if (r9 == null) {
r9 = a0 != null ? a0 === 0 ? isChatLockedOpen ? width - drawerWidth : width : width : isChatLockedOpen ? width - drawerWidth : width;
}
return r9;
};
export function getChatWidth(a0) {
const isChatLockedOpen = getChatLayout().isChatLockedOpen;
const width = getBaseAppContainerDimensions().width;
return a0 != null ? a0 === 0 ? isChatLockedOpen ? width - getDrawerWidth() : width : width : isChatLockedOpen ? width - getDrawerWidth() : width;
}