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,11 @@
// Metro module 15554 (f15555).
import { useMemo } from "react";
import { useToken } from "../../../../../design/tokens/native/useToken";
import Module712 from "../../../../../_bundle/Module712";
import { hexWithOpacity } from "../../../../../utils/ColorUtils";
import TabsGradient_native from "../../../../../design/components/Tabs/native/TabsGradient.native";
export default function SearchTabsGradient(props) {
const state = props.state;
const token = useToken(Module712.colors.BACKGROUND_BASE_LOW);
return <TabsGradient_native state={state} colors={useMemo(() => [token, hexWithOpacity(token, 0)], [token])} />;
};
@@ -0,0 +1,240 @@
// Metro module 15475 (f15476).
import * as Module19 from "react";
import { useEffect, useMemo, useCallback, useRef, useContext } from "react";
import { View } from "react-native";
import SearchMessageStore from "../../../SearchMessageStore";
import SearchQueryStore from "../../stores/SearchQueryStore";
import SearchTabsLayoutStore from "../../stores/SearchTabsLayoutStore";
import { MESSAGE_SEARCH_RESULT_TABS_SET, SEARCH_MESSAGE_TAB_SENTINEL, SearchTabs } from "../../../SearchConstants";
import { ComponentActions } from "../../../../../Constants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import { debounce } from "../../../../../_bundle/Module12";
import Tracking from "../../tracking/Tracking";
import ErrorScreen from "./pages/ErrorScreen";
import { intl, t } from "../../../../../intl/index.native";
import { getTabTitle, getSearchTabFetchId, getSearchContextId } from "../../../SearchUtils";
import SearchTabsPage, { SearchTabsPageContext } from "./SearchTabsPage";
import SearchSessionAnalyticsManager from "../../../managers/native/SearchSessionAnalyticsManager";
import SearchPlatformUtils from "../../SearchPlatformUtils";
import { useSearchSegmentedControlState } from "./hooks/useSearchSegmentedControlState";
import { SwipeForMemberListContext } from "../../../../main_tabs_v2/native/channel/SwipeForMemberListWrapper";
import { Gesture } from "../../../../../_bundle/Module5273";
import { useSharedValue } from "../../../../reanimated/ReanimatedRexport";
import SearchPlatformActionCreators from "../../SearchPlatformActionCreators";
import SearchActionCreators from "../../../SearchActionCreators";
import SearchTabsFetchManager from "../../../managers/SearchTabsFetchManager";
import { ComponentDispatch } from "../../../../../utils/ComponentDispatchUtils";
import SearchTabsTransitionGroup from "./SearchTabsTransitionGroup";
import SearchTabsGradient from "./SearchTabsGradient";
import { SegmentedControlPages } from "../../../../../design/components/SegmentedControl/native/SegmentedControlPages.native";
import { useStateFromStoresObject } from "../../../../../_bundle/Module589";
import { useAutoSearchGuildChannelTab } from "../../hooks/useAutoSearchGuildChannelTab";
import { useAutoSearchMembersTab } from "../../hooks/useAutoSearchMembersTab";
import { useAutoSearchPeopleTab } from "../../hooks/useAutoSearchPeopleTab";
import { useAutoTrackSearchTabCountsViewedAnalytics } from "../../hooks/useAutoTrackSearchTabCountsViewedAnalytics";
let useStyles, c11009_16, __initData, __initData2, __initData3, Component;
const NoSearchResultsScreen = function NoSearchResultsScreen(props) {
const searchContext = props.searchContext;
useEffect(() => {
Tracking.trackSearchEmptyResult({
searchContext
});
}, [searchContext]);
return <ErrorScreen text={intl.string(t.V6nAfF)} />;
};
useStyles = createStyles({
controls: {
flex: 0,
minHeight: 32
},
pages: {
flex: 1
}
});
c11009_16 = debounce((a0) => Tracking.trackSearchTabSelected({
searchContext: a0
}), 500);
__initData = {
code: "function SearchTabsLayoutTsx1({contentOffset:contentOffset}){const{isDragging,disallowMemberListGesture}=this.__closure;var _disallowMemberListGe;isDragging.set(true);(_disallowMemberListGe=disallowMemberListGesture)===null||_disallowMemberListGe===void 0||_disallowMemberListGe.set(contentOffset.x>0);}"
};
__initData2 = {
code: "function SearchTabsLayoutTsx2(){const{isDragging,disallowMemberListGesture}=this.__closure;var _disallowMemberListGe;isDragging.set(false);(_disallowMemberListGe=disallowMemberListGesture)===null||_disallowMemberListGe===void 0||_disallowMemberListGe.set(false);}"
};
__initData3 = {
code: "function SearchTabsLayoutTsx3({contentOffset:contentOffset}){const{isDragging,disallowMemberListGesture}=this.__closure;if(isDragging.get()){var _disallowMemberListGe;(_disallowMemberListGe=disallowMemberListGesture)===null||_disallowMemberListGe===void 0||_disallowMemberListGe.set(contentOffset.x>0);}}"
};
Component = Module19.memo(function({ searchContext: searchContext2, visibleTabs, visibleTabCounts, width }) {
let selectedTab, setActiveIndex, callback, context, gesture, disallowGesture, channelId, screenIndex, sharedValue, callback2;
let visibleTabs2, setActiveIndex2, ref;
selectedTab = void 0;
setActiveIndex = void 0;
callback = void 0;
context = void 0;
gesture = void 0;
disallowGesture = void 0;
channelId = void 0;
screenIndex = void 0;
sharedValue = void 0;
callback2 = void 0;
const styles = useStyles();
const searchSegmentedControlState = useSearchSegmentedControlState({
items: useMemo(() => {
const r0 = [];
let c28035_0 = r0;
visibleTabs.forEach((visibleTab) => {
const r15 = {
label: getTabTitle(visibleTab),
id: visibleTab,
page: <SearchTabsPage tab={visibleTab} searchContext={searchContext2} width={width} />,
count: null
};
let count = visibleTabCounts == null ? void 0 : visibleTabCounts[visibleTab];
if (count == null) {
count = void 0;
}
r15.count = count;
c28035_0.push(r15);
});
return r0;
}, [visibleTabCounts, visibleTabs, searchContext2, width]),
visibleTabs,
onSelectedTabChange: useCallback((a0) => {
SearchSessionAnalyticsManager.setSelectedTab(searchContext2, a0);
c11009_16(searchContext2);
const searchTabFetchId = getSearchTabFetchId(searchContext2, SEARCH_MESSAGE_TAB_SENTINEL, SearchQueryStore.getQueryString(searchContext2));
const isFetching = SearchMessageStore.getIsFetching(searchTabFetchId);
const isInitialFetchComplete = SearchMessageStore.getIsInitialFetchComplete(searchTabFetchId);
const r29 = MESSAGE_SEARCH_RESULT_TABS_SET.has(a0);
if (!((r29 ? isInitialFetchComplete : !r29) || isFetching)) {
SearchPlatformUtils.fetchInitialMessagesDebounced(searchContext2);
}
}, [searchContext2]),
width
});
const segmentedControlState = searchSegmentedControlState.segmentedControlState;
selectedTab = searchSegmentedControlState.selectedTab;
setActiveIndex = segmentedControlState.setActiveIndex;
visibleTabs2 = visibleTabs;
setActiveIndex2 = setActiveIndex;
ref = void 0;
ref = useRef(() => {
setActiveIndex2(visibleTabs2.findIndex((item) => item === SearchTabs.MEDIA));
});
useEffect(() => {
ref.current = () => {
setActiveIndex2(visibleTabs2.findIndex((item) => item === SearchTabs.MEDIA));
};
}, [visibleTabs, setActiveIndex]);
callback = useCallback(() => ref.current(), []);
const memo2 = useMemo(() => ({
selectedTab,
selectMediaTab: callback
}), [callback, selectedTab]);
context = useContext(SwipeForMemberListContext);
const r58 = context == null ? {} : context;
gesture = r58.gesture;
disallowGesture = r58.disallowGesture;
channelId = r58.channelId;
screenIndex = r58.screenIndex;
const memo = useMemo(() => {
if (gesture != null) {
return Gesture.Native().simultaneousWithExternalGesture(gesture);
}
}, [gesture]);
sharedValue = useSharedValue(false);
const D = function D({ contentOffset }) {
sharedValue.set(true);
if (disallowGesture != null) {
disallowGesture.set(contentOffset.x > 0);
}
};
D.__closure = {
isDragging: sharedValue,
disallowMemberListGesture: disallowGesture
};
D.__workletHash = 766628353255;
D.__initData = __initData;
const callback4 = useCallback(D, [disallowGesture, sharedValue]);
const G = function G() {
sharedValue.set(false);
if (disallowGesture != null) {
disallowGesture.set(false);
}
};
G.__closure = {
isDragging: sharedValue,
disallowMemberListGesture: disallowGesture
};
G.__workletHash = 5683301645106;
G.__initData = __initData2;
const callback3 = useCallback(G, [disallowGesture, sharedValue]);
const A = function A({ contentOffset }) {
if (sharedValue.get() && disallowGesture != null) {
disallowGesture.set(contentOffset.x > 0);
}
};
A.__closure = {
isDragging: sharedValue,
disallowMemberListGesture: disallowGesture
};
A.__workletHash = 229712012692;
A.__initData = __initData3;
const callback5 = useCallback(A, [disallowGesture, sharedValue]);
callback2 = useCallback(() => {
SearchPlatformActionCreators.deleteSearchQuery(searchContext2);
SearchActionCreators.clearAllSearchMesssages();
SearchActionCreators.clearSearchRecentMessages();
SearchTabsFetchManager.cleanUp(getSearchContextId(searchContext2));
}, [searchContext2]);
useEffect(() => {
if (context == null) {
return () => callback2();
}
}, [context, callback2]);
useEffect(() => {
const handleChannelDetailsHidden2 = function handleChannelDetailsHidden({ channelId: channelId2, screenIndex: screenIndex2 }) {
if (channelId2 === channelId && screenIndex2 === screenIndex) {
setActiveIndex(0, false, true);
callback2();
}
};
if (context != null) {
ComponentDispatch.subscribe(ComponentActions.CHANNEL_DETAILS_HIDDEN, handleChannelDetailsHidden2);
return () => {
ComponentDispatch.unsubscribe(ComponentActions.CHANNEL_DETAILS_HIDDEN, handleChannelDetailsHidden2);
};
}
}, [channelId, screenIndex, setActiveIndex, context, callback2]);
return segmentedControlState.items.length === 0 ? <NoSearchResultsScreen searchContext={searchContext2} /> : <>
{[<View style={styles.controls}>
<SearchTabsTransitionGroup state={segmentedControlState} />
<SearchTabsGradient state={segmentedControlState} />
</View>, <View style={styles.pages}>
<SearchTabsPageContext.Provider value={memo2}>
<SegmentedControlPages state={segmentedControlState} bounces={context == null} nativeGesture={memo} onBeginDragWorklet={context != null ? callback4 : void 0} onEndDragWorklet={context != null ? callback3 : void 0} onScrollWorklet={context != null ? callback5 : void 0} />
</SearchTabsPageContext.Provider>
</View>]}
</>;
});
export default function ConnectedSearchTabsLayout(props) {
let candidateTabs;
const { searchContext: searchContext3, width: width2 } = props;
candidateTabs = void 0;
const stateFromStoresObject = useStateFromStoresObject([SearchTabsLayoutStore], () => ({
visibleTabs: SearchTabsLayoutStore.getVisibleTabs(searchContext3),
visibleTabCounts: SearchTabsLayoutStore.getVisibleTabCounts(searchContext3),
candidateTabs: SearchTabsLayoutStore.getCandidateTabs(searchContext3)
}), [searchContext3]);
const { visibleTabs: visibleTabs3, visibleTabCounts: visibleTabCounts2 } = stateFromStoresObject;
candidateTabs = stateFromStoresObject.candidateTabs;
const memo = useMemo(() => new Set(candidateTabs), [candidateTabs]);
useAutoSearchGuildChannelTab(searchContext3, !memo.has(SearchTabs.GUILD_CHANNELS));
useAutoSearchMembersTab(searchContext3, !memo.has(SearchTabs.MEMBERS));
useAutoSearchPeopleTab(searchContext3, !memo.has(SearchTabs.PEOPLE));
useAutoTrackSearchTabCountsViewedAnalytics({
searchContext: searchContext3,
visibleTabCounts: visibleTabCounts2,
visibleTabs: visibleTabs3
});
return <Component searchContext={searchContext3} visibleTabs={visibleTabs3} visibleTabCounts={visibleTabCounts2} width={width2} />;
};
@@ -0,0 +1,99 @@
// Metro module 15477 (f15478).
import { useState, useEffect, createContext, useContext } from "react";
import { View } from "react-native";
import ChannelStore from "../../../../../stores/ChannelStore";
import { SearchTabs } from "../../../SearchConstants";
import { SearchTypes } from "../../../../../Constants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import { useStateFromStores } from "../../../../../_bundle/Module589";
import { useIsChannelSpoilerGated } from "../../../../spoiler_channels/SpoilerChannelUtils";
import { useIsChannelContentGated } from "../../../../age_gate/AgeGateUtils";
import GuildNSFW from "../../../../../components_native/warnings/GuildNSFW";
import ChannelSpoiler from "../../../../spoiler_channels/native/ChannelSpoiler";
import RecentScreen from "./pages/RecentScreen";
import PeopleScreen from "./pages/PeopleScreen";
import MembersScreen from "./pages/MembersScreen";
import ChannelsScreen from "./pages/ChannelsScreen";
import MediaScreen from "./pages/messages/MediaScreen";
import FilesScreen from "./pages/messages/FilesScreen";
import LinksScreen from "./pages/messages/LinksScreen";
import { SearchTabsThreadScreen } from "../../../../main_tabs_v2/native/sidebar/details/screens/ThreadsScreen";
import MessagesScreen from "./pages/messages/MessagesScreen";
import PinsScreen from "./pages/messages/PinsScreen";
import Module38 from "../../../../../_bundle/Module38";
import useStateFromSharedValue from "../../../../reanimated/native/useStateFromSharedValue";
let useStyles, context;
const SearchTabsPage = function SearchTabsPage(props) {
const { tab, searchContext, isFocused, selectMediaTab, width } = props;
const [state, setState] = useState(isFocused);
useEffect(() => {
setTimeout(() => {
setState(true);
}, 10);
}, []);
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(searchContext.type !== SearchTypes.GUILD_CHANNEL ? searchContext.type === SearchTypes.THREAD ? searchContext.channelId : void 0 : searchContext.channelId));
const isChannelSpoilerGated = useIsChannelSpoilerGated(stateFromStores);
const isChannelContentGated = useIsChannelContentGated(stateFromStores);
if (state) {
L7: {
if (tab !== SearchTabs.MEMBERS) {
if (searchContext.type !== SearchTypes.GUILD_CHANNEL && searchContext.type !== SearchTypes.THREAD) {
break L7;
}
if (isChannelContentGated) {
return <GuildNSFW guildId={searchContext.guildId} channelId={searchContext.channelId} />;
}
if (isChannelSpoilerGated) {
return <ChannelSpoiler guildId={searchContext.guildId} channelId={searchContext.channelId} />;
}
}
}
if (SearchTabs.RECENT === tab) {
return <RecentScreen onJumpToMedia={selectMediaTab} searchContext={searchContext} width={width} />;
}
if (SearchTabs.PEOPLE === tab) {
return <PeopleScreen searchContext={searchContext} />;
}
if (SearchTabs.MEMBERS === tab) {
return <MembersScreen searchContext={searchContext} />;
}
if (SearchTabs.GUILD_CHANNELS === tab) {
return <ChannelsScreen searchContext={searchContext} />;
}
if (SearchTabs.MEDIA === tab) {
return <MediaScreen tab={tab} searchContext={searchContext} isFocused={isFocused} width={width} />;
}
if (SearchTabs.FILES === tab) {
return <FilesScreen tab={tab} searchContext={searchContext} isFocused={isFocused} width={width} />;
}
if (SearchTabs.LINKS === tab) {
return <LinksScreen tab={tab} searchContext={searchContext} isFocused={isFocused} width={width} />;
}
if (SearchTabs.THREADS === tab) {
return <SearchTabsThreadScreen searchContext={searchContext} />;
}
if (SearchTabs.MESSAGES === tab) {
return <MessagesScreen tab={tab} searchContext={searchContext} isFocused={isFocused} />;
}
if (SearchTabs.PINS === tab) {
return <PinsScreen tab={tab} searchContext={searchContext} isFocused={isFocused} />;
}
return null;
}
return null;
};
useStyles = createStyles({
container: {
flex: 1
}
});
context = createContext(void 0);
export default function ConnectedSearchTabsPage(props) {
const { tab, searchContext: searchContext2, width } = props;
const context2 = useContext(context);
Module38(context2 != null, "[SearchTabsPageContext] Context should not be null.");
return <View style={useStyles().container}>
<SearchTabsPage isFocused={useStateFromSharedValue(context2.selectedTab) === tab} selectMediaTab={context2.selectMediaTab} tab={tab} searchContext={searchContext2} width={width} />
</View>;
};
export { context as SearchTabsPageContext };
@@ -0,0 +1,115 @@
// Metro module 15553 (f15554).
import { useEffect, useCallback, useContext } from "react";
import { SearchResultExactCountEnabled } from "../../../../user_settings/UserSettings";
import { defaultCountFormatter } from "../../../../../design/components/Tabs/native/Tabs.native";
import * as _ReanimatedRexport from "../../../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useSharedValue, useAnimatedStyle, useAnimatedReaction } from "../../../../reanimated/ReanimatedRexport";
import * as _TransitionGroup from "../../../../../design/components/TransitionGroup/TransitionGroup";
import { TransitionGroup } from "../../../../../design/components/TransitionGroup/TransitionGroup";
import * as _spring from "../../../../../design/animation/reanimated/spring/spring";
import * as _springPresets from "../../../../../design/animation/reanimated/spring/springPresets";
import { SwipeForMemberListContext } from "../../../../main_tabs_v2/native/channel/SwipeForMemberListWrapper";
import { Tabs } from "../../../../../design/components/Tabs/native/Tabs.native";
let __initData, __initData2, __initData3, __initData4, __initData5, AnimatedTabs, renderItem;
const getItemKey = function getItemKey(a0) {
return a0.items.map((item) => item.id).join("-");
};
AnimatedTabs = function AnimatedTabs(props) {
let context;
const { state, transitionState, cleanUp } = props;
context = void 0;
const r0 = transitionState === _TransitionGroup.TransitionStates.MOUNTED ? 1 : 0;
let setting;
const sharedValue = useSharedValue(r0);
const f = () => {
const r7 = sharedValue.get();
const t = function t(a0) {
if (a0 ? transitionState === _TransitionGroup.TransitionStates.YEETED : a0) {
_ReanimatedRexport.runOnJS(cleanUp)();
}
};
t.__closure = {
transitionState,
TransitionStates: _TransitionGroup.TransitionStates,
runOnJS: _ReanimatedRexport.runOnJS,
cleanUp
};
t.__workletHash = 15209468679721;
t.__initData = __initData2;
return {
opacity: _spring.withSpring(r7, _springPresets.springStandard, "respect-motion-settings", t),
position: sharedValue.get() === 1 ? "relative" : "absolute"
};
};
f.__closure = {
withSpring: _spring.withSpring,
opacity: sharedValue,
springStandard: _springPresets.springStandard,
transitionState,
TransitionStates: _TransitionGroup.TransitionStates,
runOnJS: _ReanimatedRexport.runOnJS,
cleanUp
};
f.__workletHash = 10740262883803;
f.__initData = __initData;
const animatedStyle = useAnimatedStyle(f);
useEffect(() => {
sharedValue.set(transitionState === _TransitionGroup.TransitionStates.YEETED ? 0 : 1);
}, [sharedValue, transitionState]);
setting = void 0;
setting = SearchResultExactCountEnabled.useSetting();
const callback = useCallback((a0) => !setting && a0 > 1000 ? `(${defaultCountFormatter(1000)}+)` : `(${defaultCountFormatter(a0)})`, [setting]);
context = useContext(SwipeForMemberListContext);
const h = function h() {
if (context != null) {
context.disallowGesture.set(false);
}
};
h.__closure = {
swipeForMemberListContext: context
};
h.__workletHash = 5080152010224;
h.__initData = __initData3;
const callback2 = useCallback(h, [context]);
const F = () => state.scrollOffset.get() > 0;
F.__closure = {
state
};
F.__workletHash = 7791091456487;
F.__initData = __initData4;
const w = function w(a0, a1) {
if (a0 !== a1 && context != null) {
context.disallowGesture.set(a0);
}
};
w.__closure = {
swipeForMemberListContext: context
};
w.__workletHash = 15386779064911;
w.__initData = __initData5;
useAnimatedReaction(F, w);
return <ReanimatedRexport.View style={animatedStyle}>
<Tabs state={state} grow={false} formatCount={callback} simultaneousHandlers={context?.gesture} onEndDrag={context != null ? callback2 : void 0} />
</ReanimatedRexport.View>;
};
renderItem = function renderItem(a0, a1, a2, a3) {
return <AnimatedTabs key={a0} state={a1} transitionState={a2} cleanUp={a3} />;
};
__initData = {
code: "function SearchTabsTransitionGroupTsx1(){const{withSpring,opacity,springStandard,transitionState,TransitionStates,runOnJS,cleanUp}=this.__closure;return{opacity:withSpring(opacity.get(),springStandard,'respect-motion-settings',function(finished){if(finished&&transitionState===TransitionStates.YEETED){runOnJS(cleanUp)();}}),position:opacity.get()===1?'relative':'absolute'};}"
};
__initData2 = {
code: "function SearchTabsTransitionGroupTsx2(finished){const{transitionState,TransitionStates,runOnJS,cleanUp}=this.__closure;if(finished&&transitionState===TransitionStates.YEETED){runOnJS(cleanUp)();}}"
};
__initData3 = {
code: "function SearchTabsTransitionGroupTsx3(){const{swipeForMemberListContext}=this.__closure;var _swipeForMemberListCo;(_swipeForMemberListCo=swipeForMemberListContext)===null||_swipeForMemberListCo===void 0||_swipeForMemberListCo.disallowGesture.set(false);}"
};
__initData4 = {
code: "function SearchTabsTransitionGroupTsx4(){const{state}=this.__closure;return state.scrollOffset.get()>0;}"
};
__initData5 = {
code: "function SearchTabsTransitionGroupTsx5(isOffsetFromStart,prevIsOffsetFromStart){const{swipeForMemberListContext}=this.__closure;if(isOffsetFromStart!==prevIsOffsetFromStart){var _swipeForMemberListCo;(_swipeForMemberListCo=swipeForMemberListContext)===null||_swipeForMemberListCo===void 0||_swipeForMemberListCo.disallowGesture.set(isOffsetFromStart);}}"
};
export default function SearchTabsTransitionGroup(props) {
return <TransitionGroup items={[props.state]} getItemKey={getItemKey} renderItem={renderItem} />;
};
@@ -0,0 +1,22 @@
// Metro module 15523 (f15524).
import * as _SearchConstants from "../../../../SearchConstants";
import { createStyles } from "../../../../../../design/components/Styles/native/createStyles";
const { SEARCH_LIST_SECTION_TOP_PADDING, SEARCH_ROW_TAP_STATE_PADDING, SEARCH_LIST_HORIZONTAL_PADDING } = _SearchConstants;
const useStyles = createStyles({
filesOrLinksContentContainer: {
paddingTop: SEARCH_LIST_HORIZONTAL_PADDING,
paddingHorizontal: SEARCH_LIST_HORIZONTAL_PADDING
},
mediaContentContainer: {
paddingTop: SEARCH_LIST_SECTION_TOP_PADDING,
paddingHorizontal: SEARCH_LIST_HORIZONTAL_PADDING
},
messagesContentContainer: {
paddingTop: SEARCH_LIST_SECTION_TOP_PADDING - SEARCH_ROW_TAP_STATE_PADDING
},
membersContentContainer: {
paddingTop: SEARCH_LIST_SECTION_TOP_PADDING,
paddingHorizontal: SEARCH_LIST_HORIZONTAL_PADDING
}
});
export { useStyles as useContentContainerStyles };
@@ -0,0 +1,8 @@
// Metro module 15528 (f15529).
import SearchMessageStore from "../../../../SearchMessageStore";
import SearchQueryStore from "../../../stores/SearchQueryStore";
import { useStateFromStores } from "../../../../../../_bundle/Module589";
import { getSearchTabFetchId } from "../../../../SearchUtils";
export function useSearchMessages(a0, a1) {
return useStateFromStores([SearchQueryStore, SearchMessageStore], () => SearchMessageStore.getMessages(getSearchTabFetchId(a0, a1, SearchQueryStore.getSearchResultsQuery(a0))), [a0, a1]);
}
@@ -0,0 +1,26 @@
// Metro module 15529 (f15530).
import SearchMessageStore from "../../../../SearchMessageStore";
import SearchQueryStore from "../../../stores/SearchQueryStore";
import { SEARCH_TABS_TO_SEARCH_QUERY_LIMITS } from "../../../../SearchConstants";
import { useFullscreenPlaceholderCount } from "../../../hooks/usePlaceholderStyles";
import { useStateFromStoresObject } from "../../../../../../_bundle/Module589";
import { getSearchTabFetchId } from "../../../../SearchUtils";
export function useSearchMessagesLoadingState({ searchContext, tab, placeholderHeight, numColumns }) {
const fullscreenPlaceholderCount = useFullscreenPlaceholderCount({
placeholderHeight,
numColumns
});
return useStateFromStoresObject([SearchQueryStore, SearchMessageStore], () => {
const searchTabFetchId = getSearchTabFetchId(searchContext, tab, SearchQueryStore.getSearchResultsQuery(searchContext));
const isInitialFetchComplete = SearchMessageStore.getIsInitialFetchComplete(searchTabFetchId);
const isFetching = SearchMessageStore.getIsFetching(searchTabFetchId);
const isFirstPageLoading = !isInitialFetchComplete;
const isNextPageLoading = isInitialFetchComplete ? isFetching : !isFirstPageLoading;
const r27 = Math.max(fullscreenPlaceholderCount, SEARCH_TABS_TO_SEARCH_QUERY_LIMITS[tab]);
return {
isFirstPageLoading,
isNextPageLoading,
placeholderCount: isInitialFetchComplete ? isNextPageLoading ? r27 : 0 : r27
};
});
}
@@ -0,0 +1,98 @@
// Metro module 15552 (f15553).
import { useMemo } from "react";
import * as _ReanimatedRexport from "../../../../../reanimated/ReanimatedRexport";
import { useSharedValue, useDerivedValue, useAnimatedReaction } from "../../../../../reanimated/ReanimatedRexport";
import { useSegmentedControlState } from "../../../../../../design/components/SegmentedControl/native/SegmentedControlState.native";
const __initData = {
code: "function useSearchSegmentedControlStateTsx1(){const{visibleTabsStateful}=this.__closure;return visibleTabsStateful;}"
};
const __initData2 = {
code: "function useSearchSegmentedControlStateTsx2(){const{visibleTabs,activeIndex}=this.__closure;return visibleTabs.get()[activeIndex.get()];}"
};
const __initData3 = {
code: "function useSearchSegmentedControlStateTsx3(){const{visibleTabs}=this.__closure;return visibleTabs.get();}"
};
const __initData4 = {
code: "function useSearchSegmentedControlStateTsx4(visibleTabs){const{lastSelectedTab,runOnJS,setActiveIndex}=this.__closure;if(visibleTabs.length===0)return;const lastSelectedTabIndex=visibleTabs.indexOf(lastSelectedTab.get());const targetIndex=Math.max(0,lastSelectedTabIndex);const maxIndex=Math.max(0,visibleTabs.length-1);const nextActiveIndex=Math.min(targetIndex,maxIndex);runOnJS(setActiveIndex)(nextActiveIndex,false);}"
};
const __initData5 = {
code: "function useSearchSegmentedControlStateTsx5(){const{selectedTab}=this.__closure;return selectedTab.get();}"
};
const __initData6 = {
code: "function useSearchSegmentedControlStateTsx6(selectedTab){const{lastSelectedTab,runOnJS,onSelectedTabChange}=this.__closure;if(selectedTab==null)return;lastSelectedTab.set(selectedTab);runOnJS(onSelectedTabChange)(selectedTab);}"
};
export function useSearchSegmentedControlState({ items, visibleTabs, onSelectedTabChange, width }) {
let derivedValue, segmentedControlState, activeIndex, setActiveIndex, derivedValue2;
derivedValue = void 0;
segmentedControlState = void 0;
activeIndex = void 0;
setActiveIndex = void 0;
derivedValue2 = void 0;
const sharedValue = useSharedValue(visibleTabs[0]);
const T = () => visibleTabs;
T.__closure = {
visibleTabsStateful: visibleTabs
};
T.__workletHash = 17125959946782;
T.__initData = __initData;
derivedValue = useDerivedValue(T);
segmentedControlState = useSegmentedControlState({
items,
defaultIndex: 0,
pageWidth: width
});
activeIndex = segmentedControlState.activeIndex;
setActiveIndex = segmentedControlState.setActiveIndex;
const x = () => derivedValue.get()[activeIndex.get()];
x.__closure = {
visibleTabs: derivedValue,
activeIndex
};
x.__workletHash = 6189329624535;
x.__initData = __initData2;
derivedValue2 = useDerivedValue(x);
const f = () => derivedValue.get();
f.__closure = {
visibleTabs: derivedValue
};
f.__workletHash = 9222891018885;
f.__initData = __initData3;
const v = function v(a0) {
if (a0.length !== 0) {
const r23 = Math.min(Math.max(0, a0.indexOf(sharedValue.get())), Math.max(0, a0.length - 1));
_ReanimatedRexport.runOnJS(setActiveIndex)(r23, false);
}
};
v.__closure = {
lastSelectedTab: sharedValue,
runOnJS: _ReanimatedRexport.runOnJS,
setActiveIndex
};
v.__workletHash = 13456384876758;
v.__initData = __initData4;
useAnimatedReaction(f, v);
const C = () => derivedValue2.get();
C.__closure = {
selectedTab: derivedValue2
};
C.__workletHash = 2491149576387;
C.__initData = __initData5;
const I = function I(a0) {
if (a0 != null) {
sharedValue.set(a0);
_ReanimatedRexport.runOnJS(onSelectedTabChange)(a0);
}
};
I.__closure = {
lastSelectedTab: sharedValue,
runOnJS: _ReanimatedRexport.runOnJS,
onSelectedTabChange
};
I.__workletHash = 8452224388929;
I.__initData = __initData6;
useAnimatedReaction(C, I);
return useMemo(() => ({
segmentedControlState,
selectedTab: derivedValue2
}), [segmentedControlState, derivedValue2]);
}
@@ -0,0 +1,166 @@
// Metro module 15526 (f15527).
import * as Module19 from "react";
import { useEffect, useCallback, useMemo } from "react";
import SortedVoiceStateStore from "../../../../../../stores/views/SortedVoiceStateStore";
import SearchGuildChannelTabStore from "../../../stores/SearchGuildChannelTabStore";
import SearchQueryStore from "../../../stores/SearchQueryStore";
import { CHANNELS_ESTIMATED_ITEM_SIZE, EMPTY_VOICE_STATES, SearchListItemTypes } from "../../../../SearchConstants";
import { SearchResultContentEntityTypes } from "../../../tracking/TrackingConstants";
import { getSearchContextId } from "../../../../SearchUtils";
import { useStateFromStores } from "../../../../../../_bundle/Module589";
import useStageChannelSpeakerVoiceStates from "../../../../../stage_channels/useStageChannelSpeakerVoiceStates";
import { useOnPressGuildTextChannel, useOnPressGuildVoiceChannel } from "../../../hooks/useOnPressSearchItem";
import { intl, t } from "../../../../../../intl/index.native";
import { AccessibilityAnnouncer } from "../../../../../../_bundle/Module3902";
import { useFullscreenPlaceholderCount } from "../../../hooks/usePlaceholderStyles";
import Tracking from "../../../tracking/Tracking";
import { useMessageTabCountsErrorText } from "../../../hooks/useSearchScreenError";
import ErrorScreen from "./ErrorScreen";
import SearchList from "../../list/SearchList";
const r34 = Module19.memo(function ChannelsScreen(props) {
let stateFromStores2, stateFromStores3, c22116_5, onPressGuildTextChannel, onPressGuildVoiceChannel, stateFromStores4, stateFromStores5, fullscreenPlaceholderCount, callback, callback2;
const searchContext = props.searchContext;
stateFromStores2 = void 0;
stateFromStores3 = void 0;
c22116_5 = void 0;
onPressGuildTextChannel = void 0;
onPressGuildVoiceChannel = void 0;
stateFromStores4 = void 0;
stateFromStores5 = void 0;
fullscreenPlaceholderCount = void 0;
callback = void 0;
callback2 = void 0;
const searchContextId = getSearchContextId(searchContext);
const stateFromStores = useStateFromStores([SearchGuildChannelTabStore], () => SearchGuildChannelTabStore.getTextChannels(searchContextId));
stateFromStores2 = useStateFromStores([SearchGuildChannelTabStore], () => SearchGuildChannelTabStore.getVoiceChannels(searchContextId));
stateFromStores3 = useStateFromStores([SortedVoiceStateStore], () => SortedVoiceStateStore.getVoiceStates(searchContext.guildId), [searchContext.guildId]);
const stageChannelSpeakerVoiceStates = useStageChannelSpeakerVoiceStates(searchContext.guildId);
c22116_5 = stageChannelSpeakerVoiceStates;
onPressGuildTextChannel = useOnPressGuildTextChannel({
searchContext
});
onPressGuildVoiceChannel = useOnPressGuildVoiceChannel({
searchContext
});
stateFromStores4 = useStateFromStores([SearchQueryStore], () => SearchQueryStore.isInitialSearchQuery(searchContext));
stateFromStores5 = useStateFromStores([SearchQueryStore], () => SearchQueryStore.getQueryString(searchContext), [searchContext]);
useEffect(() => {
if (stateFromStores5.trim() !== "") {
const count = stateFromStores.length + stateFromStores2.length;
AccessibilityAnnouncer.announce(count > 0 ? intl.formatToPlainString(t.ZGVL3g, {
count
}) : intl.string(t.f5cMAg));
}
}, [stateFromStores, stateFromStores2, stateFromStores5]);
fullscreenPlaceholderCount = useFullscreenPlaceholderCount({
placeholderHeight: CHANNELS_ESTIMATED_ITEM_SIZE,
numColumns: 1
});
callback = useCallback((a0, a1) => {
onPressGuildTextChannel(a0);
Tracking.trackSearchResultClicked({
searchContext,
channelId: a0,
index: a1,
entityType: SearchResultContentEntityTypes.CHANNEL
});
}, [onPressGuildTextChannel, searchContext]);
callback2 = useCallback((a0, a1) => {
onPressGuildVoiceChannel(a0);
Tracking.trackSearchResultClicked({
searchContext,
channelId: a0,
index: a1,
entityType: SearchResultContentEntityTypes.CHANNEL
});
}, [onPressGuildVoiceChannel, searchContext]);
const memo = useMemo(() => {
const r4 = [];
let c28068_0 = r4;
let c28068_1 = 0;
if (stateFromStores.length > 0) {
r4.push({
type: SearchListItemTypes.SECTION,
props: {
title: intl.string(t.nIfr0Y)
}
});
stateFromStores.forEach((stateFromStore, index) => {
let c30889_0 = c28068_1 + index;
c28068_0.push({
type: SearchListItemTypes.GUILD_TEXT_CHANNEL,
props: {
channel: stateFromStore.channel,
lastMessageId: stateFromStore.lastMessageId,
onPress: (a0) => callback(a0, c30889_0)
}
});
});
c28068_1 = 0 + stateFromStores.length;
}
if (stateFromStores2.length > 0) {
r4.push({
type: SearchListItemTypes.SECTION,
props: {
title: intl.string(t.CYnO4s)
}
});
const stateFromStores6 = stateFromStores3;
let c28069_1 = c22116_5;
stateFromStores2.sort(function({ channel }, b) {
let r7 = stateFromStores6;
let r15 = (channel.isGuildStageVoice() ? c28069_1 : stateFromStores6)[channel.id];
if (r15 == null) {
r15 = EMPTY_VOICE_STATES;
}
const channel2 = b.channel;
if (channel2.isGuildStageVoice()) {
r7 = c28069_1;
}
let r20 = r7[channel2.id];
if (r20 == null) {
r20 = EMPTY_VOICE_STATES;
}
return r15.length < r20.length ? 1 : r15.length > r20.length ? -1 : 0;
}).forEach((item, index) => {
let c30890_0 = c28068_1 + index;
let voiceStates = stateFromStores3[item.channel.id];
if (voiceStates == null) {
voiceStates = EMPTY_VOICE_STATES;
}
let speakerVoiceStates = c22116_5[item.channel.id];
if (speakerVoiceStates == null) {
speakerVoiceStates = EMPTY_VOICE_STATES;
}
c28068_0.push({
type: SearchListItemTypes.GUILD_VOICE_CHANNEL,
props: {
channel: item.channel,
voiceStates,
speakerVoiceStates,
onPress: (a0) => callback2(a0, c30890_0)
}
});
});
}
if (!stateFromStores4 && r4.length === 0) {
const r69 = 0 < fullscreenPlaceholderCount;
let r73 = 0;
if (r69) {
do {
r4.push({
type: SearchListItemTypes.MESSAGE_PLACEHOLDER,
key: `message-placeholder-${r73}`
});
r73 = r73 + 1;
} while (r73 < fullscreenPlaceholderCount);
}
}
return r4;
}, [fullscreenPlaceholderCount, callback, callback2, stateFromStores4, stageChannelSpeakerVoiceStates, stateFromStores, stateFromStores2, stateFromStores3]);
const messageTabCountsErrorText = useMessageTabCountsErrorText({
searchContext
});
return messageTabCountsErrorText != null ? <ErrorScreen text={messageTabCountsErrorText} /> : <SearchList data={memo} />;
});
export default r34;
@@ -0,0 +1,34 @@
// Metro module 15476 (f15477).
import { memo, useEffect } from "react";
import { View } from "react-native";
import { createStyles } from "../../../../../../design/components/Styles/native/createStyles";
import useSafeAreaInsetsKeyboardAware_native from "../../../../../safe_area/useSafeAreaInsetsKeyboardAware.native";
import { AccessibilityAnnouncer } from "../../../../../../_bundle/Module3902";
import { Text } from "../../../../../../design/components/Text/native/Text";
const useStyles = createStyles({
container: {
justifyContent: "center",
alignItems: "center",
height: "100%",
display: "flex"
},
text: {
textAlign: "center",
width: "75%"
}
});
const r30 = memo(function({ text }) {
const styles = useStyles();
const insets = useSafeAreaInsetsKeyboardAware_native({
includeKeyboardHeight: true
}).insets;
useEffect(() => {
AccessibilityAnnouncer.announce(text, "polite");
}, [text]);
return <View style={[styles.container, {
paddingBottom: insets.bottom
}]}>
<Text variant="text-sm/medium" color="text-muted" style={styles.text}>{text}</Text>
</View>;
});
export default r30;
@@ -0,0 +1,226 @@
// Metro module 15522 (f15523).
import * as Module19 from "react";
import { useCallback, useEffect, useMemo } from "react";
import { View } from "react-native";
import { EVERYONE_CHANNEL_ID } from "../../../../../../stores/ChannelMemberStore";
import ChannelStore from "../../../../../../stores/ChannelStore";
import GuildMemberStore from "../../../../../../stores/GuildMemberStore";
import GuildStore from "../../../../../../stores/GuildStore";
import SelectedChannelStore from "../../../../../../stores/SelectedChannelStore";
import SearchMemberTabStore from "../../../stores/SearchMemberTabStore";
import SearchQueryStore from "../../../stores/SearchQueryStore";
import { MESSAGE_PLACEHOLDER_ITEM_SIZE, SearchListItemTypes } from "../../../../SearchConstants";
import { SearchResultContentEntityTypes } from "../../../tracking/TrackingConstants";
import { RelationshipTypes, SearchTypes } from "../../../../../../Constants";
import { createStyles } from "../../../../../../design/components/Styles/native/createStyles";
import { useStateFromStores } from "../../../../../../_bundle/defaultAreStatesEqual";
import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../../../../app_analytics/useAnalyticsLocations";
import { getSearchContextId } from "../../../../SearchUtils";
import { useFullscreenPlaceholderCount } from "../../../hooks/usePlaceholderStyles";
import { getGuildVisualOwnerId } from "../../../../../../utils/PermissionUtils";
import { dismissGlobalKeyboard } from "../../../../../../utils/native/KeyboardManagerUtils";
import Tracking from "../../../tracking/Tracking";
import showUserProfileActionSheet from "../../../../../user_profile/native/showUserProfileActionSheet";
import { intl, t } from "../../../../../../intl/index.native";
import { AccessibilityAnnouncer } from "../../../../../../_bundle/Module3902";
import { useContentContainerStyles } from "../hooks/useContentContainerStyles";
import { useMessageTabCountsErrorText } from "../../../hooks/useSearchScreenError";
import ErrorScreen from "./ErrorScreen";
import GuildChannelUserList from "../../../../../main_tabs_v2/native/shared_components/user_list/GuildChannelUserList";
import SearchList from "../../list/SearchList";
import ThreadChannelUserList from "../../../../../main_tabs_v2/native/shared_components/user_list/ThreadChannelUserList";
import AnalyticsLocation from "../../../../../app_analytics/AnalyticsLocation";
import PrivateChannelUserList from "../../../../../main_tabs_v2/native/shared_components/user_list/PrivateChannelUserList";
let useStyles, ThreadMembersScreen;
const SearchableMembersScreen = function SearchableMembersScreen(props) {
let r120;
let EVERYONE_CHANNEL_ID2, stateFromStores2, fullscreenPlaceholderCount, stateFromStores3, callback, stateFromStores4, stateFromStores5;
let searchContext2;
const { searchContext, guildId } = props;
EVERYONE_CHANNEL_ID2 = void 0;
stateFromStores2 = void 0;
fullscreenPlaceholderCount = void 0;
stateFromStores3 = void 0;
callback = void 0;
stateFromStores4 = void 0;
stateFromStores5 = void 0;
const styles = useStyles();
const analyticsLocations = useAnalyticsLocations().analyticsLocations;
const searchContextId = getSearchContextId(searchContext);
const stateFromStores = useStateFromStores([SearchMemberTabStore], () => SearchMemberTabStore.getResults(searchContextId));
searchContext2 = searchContext;
const stateFromStores6 = useStateFromStores([SearchQueryStore], () => SearchQueryStore.getChannelIds(searchContext2), [searchContext]);
const r21 = stateFromStores6.size === 0 ? EVERYONE_CHANNEL_ID : stateFromStores6.size === 1 ? Array.from(stateFromStores6)[0] : null;
L12: {
EVERYONE_CHANNEL_ID2 = r21;
stateFromStores2 = useStateFromStores([SelectedChannelStore], () => SelectedChannelStore.getChannelId());
fullscreenPlaceholderCount = useFullscreenPlaceholderCount({
placeholderHeight: MESSAGE_PLACEHOLDER_ITEM_SIZE,
numColumns: 1
});
stateFromStores3 = useStateFromStores([GuildStore], () => {
const guild = GuildStore.getGuild(guildId);
return guild != null ? getGuildVisualOwnerId(guild) : void 0;
});
const stateFromStores7 = useStateFromStores([ChannelStore], () => {
if (EVERYONE_CHANNEL_ID2 === EVERYONE_CHANNEL_ID) {
return EVERYONE_CHANNEL_ID2;
}
const channel = ChannelStore.getChannel(EVERYONE_CHANNEL_ID2);
return channel != null ? channel.isAnnouncementThread() ? channel.parent_id != null ? channel.parent_id : EVERYONE_CHANNEL_ID2 : EVERYONE_CHANNEL_ID2 : EVERYONE_CHANNEL_ID2;
});
callback = useCallback((a0, a1) => {
dismissGlobalKeyboard();
Tracking.trackSearchResultClicked({
searchContext,
userId: a0.id,
index: a1,
entityType: SearchResultContentEntityTypes.USER
});
let channelId2 = EVERYONE_CHANNEL_ID2;
if (EVERYONE_CHANNEL_ID2 === EVERYONE_CHANNEL_ID) {
channelId2 = stateFromStores2;
}
showUserProfileActionSheet({
userId: a0.id,
channelId: channelId2,
sourceAnalyticsLocations: analyticsLocations
});
}, [searchContext, EVERYONE_CHANNEL_ID2, stateFromStores2, analyticsLocations]);
const callback2 = useCallback((a0) => {
Tracking.trackSearchResultClicked({
searchContext,
userId: a0.user.id,
index: a0.index,
entityType: SearchResultContentEntityTypes.USER
});
dismissGlobalKeyboard();
}, [searchContext]);
const callback3 = useCallback((a0) => {
callback(a0.user, a0.index);
}, [callback]);
stateFromStores4 = useStateFromStores([SearchQueryStore], () => SearchQueryStore.isInitialSearchQuery(searchContext), [searchContext]);
stateFromStores5 = useStateFromStores([SearchMemberTabStore], () => SearchMemberTabStore.getIsFetching(searchContextId));
useEffect(() => {
if (!stateFromStores4 && !stateFromStores5) {
const length = stateFromStores.length;
AccessibilityAnnouncer.announce(length > 0 ? intl.formatToPlainString(t.ZGVL3g, {
count: length
}) : intl.string(t.tuL9TW));
}
}, [stateFromStores, stateFromStores4, stateFromStores5]);
const memo = useMemo(() => {
let r4;
let c28067_0;
L5: {
r4 = [];
c28067_0 = r4;
stateFromStores.forEach((stateFromStore, index) => {
const member = GuildMemberStore.getMember(guildId, stateFromStore.record.id);
const nick = member?.nick;
const colorString = member?.colorString;
const colorStrings = member?.colorStrings;
let premiumSince = member?.premiumSince;
if (premiumSince == null) {
premiumSince = void 0;
}
c28067_0.push({
type: SearchListItemTypes.GUILD_CHANNEL_MEMBER,
props: {
type: RelationshipTypes.NONE,
user: stateFromStore.record,
nickname: nick,
usernameColor: colorString,
roleColors: colorStrings,
isNameplatedRow: true,
premiumSince,
isOwner: stateFromStores3 === stateFromStore.record.id,
guildId,
onLongPress: (a0) => callback(a0, index),
onPress: (a0) => callback(a0, index),
start: index === 0,
end: index === stateFromStores.length - 1,
canShowDisplayNameStylesFont: true
}
});
});
if (!stateFromStores5) {
if (stateFromStores4) {
break L5;
}
if (r4.length !== 0) {
break L5;
}
}
let r0 = 0;
while (r0 < fullscreenPlaceholderCount) {
r4.push({
type: SearchListItemTypes.GUILD_CHANNEL_MEMBER_PLACEHOLDER,
key: `guild-channel-member-placeholder-${r0}`
});
r0 = r0 + 1;
}
}
return r4;
}, [stateFromStores, stateFromStores5, stateFromStores4, guildId, stateFromStores3, callback, fullscreenPlaceholderCount]);
const styles2 = useContentContainerStyles();
const messageTabCountsErrorText = useMessageTabCountsErrorText({
searchContext
});
if (messageTabCountsErrorText != null) {
r120 = <ErrorScreen text={messageTabCountsErrorText} />;
} else {
if (stateFromStores4 && stateFromStores7 != null) {
r120 = <GuildChannelUserList onUserPress={callback2} onUserLongPress={callback3} channelId={stateFromStores7} guildId={guildId} disableStickySections listStyleOverride={styles.userList} isNameplatedList canShowDisplayNameStylesFont />;
break L12;
}
r120 = <SearchList contentContainerStyle={styles2.membersContentContainer} data={memo} />;
}
}
return r120;
};
ThreadMembersScreen = function ThreadMembersScreen(props) {
const { searchContext: searchContext3, channelId, guildId: guildId2 } = props;
const stateFromStores6 = useStateFromStores([ChannelStore], () => {
const channel = ChannelStore.getChannel(channelId);
let r8 = channel == null ? void 0 : channel.isAnnouncementThread();
if (r8 == null) {
r8 = false;
}
return r8;
});
const stateFromStores7 = useStateFromStores([SearchQueryStore], () => SearchQueryStore.isInitialSearchQuery(searchContext3) && !SearchQueryStore.isTagsEmpty(searchContext3), [searchContext3]);
return !stateFromStores6 && stateFromStores7 ? <ThreadChannelUserList channelId={channelId} guildId={guildId2} onUserPress={dismissGlobalKeyboard} disableStickySections /> : <SearchableMembersScreen searchContext={searchContext3} guildId={guildId2} />;
};
useStyles = createStyles({
container: {
flex: 1,
flexGrow: 1
},
userList: {
backgroundColor: "transparent"
}
});
const r58 = Module19.memo(function MembersScreen(props) {
const searchContext4 = props.searchContext;
const styles = useStyles();
const analyticsLocations2 = useAnalyticsLocations(AnalyticsLocation.SEARCH_MEMBERS).analyticsLocations;
const type = searchContext4.type;
if (SearchTypes.CHANNEL === type) {
return <AnalyticsLocationProvider value={analyticsLocations2}>
<View style={styles.container}>
<PrivateChannelUserList channelId={searchContext4.channelId} disableStickySections listStyleOverride={styles.userList} onUserPress={dismissGlobalKeyboard} />
</View>
</AnalyticsLocationProvider>;
}
if (SearchTypes.THREAD === type) {
return <ThreadMembersScreen searchContext={searchContext4} channelId={searchContext4.channelId} guildId={searchContext4.guildId} />;
}
if (SearchTypes.GUILD_CHANNEL !== type && SearchTypes.GUILD !== type) {
throw new Error(`[MembersScreen] Unsupported search context type: ${searchContext4.type}`);
}
return <AnalyticsLocationProvider value={analyticsLocations2}>
<SearchableMembersScreen searchContext={searchContext4} guildId={searchContext4.guildId} />
</AnalyticsLocationProvider>;
});
export default r58;
@@ -0,0 +1,146 @@
// Metro module 15520 (f15521).
import * as Module19 from "react";
import { useCallback, useMemo } from "react";
import SearchPeopleTabStore from "../../../stores/SearchPeopleTabStore";
import SearchQueryStore from "../../../stores/SearchQueryStore";
import { USER_ESTIMATED_ITEM_SIZE, SearchListItemTypes } from "../../../../SearchConstants";
import { SearchResultContentEntityTypes } from "../../../tracking/TrackingConstants";
import { jsx } from "react/jsx-runtime";
import { getSearchContextId } from "../../../../SearchUtils";
import { useStateFromStores } from "../../../../../../_bundle/Module589";
import { useFullscreenPlaceholderCount } from "../../../hooks/usePlaceholderStyles";
import { useOnPressGroupDMItem, useOnPressDMItem } from "../../../hooks/useOnPressSearchItem";
import ChannelActionCreators from "../../../../../../actions/ChannelActionCreators";
import Tracking from "../../../tracking/Tracking";
import { useMessageTabCountsErrorText } from "../../../hooks/useSearchScreenError";
import ErrorScreen from "./ErrorScreen";
import SearchList from "../../list/SearchList";
let env11050 = {};
const r33 = Module19.memo(function PeopleScreen(a0) {
let c22108_0;
let env22107 = {
$parent: env11050
};
const searchContext = a0.searchContext;
env22107[0] = searchContext;
env22107[1] = void 0;
env22107[2] = void 0;
env22107[3] = void 0;
env22107[4] = void 0;
env22107[5] = void 0;
env22107[6] = void 0;
env22107[7] = void 0;
env22107[8] = void 0;
env22107[1] = getSearchContextId(searchContext);
const stateFromStores2 = useStateFromStores([SearchPeopleTabStore], () => SearchPeopleTabStore.getResults(env22107[1]));
env22107[2] = stateFromStores2;
const stateFromStores = useStateFromStores([SearchQueryStore], () => SearchQueryStore.isInitialSearchQuery(env22107[0]));
env22107[3] = stateFromStores;
const fullscreenPlaceholderCount = useFullscreenPlaceholderCount({
placeholderHeight: USER_ESTIMATED_ITEM_SIZE,
numColumns: 1
});
env22107[4] = fullscreenPlaceholderCount;
const onPressGroupDMItem = useOnPressGroupDMItem({
searchContext
});
env22107[5] = onPressGroupDMItem;
const onPressDMItem = useOnPressDMItem({
searchContext
});
env22107[6] = onPressDMItem;
c22108_0 = void 0;
c22108_0 = async (c30886_0, c30886_1) => {
let c30886_3;
c30886_3 = void 0;
let c31766_0 = c30886_0;
let c31766_1 = c30886_1;
const orEnsurePrivateChannel = await ChannelActionCreators.getOrEnsurePrivateChannel(c30886_0);
const r48 = c30886_3;
let c31766_2 = orEnsurePrivateChannel;
const r54 = r48.$parent;
Tracking.trackSearchResultClicked({
searchContext: r54[0],
userId: c31766_0,
channelId: c31766_2,
index: c31766_1,
entityType: SearchResultContentEntityTypes.CHANNEL
});
(0, r54[6])(c31766_0, c31766_2);
};
const callback = useCallback(function() {
return c22108_0.apply(this, arguments);
}, [onPressDMItem, searchContext]);
env22107[7] = callback;
const callback2 = useCallback((a0, a1) => {
Tracking.trackSearchResultClicked({
searchContext: env22107[0],
channelId: a0,
index: a1,
entityType: SearchResultContentEntityTypes.CHANNEL
});
(0, env22107[5])(a0);
}, [onPressGroupDMItem, searchContext]);
env22107[8] = callback2;
const memo = useMemo(() => {
const r4 = [];
let c28066_0 = r4;
env22107[2].forEach(({ title, items }) => {
if (title != null && items.length > 0) {
c28066_0.push({
type: SearchListItemTypes.SECTION,
props: {
title
}
});
}
items.forEach((item, c31767_0) => {
if ("user" in item) {
const { type, user, firstMatch } = item;
c28066_0.push({
type: SearchListItemTypes.DM,
section: title,
props: {
type,
user,
nickname: user.username !== firstMatch ? firstMatch : void 0,
onPress: (a0) => (0, env22107[7])(a0, c31767_0)
}
});
} else {
c28066_0.push({
type: SearchListItemTypes.GROUP_DM,
section: title,
props: {
channel: item,
onPress: (a0) => (0, env22107[8])(a0, c31767_0)
}
});
}
});
});
if (!env22107[3] && r4.length === 0) {
const r3 = 0 < env22107[4];
let r19 = 0;
if (r3) {
do {
r4.push({
type: SearchListItemTypes.MESSAGE_PLACEHOLDER,
key: `message-placeholder-${r19}`
});
r19 = r19 + 1;
} while (r19 < env22107[4]);
}
}
return r4;
}, [callback, callback2, stateFromStores, fullscreenPlaceholderCount, stateFromStores2]);
const messageTabCountsErrorText = useMessageTabCountsErrorText({
searchContext
});
return messageTabCountsErrorText != null ? (0, jsx)(ErrorScreen, {
text: messageTabCountsErrorText
}) : (0, jsx)(SearchList, {
data: memo
});
});
export default r33;
@@ -0,0 +1,329 @@
// Metro module 15478 (f15479).
import * as Module19 from "react";
import { useState, useCallback, useMemo } from "react";
import SearchMessageStore from "../../../../SearchMessageStore";
import SearchGuildChannelTabStore from "../../../stores/SearchGuildChannelTabStore";
import SearchHistoryStore from "../../../stores/SearchHistoryStore";
import SearchQueryStore from "../../../stores/SearchQueryStore";
import { SearchTabs, MESSAGE_PLACEHOLDER_ITEM_SIZE, SearchListItemTypes, EMPTY_SEARCH_QUERY_STRING } from "../../../../SearchConstants";
import { EMPTY_MEDIA_RESULTS } from "../../../SearchPlatformConstants";
import { SearchTypes } from "../../../../../../Constants";
import { jsx } from "react/jsx-runtime";
import { PressableHighlight } from "../../../../../../design/void/Pressables/native/Pressables";
import SearchPlatformActionCreators from "../../../SearchPlatformActionCreators";
import { intl, t } from "../../../../../../intl/index.native";
import { Text } from "../../../../../../design/components/Text/native/Text";
import useUserListData from "../../../../../main_tabs_v2/native/shared_components/user_list/useUserListData";
import { useOnPressMediaItem, useOnPressDMItem, useOnPressGuildTextChannel } from "../../../hooks/useOnPressSearchItem";
import ChannelActionCreators from "../../../../../../actions/ChannelActionCreators";
import Tracking from "../../../tracking/Tracking";
import { getSearchTabFetchId, getSearchContextId } from "../../../../SearchUtils";
import { useStateFromStoresObject, useStateFromStores } from "../../../../../../_bundle/Module589";
import { useFocusEffect } from "../../../../../../_bundle/Module1481";
import useSearchMediaSize from "../../../hooks/useSearchMediaSize";
import { getMedia } from "../../../SearchPlatformUtils";
import { shouldAgeVerifyForSearchMedia } from "../../../../../explicit_media_redaction/native/ExplicitMediaRedactionNativeUtils";
import AgeVerificationActionCreators_native from "../../../../../age_assurance/AgeVerificationActionCreators.native";
import { AgeVerificationModalEntryPoint } from "../../../../../age_assurance/AgeVerificationAnalyticsUtils";
import { useFullscreenPlaceholderCount } from "../../../hooks/usePlaceholderStyles";
import { RecentsMediaGridPlaceholder } from "./placeholders/MediaGridPlaceholder";
import SearchList from "../../list/SearchList";
let ViewAll, Component, c11012_20, c11012_21;
let env11012 = {};
const ClearAllHistory = function ClearAllHistory(props) {
const searchContext = props.searchContext;
return <PressableHighlight onPress={() => SearchPlatformActionCreators.clearSearchHistory(searchContext)} accessibilityRole="button" unstable_pressDelay={130} accessibilityLabel={intl.string(t.LFTAUp)}>
<Text variant="text-sm/semibold" color="text-brand">
{intl.string(t.LFTAUp)}
</Text>
</PressableHighlight>;
};
ViewAll = function ViewAll(props) {
return <PressableHighlight onPress={props.onJumpToMedia} accessibilityRole="button" unstable_pressDelay={130} accessibilityLabel={intl.string(t.Ofpgwh)}>
<Text variant="text-sm/semibold" color="text-brand">
{intl.string(t.Ofpgwh)}
</Text>
</PressableHighlight>;
};
Component = Module19.memo(function({ searchContext: searchContext2, onJumpToMedia, width, suggestedData }) {
let messages, isLoadingMediaGrid, isInitialSearchQuery, state, mediaSize, memo, onPressMediaItem, callback, fullscreenPlaceholderCount;
let searchContextId, setState;
messages = void 0;
isLoadingMediaGrid = void 0;
isInitialSearchQuery = void 0;
state = void 0;
mediaSize = void 0;
memo = void 0;
onPressMediaItem = void 0;
callback = void 0;
fullscreenPlaceholderCount = void 0;
const stateFromStoresObject = useStateFromStoresObject([SearchQueryStore, SearchMessageStore], () => {
const searchTabFetchId = getSearchTabFetchId(searchContext2, SearchTabs.MEDIA, SearchQueryStore.getSearchResultsQuery(searchContext2));
return {
messages: SearchMessageStore.getMessages(searchTabFetchId),
isLoadingMediaGrid: !SearchMessageStore.getIsInitialFetchComplete(searchTabFetchId),
isInitialSearchQuery: SearchQueryStore.isInitialSearchQuery(searchContext2)
};
});
messages = stateFromStoresObject.messages;
isLoadingMediaGrid = stateFromStoresObject.isLoadingMediaGrid;
isInitialSearchQuery = stateFromStoresObject.isInitialSearchQuery;
searchContextId = getSearchContextId(searchContext2);
setState = void 0;
let state2;
[state2, setState] = useState(() => SearchHistoryStore.getSearchHistory(searchContextId));
useFocusEffect(useCallback(() => {
const handleChange2 = function handleChange() {
setState(SearchHistoryStore.getSearchHistory(searchContextId));
};
setState(SearchHistoryStore.getSearchHistory(searchContextId));
SearchHistoryStore.addReactChangeListener(handleChange2);
return () => {
SearchHistoryStore.removeReactChangeListener(handleChange2);
};
}, [searchContextId]));
state = state2;
mediaSize = useSearchMediaSize(width);
memo = useMemo(() => {
if (messages != null && messages.length !== 0) {
const r26 = [];
let c28037_0 = r26;
for (const message of messages) {
getMedia(searchContext2, [message]).forEach((item) => c28037_0.push(item));
if (!(r26.length >= 9)) {
continue;
}
break;
}
return r26;
}
return EMPTY_MEDIA_RESULTS;
}, [messages, searchContext2]);
onPressMediaItem = useOnPressMediaItem({
searchContext: searchContext2,
allMediaResults: memo
});
callback = useCallback(({ media, originView }) => {
if (shouldAgeVerifyForSearchMedia(media, messages == null ? void 0 : messages.find((message) => message.id === media.messageId))) {
AgeVerificationActionCreators_native.showAgeVerificationGetStartedModal({
entryPoint: AgeVerificationModalEntryPoint.SEARCH_MEDIA_PREVIEW
});
} else {
onPressMediaItem(media, originView);
}
}, [messages, onPressMediaItem]);
fullscreenPlaceholderCount = useFullscreenPlaceholderCount({
placeholderHeight: MESSAGE_PLACEHOLDER_ITEM_SIZE,
numColumns: 1
});
return (0, jsx)(SearchList, {
data: useMemo(() => {
const r4 = [];
let c28039_0 = r4;
if (!isInitialSearchQuery && r4.length === 0) {
const r3 = 0 < fullscreenPlaceholderCount;
let r18 = 0;
if (r3) {
do {
r4.push({
type: SearchListItemTypes.MESSAGE_PLACEHOLDER,
key: `message-placeholder-${r18}`
});
r18 = r18 + 1;
} while (r18 < fullscreenPlaceholderCount);
}
return r4;
}
if (state.length > 0) {
r4.push({
type: SearchListItemTypes.SECTION,
props: {
title: intl.string(t.ZZpBr4),
trailing: (0, jsx)(ClearAllHistory, {
searchContext: searchContext2
})
}
});
state.forEach((item) => {
c28039_0.push({
type: SearchListItemTypes.SEARCH_HISTORY_ITEM,
props: {
searchHistoryItem: item,
searchContext: searchContext2
}
});
});
}
if (suggestedData != null) {
suggestedData.forEach((item) => c28039_0.push(item));
}
if (memo.length > 0) {
r4.push({
type: SearchListItemTypes.SECTION,
props: {
title: intl.string(t.LBYpDH),
trailing: (0, jsx)(ViewAll, {
onJumpToMedia
})
}
});
r4.push({
type: SearchListItemTypes.MEDIA_GRID,
props: {
media: memo.slice(0, 9),
mediaSize,
onPress: callback,
animate: true
}
});
}
return r4;
}, [callback, isInitialSearchQuery, memo, mediaSize, onJumpToMedia, fullscreenPlaceholderCount, searchContext2, state, suggestedData]),
ListFooterComponent: useMemo(() => isLoadingMediaGrid ? () => (0, jsx)(RecentsMediaGridPlaceholder, {
numRows: 3,
visible: true,
size: mediaSize
}) : null, [isLoadingMediaGrid, mediaSize])
});
});
c11012_20 = Module19.memo(function(a0) {
const searchContext4 = a0.searchContext;
let env22052 = {
$parent: env11012
};
env22052[0] = searchContext4;
env22052[1] = void 0;
env22052[2] = void 0;
env22052[3] = void 0;
const userListData = useUserListData({
query: EMPTY_SEARCH_QUERY_STRING,
withGuildMembers: false,
withAffinitySuggestions: true,
affinitySuggestionsLimit: 3,
withFriends: false,
withFriendSuggestions: false,
withFriendRequests: false,
withFriendRequestsIncoming: false,
withFriendRequestsOutgoing: false,
excludeCurrentUser: true
});
env22052[1] = userListData;
const onPressDMItem = useOnPressDMItem({
searchContext: searchContext4
});
env22052[2] = onPressDMItem;
let c22053_0 = async (c31763_0) => {
let c31763_2;
c31763_2 = void 0;
let c32071_0 = c31763_0;
const orEnsurePrivateChannel = await ChannelActionCreators.getOrEnsurePrivateChannel(c31763_0);
const r46 = c31763_2;
let c32071_1 = orEnsurePrivateChannel;
const r53 = r46.$parent;
Tracking.trackSuggestedSearchClicked({
searchContext: r53[0],
channelId: c32071_1
});
(0, r53[2])(c32071_0, c32071_1);
};
const callback3 = useCallback(function() {
return c22053_0.apply(this, arguments);
}, [onPressDMItem, searchContext4]);
env22052[3] = callback3;
return <Component {...a0} suggestedData={useMemo(() => {
const r1 = [];
let c30880_0 = r1;
const r4 = env22052[1];
if (r4.length !== 0) {
r4.forEach(({ title, items }) => {
if (items.length !== 0 && title != null) {
c30880_0.push({
type: SearchListItemTypes.SECTION,
props: {
title
}
});
items.forEach((item) => {
c30880_0.push({
type: SearchListItemTypes.DM,
props: {
user: item.user,
onPress: env22052[3]
}
});
});
}
});
}
return r1;
}, [callback3, userListData])} />;
});
c11012_21 = Module19.memo(function(a0) {
let onPressGuildTextChannel, memo2, callback2;
const searchContext3 = a0.searchContext;
onPressGuildTextChannel = void 0;
memo2 = void 0;
callback2 = void 0;
const searchContextId2 = getSearchContextId(searchContext3);
const stateFromStores = useStateFromStores([SearchGuildChannelTabStore], () => SearchGuildChannelTabStore.getTextChannels(searchContextId2));
onPressGuildTextChannel = useOnPressGuildTextChannel({
searchContext: searchContext3
});
memo2 = useMemo(() => stateFromStores.slice(0, 3), [stateFromStores]);
callback2 = useCallback((a0) => {
Tracking.trackSuggestedSearchClicked({
searchContext: searchContext3,
channelId: a0
});
onPressGuildTextChannel(a0);
}, [onPressGuildTextChannel, searchContext3]);
return <Component {...a0} suggestedData={useMemo(() => {
const r2 = [];
let c30881_0 = r2;
if (memo2.length !== 0) {
r2.push({
type: SearchListItemTypes.SECTION,
props: {
title: intl.string(t.HbJ7eD)
}
});
memo2.forEach((item) => {
c30881_0.push({
type: SearchListItemTypes.GUILD_TEXT_CHANNEL,
props: {
channel: item.channel,
lastMessageId: item.lastMessageId,
onPress: callback2
}
});
});
}
return r2;
}, [callback2, memo2])} />;
});
const r55 = Module19.memo(function RecentScreenContainer({ searchContext: searchContext4, onJumpToMedia: onJumpToMedia2, width }) {
const type = searchContext4.type;
if (SearchTypes.DMS === type) {
return (0, jsx)(c11012_20, {
searchContext: searchContext4,
onJumpToMedia: onJumpToMedia2,
width
});
}
if (SearchTypes.GUILD === type) {
return (0, jsx)(c11012_21, {
searchContext: searchContext4,
onJumpToMedia: onJumpToMedia2,
width
});
}
if (SearchTypes.GUILD_CHANNEL !== type && SearchTypes.CHANNEL !== type) {
return null;
}
return (0, jsx)(Component, {
searchContext: searchContext4,
onJumpToMedia: onJumpToMedia2,
width
});
});
export default r55;
@@ -0,0 +1,114 @@
// Metro module 15530 (f15531).
import { useCallback, useEffect, useMemo } from "react";
import SearchMessageStore from "../../../../../SearchMessageStore";
import SearchQueryStore from "../../../../stores/SearchQueryStore";
import { SearchResultContentEntityTypes } from "../../../../tracking/TrackingConstants";
import Tracking from "../../../../tracking/Tracking";
import { useStateFromStoresObject } from "../../../../../../../_bundle/Module589";
import { getSearchTabFetchId } from "../../../../../SearchUtils";
import { useMessageSearchErrorScreen } from "../../../../hooks/useSearchScreenError";
import { useSearchFetchPendingManager } from "./SearchFetchPendingManager";
import SearchPlatformUtils from "../../../../SearchPlatformUtils";
import SearchHistoricalIndexingHeader from "./SearchHistoricalIndexingHeader";
import SearchIndexingScreen from "./SearchIndexingScreen";
import ErrorScreen from "../ErrorScreen";
import SearchList from "../../../list/SearchList";
export default function BaseMessagesScreen(props) {
let r66;
let isNextPageLoading, isHistoricalIndexing, documentsIndexed, hasError, isErrorToast, showErrorToast, searchFetchPendingManager;
const { data, searchContext, tab, isFocused } = props;
let isFirstPageLoading = props.isFirstPageLoading;
const { isNextPageLoading: isNextPageLoading2, contentContainerStyle, ItemSeparatorComponent, numColumns } = props;
isNextPageLoading = void 0;
isHistoricalIndexing = void 0;
documentsIndexed = void 0;
hasError = void 0;
isErrorToast = void 0;
showErrorToast = void 0;
searchFetchPendingManager = void 0;
if (!isFirstPageLoading) {
isFirstPageLoading = isNextPageLoading2;
}
L9: {
isNextPageLoading = isFirstPageLoading;
const stateFromStoresObject = useStateFromStoresObject([SearchQueryStore, SearchMessageStore], () => {
const searchTabFetchId = getSearchTabFetchId(searchContext, tab, SearchQueryStore.getSearchResultsQuery(searchContext));
return {
isIndexing: SearchMessageStore.getIsIndexing(searchTabFetchId),
isHistoricalIndexing: SearchMessageStore.getIsHistoricalIndexing(searchTabFetchId),
documentsIndexed: SearchMessageStore.getDocumentsIndexed(searchTabFetchId)
};
});
const isIndexing = stateFromStoresObject.isIndexing;
isHistoricalIndexing = stateFromStoresObject.isHistoricalIndexing;
documentsIndexed = stateFromStoresObject.documentsIndexed;
const messageSearchErrorScreen = useMessageSearchErrorScreen({
searchContext,
tab,
hasListItems: data.length > 0
});
hasError = messageSearchErrorScreen.hasError;
const { errorText, isErrorFullscreen } = messageSearchErrorScreen;
isErrorToast = messageSearchErrorScreen.isErrorToast;
showErrorToast = messageSearchErrorScreen.showErrorToast;
searchFetchPendingManager = useSearchFetchPendingManager(searchContext);
const callback = useCallback(() => {
if (data.length !== 0) {
if (isNextPageLoading) {
searchFetchPendingManager.add(tab);
} else if (isFocused) {
if (hasError) {
searchFetchPendingManager.add(tab);
} else {
SearchPlatformUtils.fetchNextMessages(searchContext, tab);
}
} else {
searchFetchPendingManager.add(tab);
}
}
}, [data.length, isNextPageLoading, isFocused, hasError, searchContext, tab, searchFetchPendingManager]);
useEffect(() => {
let r2 = isFocused;
if (isFocused) {
r2 = !isNextPageLoading;
}
if (r2) {
searchFetchPendingManager.flush(searchContext, tab);
}
}, [isFocused, isNextPageLoading, searchContext, searchFetchPendingManager, tab]);
useEffect(() => {
let r2 = isErrorToast;
if (isErrorToast) {
r2 = !isNextPageLoading;
}
if (r2) {
r2 = isFocused;
}
if (r2) {
showErrorToast();
}
}, [isErrorToast, isNextPageLoading, isFocused, showErrorToast]);
const memo = useMemo(() => isHistoricalIndexing ? documentsIndexed != null ? documentsIndexed > 0 ? <SearchHistoricalIndexingHeader searchContext={searchContext} documentsIndexed={documentsIndexed} tab={tab} /> : null : null : null, [documentsIndexed, isHistoricalIndexing, searchContext, tab]);
if (isIndexing) {
r66 = <SearchIndexingScreen searchContext={searchContext} />;
} else {
if (isErrorFullscreen && !isNextPageLoading) {
r66 = <ErrorScreen text={errorText} />;
break L9;
}
r66 = <SearchList contentContainerStyle={contentContainerStyle} data={data} onEndReached={callback} ListHeaderComponent={memo} ItemSeparatorComponent={ItemSeparatorComponent} numColumns={numColumns} />;
}
}
return r66;
};
export function trackMessageItemPress({ searchContext: searchContext2, channelId, messageId, index }) {
const message = SearchMessageStore.getMessage(messageId);
Tracking.trackSearchResultClicked({
searchContext: searchContext2,
channelId,
messageId,
userId: message == null ? void 0 : message.author?.id,
index,
entityType: SearchResultContentEntityTypes.MESSAGE
});
}
@@ -0,0 +1,97 @@
// Metro module 15535 (f15536).
import { memo, useCallback, useMemo } from "react";
import { CARD_ESTIMATED_ITEM_SIZE, FILES_OR_LINKS_GAP_WIDTH, FILES_OR_LINKS_NUM_COLUMNS, SearchListItemTypes } from "../../../../../SearchConstants";
import { useContentContainerStyles } from "../../hooks/useContentContainerStyles";
import { useSearchMessages } from "../../hooks/useSearchMessages";
import { useFileOrLinkImageDimensions } from "../../../../hooks/useFileOrLinkImageDimensions";
import { useOnPressMessageItem } from "../../../../hooks/useOnPressSearchItem";
import BaseMessagesScreen, { trackMessageItemPress } from "./BaseMessagesScreen";
import { useSearchMessagesLoadingState } from "../../hooks/useSearchMessagesLoadingState";
import { getFiles, getGridItemSpacingStyles } from "../../../../SearchPlatformUtils";
import { getAdjustedPlaceholderCount } from "../placeholders/PlaceholderUtils";
import { CardVerticalSeparator } from "../../../list/rows/Separators";
const r26 = memo(function FilesScreen(props) {
let placeholderCount;
const { searchContext, tab, isFocused, width } = props;
placeholderCount = void 0;
const styles = useContentContainerStyles();
const searchMessages = useSearchMessages(searchContext, tab);
const fileOrLinkImageDimensions = useFileOrLinkImageDimensions(width);
const onPressMessageItem = useOnPressMessageItem({
searchContext
});
const callback = useCallback(({ channelId, messageId }, a1) => {
trackMessageItemPress({
searchContext,
channelId,
messageId,
index: a1
});
onPressMessageItem(channelId, messageId);
}, [onPressMessageItem, searchContext]);
const searchMessagesLoadingState = useSearchMessagesLoadingState({
searchContext,
tab,
placeholderHeight: CARD_ESTIMATED_ITEM_SIZE,
numColumns: FILES_OR_LINKS_NUM_COLUMNS
});
const { isFirstPageLoading, isNextPageLoading } = searchMessagesLoadingState;
placeholderCount = searchMessagesLoadingState.placeholderCount;
return <BaseMessagesScreen data={useMemo(() => {
const r5 = [];
let c28073_0 = r5;
let c28073_1 = 0;
if (searchMessages != null) {
searchMessages.forEach((searchMessage) => {
const files = getFiles(searchMessage);
files.forEach((file, index) => {
const itemIndex = c28073_1 + index;
let c31768_0 = itemIndex;
c28073_0.push({
type: SearchListItemTypes.FILE,
props: {
data: file,
onPress: (a0) => callback(a0, c31768_0),
imageStyle: fileOrLinkImageDimensions,
containerStyle: getGridItemSpacingStyles({
itemIndex,
spacing: FILES_OR_LINKS_GAP_WIDTH,
numColumns: FILES_OR_LINKS_NUM_COLUMNS
})
}
});
});
c28073_1 = c28073_1 + files.length;
});
}
if (placeholderCount > 0) {
const length = r5.length;
const adjustedPlaceholderCount = getAdjustedPlaceholderCount({
numColumns: FILES_OR_LINKS_NUM_COLUMNS,
numResults: length,
placeholderCount
});
const r4 = 0 < adjustedPlaceholderCount;
let r31 = 0;
if (r4) {
do {
r5.push({
type: SearchListItemTypes.FILE_OR_LINK_PLACEHOLDER,
key: `file-or-link-placeholder-${r31}`,
props: {
imageStyle: fileOrLinkImageDimensions,
containerStyle: getGridItemSpacingStyles({
itemIndex: length + r31,
spacing: FILES_OR_LINKS_GAP_WIDTH,
numColumns: FILES_OR_LINKS_NUM_COLUMNS
})
}
});
r31 = r31 + 1;
} while (r31 < adjustedPlaceholderCount);
}
}
return r5;
}, [callback, fileOrLinkImageDimensions, searchMessages, placeholderCount])} searchContext={searchContext} tab={tab} isFocused={isFocused} contentContainerStyle={styles.filesOrLinksContentContainer} ItemSeparatorComponent={CardVerticalSeparator} numColumns={FILES_OR_LINKS_NUM_COLUMNS} isFirstPageLoading={isFirstPageLoading} isNextPageLoading={isNextPageLoading} />;
});
export default r26;
@@ -0,0 +1,121 @@
// Metro module 15537 (f15538).
import { memo, useCallback, useMemo } from "react";
import { CARD_ESTIMATED_ITEM_SIZE, FILES_OR_LINKS_GAP_WIDTH, FILES_OR_LINKS_NUM_COLUMNS, SearchListItemTypes } from "../../../../../SearchConstants";
import { useContentContainerStyles } from "../../hooks/useContentContainerStyles";
import { useSearchMessages } from "../../hooks/useSearchMessages";
import { useFileOrLinkImageDimensions } from "../../../../hooks/useFileOrLinkImageDimensions";
import { useOnPressMessageItem, useOnPressSearchLink, useOnPressGuildVoiceChannel } from "../../../../hooks/useOnPressSearchItem";
import { useSearchMessagesLoadingState } from "../../hooks/useSearchMessagesLoadingState";
import BaseMessagesScreen, { trackMessageItemPress } from "./BaseMessagesScreen";
import { getLinks, getGridItemSpacingStyles } from "../../../../SearchPlatformUtils";
import { getAdjustedPlaceholderCount } from "../placeholders/PlaceholderUtils";
import { CardVerticalSeparator } from "../../../list/rows/Separators";
const r26 = memo(function LinksScreen(props) {
let callback2, callback3;
const { searchContext, tab, isFocused, width } = props;
callback2 = void 0;
callback3 = void 0;
const styles = useContentContainerStyles();
const searchMessages = useSearchMessages(searchContext, tab);
const fileOrLinkImageDimensions = useFileOrLinkImageDimensions(width);
const onPressMessageItem = useOnPressMessageItem({
searchContext
});
const onPressSearchLink2 = useOnPressSearchLink(searchContext);
const onPressGuildVoiceChannel = useOnPressGuildVoiceChannel({
searchContext
});
const searchMessagesLoadingState = useSearchMessagesLoadingState({
searchContext,
tab,
placeholderHeight: CARD_ESTIMATED_ITEM_SIZE,
numColumns: FILES_OR_LINKS_NUM_COLUMNS
});
const { isFirstPageLoading, isNextPageLoading, placeholderCount } = searchMessagesLoadingState;
const callback = useCallback(({ channelId, messageId }, a1) => {
trackMessageItemPress({
searchContext,
channelId,
messageId,
index: a1
});
onPressMessageItem(channelId, messageId);
}, [onPressMessageItem, searchContext]);
callback2 = useCallback(({ channelId, messageId, url, trusted }, a1) => {
trackMessageItemPress({
searchContext,
channelId,
messageId,
index: a1
});
onPressSearchLink2(url, trusted);
}, [onPressSearchLink2, searchContext]);
callback3 = useCallback(({ channelId, messageId, mentionedChannelId }, a1) => {
trackMessageItemPress({
searchContext,
channelId,
messageId,
index: a1
});
onPressGuildVoiceChannel(mentionedChannelId);
}, [onPressGuildVoiceChannel, searchContext]);
return <BaseMessagesScreen data={useMemo(() => {
const r5 = [];
let c28074_0 = r5;
let c28074_1 = 0;
if (searchMessages != null) {
searchMessages.forEach((searchMessage) => {
const links = getLinks(searchContext, searchMessage);
links.forEach((link, index) => {
const itemIndex = c28074_1 + index;
let c31769_0 = itemIndex;
c28074_0.push({
type: SearchListItemTypes.LINK,
props: {
data: link,
onPress: (a0) => callback(a0, c31769_0),
onPressSearchLink: (a0) => callback2(a0, c31769_0),
onPressGuildVoiceChannelMention: (a0) => callback3(a0, c31769_0),
imageStyle: fileOrLinkImageDimensions,
containerStyle: getGridItemSpacingStyles({
itemIndex,
spacing: FILES_OR_LINKS_GAP_WIDTH,
numColumns: FILES_OR_LINKS_NUM_COLUMNS
})
}
});
});
c28074_1 = c28074_1 + links.length;
});
}
if (placeholderCount > 0) {
const length = r5.length;
const adjustedPlaceholderCount = getAdjustedPlaceholderCount({
numColumns: FILES_OR_LINKS_NUM_COLUMNS,
numResults: length,
placeholderCount
});
const r4 = 0 < adjustedPlaceholderCount;
let r31 = 0;
if (r4) {
do {
r5.push({
type: SearchListItemTypes.FILE_OR_LINK_PLACEHOLDER,
key: `file-or-link-placeholder-${r31}`,
props: {
imageStyle: fileOrLinkImageDimensions,
containerStyle: getGridItemSpacingStyles({
itemIndex: length + r31,
spacing: FILES_OR_LINKS_GAP_WIDTH,
numColumns: FILES_OR_LINKS_NUM_COLUMNS
})
}
});
r31 = r31 + 1;
} while (r31 < adjustedPlaceholderCount);
}
}
return r5;
}, [callback3, callback2, callback, fileOrLinkImageDimensions, searchMessages, placeholderCount, searchContext])} searchContext={searchContext} tab={tab} isFocused={isFocused} contentContainerStyle={styles.filesOrLinksContentContainer} ItemSeparatorComponent={CardVerticalSeparator} numColumns={FILES_OR_LINKS_NUM_COLUMNS} isFirstPageLoading={isFirstPageLoading} isNextPageLoading={isNextPageLoading} />;
});
export default r26;
@@ -0,0 +1,130 @@
// Metro module 15527 (f15528).
import * as Module19 from "react";
import { useMemo, useCallback } from "react";
import SearchMessageStore from "../../../../../SearchMessageStore";
import SearchQueryStore from "../../../../stores/SearchQueryStore";
import { MEDIA_ITEM_GAP_WIDTH, MEDIA_NUM_COLUMNS, SearchListItemTypes, SearchMediaTypes } from "../../../../../SearchConstants";
import { EMPTY_MEDIA_RESULTS } from "../../../../SearchPlatformConstants";
import { MEDIA_MODAL_KEY } from "../../../../../../../Constants";
import { useContentContainerStyles } from "../../hooks/useContentContainerStyles";
import useSearchMediaSize from "../../../../hooks/useSearchMediaSize";
import { useSearchMessages } from "../../hooks/useSearchMessages";
import { useSearchMessagesLoadingState } from "../../hooks/useSearchMessagesLoadingState";
import SearchPlatformUtils, { getMedia, getMediaGridItemStyles } from "../../../../SearchPlatformUtils";
import { isModalOpen } from "../../../../../../main_tabs_v2/helpers/NavigationRouteUtils.native";
import { getSearchTabFetchId } from "../../../../../SearchUtils";
import { setMediaViewerSources } from "../../../../../../media_viewer/native/useMediaViewerSources";
import { useOnPressMediaItem } from "../../../../hooks/useOnPressSearchItem";
import { shouldAgeVerifyForSearchMedia } from "../../../../../../explicit_media_redaction/native/ExplicitMediaRedactionNativeUtils";
import AgeVerificationActionCreators_native from "../../../../../../age_assurance/AgeVerificationActionCreators.native";
import { AgeVerificationModalEntryPoint } from "../../../../../../age_assurance/AgeVerificationAnalyticsUtils";
import BaseMessagesScreen, { trackMessageItemPress } from "./BaseMessagesScreen";
import { getAdjustedPlaceholderCount } from "../placeholders/PlaceholderUtils";
import { MediaVerticalSeparator } from "../../../list/rows/Separators";
const r36 = Module19.memo(function MediaScreen(props) {
let onPressMediaItem, callback;
const { searchContext, tab, isFocused, width } = props;
onPressMediaItem = void 0;
callback = void 0;
const styles = useContentContainerStyles();
const size = useSearchMediaSize(width);
const searchMessages = useSearchMessages(searchContext, tab);
const searchMessagesLoadingState = useSearchMessagesLoadingState({
searchContext,
tab,
placeholderHeight: size,
numColumns: MEDIA_NUM_COLUMNS
});
const { isFirstPageLoading, isNextPageLoading, placeholderCount } = searchMessagesLoadingState;
const memo = useMemo(() => searchMessages != null ? getMedia(searchContext, searchMessages) : EMPTY_MEDIA_RESULTS, [searchMessages, searchContext]);
onPressMediaItem = useOnPressMediaItem({
searchContext,
allMediaResults: memo,
onEndReached: useCallback(() => {
SearchPlatformUtils.fetchNextMessages(searchContext, tab, () => {
if (isModalOpen(MEDIA_MODAL_KEY)) {
const messages = SearchMessageStore.getMessages(getSearchTabFetchId(searchContext, tab, SearchQueryStore.getSearchResultsQuery(searchContext)));
if (messages != null) {
const media2 = getMedia(searchContext, messages);
const sources = [];
let c30891_0 = sources;
media2.forEach((item) => {
if (!(item.type !== SearchMediaTypes.ATTACHMENT && item.type !== SearchMediaTypes.EMBED && item.type !== SearchMediaTypes.COMPONENT)) {
c30891_0.push(item.sources);
}
});
setMediaViewerSources({
sources
});
}
}
});
}, [searchContext, tab]),
onEndReachedThreshold: 500
});
callback = useCallback(({ media, originView }, a1) => {
if (shouldAgeVerifyForSearchMedia(media, searchMessages == null ? void 0 : searchMessages.find((searchMessage) => searchMessage.id === media.messageId))) {
AgeVerificationActionCreators_native.showAgeVerificationGetStartedModal({
entryPoint: AgeVerificationModalEntryPoint.SEARCH_MEDIA_PREVIEW
});
} else {
trackMessageItemPress({
searchContext,
channelId: media.channelId,
messageId: media.messageId,
index: a1
});
onPressMediaItem(media, originView);
}
}, [onPressMediaItem, searchContext, searchMessages]);
return <BaseMessagesScreen data={useMemo(() => {
const r6 = [];
let c28071_0 = r6;
memo.forEach((item, index) => {
c28071_0.push({
type: SearchListItemTypes.MEDIA,
props: {
media: item,
size,
onPress: (a0) => callback(a0, index),
containerStyle: getMediaGridItemStyles({
itemIndex: index,
numItems: memo.length,
numColumns: MEDIA_NUM_COLUMNS,
spacing: MEDIA_ITEM_GAP_WIDTH - 2
})
}
});
});
if (placeholderCount > 0) {
const length = r6.length;
const adjustedPlaceholderCount = getAdjustedPlaceholderCount({
numColumns: MEDIA_NUM_COLUMNS,
numResults: length,
placeholderCount
});
const r5 = 0 < adjustedPlaceholderCount;
let r31 = 0;
if (r5) {
do {
r6.push({
type: SearchListItemTypes.MEDIA_PLACEHOLDER,
key: `media-placeholder-${length + r31}`,
props: {
size,
containerStyle: getMediaGridItemStyles({
itemIndex: length + r31,
numItems: memo.length,
numColumns: MEDIA_NUM_COLUMNS,
spacing: MEDIA_ITEM_GAP_WIDTH - 2
})
}
});
r31 = r31 + 1;
} while (r31 < adjustedPlaceholderCount);
}
}
return r6;
}, [callback, memo, size, placeholderCount])} searchContext={searchContext} tab={tab} isFocused={isFocused} contentContainerStyle={styles.mediaContentContainer} ItemSeparatorComponent={MediaVerticalSeparator} numColumns={MEDIA_NUM_COLUMNS} isFirstPageLoading={isFirstPageLoading} isNextPageLoading={isNextPageLoading} />;
});
export default r36;
@@ -0,0 +1,81 @@
// Metro module 15544 (f15545).
import * as Module19 from "react";
import { useCallback, useRef, useMemo } from "react";
import SearchQueryStore from "../../../../stores/SearchQueryStore";
import { MESSAGE_PLACEHOLDER_ITEM_SIZE, SEARCH_FILTERS_BY_TAB, SEARCH_MESSAGES_DEFAULT_LINE_CLAMP, SEARCH_PINNED_MESSAGES_LINE_CLAMP, SearchFilter, SearchListItemTypes } from "../../../../../SearchConstants";
import { useSearchMessages } from "../../hooks/useSearchMessages";
import { useStateFromStores } from "../../../../../../../_bundle/Module589";
import { useOnPressMessageItem } from "../../../../hooks/useOnPressSearchItem";
import BaseMessagesScreen, { trackMessageItemPress } from "./BaseMessagesScreen";
import MessageSearchResultParser from "../../../../message_parsers/MessageSearchResultParser";
import { useSearchMessagesLoadingState } from "../../hooks/useSearchMessagesLoadingState";
import { getAdjustedPlaceholderCount } from "../placeholders/PlaceholderUtils";
import { useContentContainerStyles } from "../../hooks/useContentContainerStyles";
import { MessageVerticalSeparator } from "../../../list/rows/Separators";
const r30 = Module19.memo(function MessagesScreen(props) {
let onPressMessageItem, callback, ref, SEARCH_PINNED_MESSAGES_LINE_CLAMP2, memo, placeholderCount;
const { searchContext, tab, isFocused } = props;
onPressMessageItem = void 0;
callback = void 0;
ref = void 0;
SEARCH_PINNED_MESSAGES_LINE_CLAMP2 = void 0;
memo = void 0;
placeholderCount = void 0;
const searchMessages = useSearchMessages(searchContext, tab);
const stateFromStores = useStateFromStores([SearchQueryStore], () => SearchQueryStore.getSearchResultsQuery(searchContext), [searchContext]);
onPressMessageItem = useOnPressMessageItem({
searchContext
});
callback = useCallback(({ channelId, messageId }, a1) => {
trackMessageItemPress({
searchContext,
channelId,
messageId,
index: a1
});
onPressMessageItem(channelId, messageId);
}, [onPressMessageItem, searchContext]);
ref = useRef({});
SEARCH_PINNED_MESSAGES_LINE_CLAMP2 = SEARCH_FILTERS_BY_TAB[tab] === SearchFilter.Pins ? SEARCH_PINNED_MESSAGES_LINE_CLAMP : SEARCH_MESSAGES_DEFAULT_LINE_CLAMP;
memo = useMemo(() => new MessageSearchResultParser(stateFromStores, SEARCH_PINNED_MESSAGES_LINE_CLAMP2), [SEARCH_PINNED_MESSAGES_LINE_CLAMP2, stateFromStores]);
const searchMessagesLoadingState = useSearchMessagesLoadingState({
searchContext,
tab,
placeholderHeight: MESSAGE_PLACEHOLDER_ITEM_SIZE,
numColumns: 1
});
placeholderCount = searchMessagesLoadingState.placeholderCount;
const { isFirstPageLoading, isNextPageLoading } = searchMessagesLoadingState;
return <BaseMessagesScreen data={useMemo(() => {
const r4 = [];
let c28076_0 = r4;
if (searchMessages != null) {
searchMessages.forEach((searchMessage, c30893_0) => {
c28076_0.push({
type: SearchListItemTypes.MESSAGE,
props: {
message: memo.parse(searchMessage),
onPress: (a0) => callback(a0, c30893_0),
lineClamp: SEARCH_PINNED_MESSAGES_LINE_CLAMP2,
messageSizeCacheRef: ref
}
});
});
}
const adjustedPlaceholderCount = getAdjustedPlaceholderCount({
numColumns: 1,
numResults: r4.length,
placeholderCount
});
let r0 = 0;
while (r0 < adjustedPlaceholderCount) {
r4.push({
type: SearchListItemTypes.MESSAGE_PLACEHOLDER,
key: `message-placeholder-${r0}`
});
r0 = r0 + 1;
}
return r4;
}, [callback, SEARCH_PINNED_MESSAGES_LINE_CLAMP2, searchMessages, memo, placeholderCount])} searchContext={searchContext} tab={tab} isFocused={isFocused} contentContainerStyle={useContentContainerStyles().messagesContentContainer} ItemSeparatorComponent={MessageVerticalSeparator} isFirstPageLoading={isFirstPageLoading} isNextPageLoading={isNextPageLoading} />;
});
export default r30;
@@ -0,0 +1,124 @@
// Metro module 15551 (f15552).
import * as Module19 from "react";
import { useEffect, useCallback, useRef, useMemo } from "react";
import ChannelPinsStore, { FetchState } from "../../../../../../../stores/ChannelPinsStore";
import SearchMessageStore from "../../../../../SearchMessageStore";
import SearchQueryStore from "../../../../stores/SearchQueryStore";
import { MESSAGE_PLACEHOLDER_ITEM_SIZE, SEARCH_PINNED_MESSAGES_LINE_CLAMP, SearchListItemTypes } from "../../../../../SearchConstants";
import { SearchResultContentEntityTypes } from "../../../../tracking/TrackingConstants";
import { SearchTypes } from "../../../../../../../Constants";
import { useStateFromStores, useStateFromStoresObject } from "../../../../../../../_bundle/Module589";
import { useFullscreenPlaceholderCount } from "../../../../hooks/usePlaceholderStyles";
import ChannelPinActionCreators from "../../../../../../../actions/ChannelPinActionCreators";
import { useOnPressMessageItem } from "../../../../hooks/useOnPressSearchItem";
import Tracking from "../../../../tracking/Tracking";
import { useContentContainerStyles } from "../../hooks/useContentContainerStyles";
import SearchList from "../../../list/SearchList";
import { MessageVerticalSeparator } from "../../../list/rows/Separators";
import MessagesScreen from "./MessagesScreen";
const InitialPinsScreen = function InitialPinsScreen(props) {
let fullscreenPlaceholderCount, items, showLoading, onPressMessageItem, callback, ref;
const { searchContext, isFocused } = props;
fullscreenPlaceholderCount = void 0;
items = void 0;
showLoading = void 0;
onPressMessageItem = void 0;
callback = void 0;
ref = void 0;
const stateFromStores = useStateFromStores([SearchQueryStore], () => SearchQueryStore.isInitialSearchQuery(searchContext), [searchContext]);
fullscreenPlaceholderCount = useFullscreenPlaceholderCount({
placeholderHeight: MESSAGE_PLACEHOLDER_ITEM_SIZE,
numColumns: 1
});
useEffect(() => {
let r2 = stateFromStores;
if (stateFromStores) {
r2 = isFocused;
}
if (r2) {
ChannelPinActionCreators.fetchPins(searchContext.channelId);
}
}, [isFocused, stateFromStores, searchContext.channelId]);
const stateFromStoresObject = useStateFromStoresObject([ChannelPinsStore], () => {
const pins = ChannelPinsStore.getPins(searchContext.channelId);
return {
items: pins?.items,
showLoading: pins == null || pins.state === FetchState.LOADING
};
});
items = stateFromStoresObject.items;
showLoading = stateFromStoresObject.showLoading;
onPressMessageItem = useOnPressMessageItem({
searchContext
});
callback = useCallback(({ channelId, messageId }, a1) => {
const message = SearchMessageStore.getMessage(messageId);
Tracking.trackSearchResultClicked({
searchContext,
channelId,
messageId,
userId: message == null ? void 0 : message.author?.id,
index: a1,
entityType: SearchResultContentEntityTypes.MESSAGE
});
onPressMessageItem(channelId, messageId);
}, [onPressMessageItem, searchContext]);
ref = useRef({});
const memo = useMemo(() => {
const r4 = [];
let c28079_0 = r4;
if (items != null) {
items.forEach(({ message }, c30894_0) => {
c28079_0.push({
type: SearchListItemTypes.MESSAGE,
props: {
message,
onPress: (a0) => callback({
channelId: a0.channelId,
messageId: a0.messageId
}, c30894_0),
lineClamp: SEARCH_PINNED_MESSAGES_LINE_CLAMP,
messageSizeCacheRef: ref
}
});
});
}
if (showLoading) {
let r0 = 0;
while (r0 < fullscreenPlaceholderCount) {
r4.push({
type: SearchListItemTypes.MESSAGE_PLACEHOLDER,
key: `message-placeholder-${r0}`
});
r0 = r0 + 1;
}
}
return r4;
}, [fullscreenPlaceholderCount, callback, showLoading, items]);
return <SearchList contentContainerStyle={useContentContainerStyles().messagesContentContainer} data={memo} onEndReached={() => {
ChannelPinActionCreators.fetchPins(searchContext.channelId, {
before: items == null ? void 0 : items.at(-1)?.pinnedAt
});
}} ItemSeparatorComponent={MessageVerticalSeparator} />;
};
const r41 = Module19.memo(function PinsScreen(props) {
let r27, isFocused2, tab;
let searchContext2;
L6: {
L5: {
searchContext2 = props.searchContext;
tab = props.tab;
isFocused2 = props.isFocused;
if (useStateFromStores([SearchQueryStore], () => SearchQueryStore.isInitialSearchQuery(searchContext2), [searchContext2])) {
if (searchContext2.type !== SearchTypes.CHANNEL && searchContext2.type !== SearchTypes.GUILD_CHANNEL && searchContext2.type !== SearchTypes.THREAD) {
break L5;
}
r27 = <InitialPinsScreen searchContext={searchContext2} tab={tab} isFocused={isFocused2} />;
break L6;
}
}
r27 = <MessagesScreen searchContext={searchContext2} tab={tab} isFocused={isFocused2} />;
}
return r27;
});
export default r41;
@@ -0,0 +1,77 @@
// Metro module 15531 (f15532).
import { useEffect } from "react";
import SearchPlatformUtils from "../../../../SearchPlatformUtils";
import useInitialValue from "../../../../../../../hooks/useInitialValue";
function $mk96811($env) {
return (a0) => {
$env[0].pending.add(a0);
};
}
function $mk96812($env) {
return (a0) => {
$env[0].pending.delete(a0);
};
}
function $mk96813($env) {
return (a0) => $env[0].pending.has(a0);
}
function $mk96814($env) {
return (a0, a1) => {
const r2 = $env[0];
if (r2.has(a1)) {
const r8 = $env.$parent;
if ((0, r8[0])(r8[1][1]).fetchNextMessages(a0, a1)) {
r2.remove(a1);
}
}
};
}
function $mk96815($env) {
return () => {
$env[0].pending = new Set();
};
}
let env11060 = {};
class SearchFetchPendingManager {
constructor() {
let env22121;
const r1 = env22121 = {
$parent: env11060
};
env22121[0] = this;
this.pending = new Set();
this.add = $mk96811(r1);
this.remove = $mk96812(r1);
this.has = $mk96813(r1);
this.flush = $mk96814(r1);
this.reset = $mk96815(r1);
}
}
export function useSearchFetchPendingManager(a0) {
let c22122_1;
let c22122_0 = a0;
const initialValue = useInitialValue(() => {
let env28072;
const r9 = {
__proto__: SearchFetchPendingManager.prototype
};
const r10 = env28072 = {
$parent: env11060
};
env28072[0] = r9;
r9.pending = new Set();
r9.add = $mk96811(r10);
r9.remove = $mk96812(r10);
r9.has = $mk96813(r10);
r9.flush = $mk96814(r10);
r9.reset = $mk96815(r10);
return r9;
});
c22122_1 = initialValue;
useEffect(() => SearchPlatformUtils.subscribeTextInputValue(c22122_0, (a0, a1) => {
if (a1 !== a0) {
c22122_1.reset();
}
}), [a0, initialValue]);
return initialValue;
}
@@ -0,0 +1,40 @@
// Metro module 15532 (f15533).
import { useMemo, useEffect } from "react";
import LocaleStore from "../../../../../../user_settings/LocaleStore";
import * as _SearchConstants from "../../../../../SearchConstants";
import { SearchTabs } from "../../../../../SearchConstants";
import { createStyles } from "../../../../../../../design/components/Styles/native/createStyles";
import Tracking from "../../../../tracking/Tracking";
import { Card } from "../../../../../../../design/components/Card/native/Card.native";
import { Text } from "../../../../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../../../../intl/index.native";
const { SEARCH_LIST_HORIZONTAL_PADDING, SEARCH_ROW_TAP_STATE_PADDING } = _SearchConstants;
const useStyles = createStyles({
header: {
marginBottom: 16
},
headerMessages: {
marginHorizontal: SEARCH_LIST_HORIZONTAL_PADDING,
marginTop: SEARCH_ROW_TAP_STATE_PADDING
}
});
export default function HistoricalIndexingHeader(props) {
const { searchContext, documentsIndexed, tab } = props;
const styles = useStyles();
const memo = useMemo(() => Number(documentsIndexed).toLocaleString(LocaleStore.locale), [documentsIndexed]);
const memo2 = useMemo(() => tab !== SearchTabs.MESSAGES ? tab === SearchTabs.PINS ? styles.headerMessages : void 0 : styles.headerMessages, [styles.headerMessages, tab]);
useEffect(() => {
Tracking.trackSearchIndexing({
searchContext,
isHistoricalIndexing: true,
documentsIndexed
});
}, [documentsIndexed, searchContext]);
return <Card variant="primary" border="subtle" style={[styles.header, memo2]}>
<Text variant="heading-sm/normal" color="interactive-text-default">
{intl.format(t["4Y3O+O"], {
count: memo
})}
</Text>
</Card>;
};
@@ -0,0 +1,14 @@
// Metro module 15533 (f15534).
import { useEffect } from "react";
import Tracking from "../../../../tracking/Tracking";
import { getIndexingErrorText } from "../../../../../SearchUtils";
import ErrorScreen from "../ErrorScreen";
export default function SearchIndexingScreen(props) {
const searchContext = props.searchContext;
useEffect(() => {
Tracking.trackSearchIndexing({
searchContext
});
}, [searchContext]);
return <ErrorScreen text={getIndexingErrorText(searchContext)} />;
};
@@ -0,0 +1,19 @@
// Metro module 15504 (f15505).
import { useMemo } from "react";
import { usePlaceholderAnimatedStyle } from "../../../../hooks/usePlaceholderStyles";
import { useFontScale } from "../../../../../../screen/native/useFontScale";
import ReanimatedRexport from "../../../../../../reanimated/ReanimatedRexport";
import { SearchListCardContainer } from "../../../list/SearchListCard";
export default function FileOrLinkGridPlaceholderItem(props) {
const { imageStyle, containerStyle } = props;
const placeholderAnimatedStyle = usePlaceholderAnimatedStyle(true);
const fontScale = useFontScale();
const width = imageStyle.width;
const height = imageStyle.height + 108 * fontScale;
return <ReanimatedRexport.View style={[containerStyle, placeholderAnimatedStyle]} pointerEvents="none">
<SearchListCardContainer containerStyle={useMemo(() => ({
width,
height
}), [width, height])} />
</ReanimatedRexport.View>;
};
@@ -0,0 +1,53 @@
// Metro module 15511 (f15512).
import { View } from "react-native";
import { SEARCH_ROW_TAP_STATE_PADDING } from "../../../../../SearchConstants";
import { createStyles } from "../../../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../../../_bundle/Module712";
import { usePlaceholderAnimatedStyle } from "../../../../hooks/usePlaceholderStyles";
import ReanimatedRexport from "../../../../../../reanimated/ReanimatedRexport";
const useStyles = createStyles({
itemContainer: {
flexDirection: "row",
paddingHorizontal: 16,
overflow: "hidden",
height: 64,
paddingVertical: SEARCH_ROW_TAP_STATE_PADDING,
alignItems: "center"
},
avatar: {
height: 48,
width: 48,
borderRadius: Module712.radii.xl,
marginRight: 16,
backgroundColor: Module712.colors.BORDER_SUBTLE
},
innerContainer: {
justifyContent: "center",
flex: 1
},
upperText: {
width: "50%",
borderRadius: Module712.radii.md,
height: 16,
marginBottom: 8,
backgroundColor: Module712.colors.BORDER_SUBTLE
},
lowerText: {
justifyContent: "center",
width: "100%",
borderRadius: Module712.radii.md,
height: 16,
backgroundColor: Module712.colors.BORDER_SUBTLE
}
});
export default function FormRowPlaceholderItem(props) {
const style = props.style;
const styles = useStyles();
return <ReanimatedRexport.View style={[usePlaceholderAnimatedStyle(true), styles.itemContainer, style]} pointerEvents="none">
<View style={styles.avatar} />
<View style={styles.innerContainer}>
<View style={styles.upperText} />
<View style={styles.lowerText} />
</View>
</ReanimatedRexport.View>;
};
@@ -0,0 +1,20 @@
// Metro module 15486 (f15487).
import { memo } from "react";
import { View } from "react-native";
import { createStyles } from "../../../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../../../_bundle/Module712";
const useStyles = createStyles({
imageContainer: {
flex: 1,
borderRadius: Module712.radii.xs,
overflow: "hidden",
backgroundColor: Module712.colors.BORDER_SUBTLE
}
});
const r37 = memo(function({ width, height, style }) {
return <View style={[{
width,
height
}, useStyles().imageContainer, style]} />;
});
export default r37;
@@ -0,0 +1,89 @@
// Metro module 15485 (f15486).
import { useMemo, Fragment } from "react";
import { View } from "react-native";
import * as _SearchConstants from "../../../../../SearchConstants";
import { MEDIA_ITEM_GAP_WIDTH, MEDIA_NUM_COLUMNS } from "../../../../../SearchConstants";
import { createStyles } from "../../../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../../../_bundle/Module712";
import { usePlaceholderAnimatedStyle } from "../../../../hooks/usePlaceholderStyles";
import ReanimatedRexport from "../../../../../../reanimated/ReanimatedRexport";
import GridItemPlaceholder from "./GridItemPlaceholder";
import { range, chunk } from "../../../../../../../_bundle/Module12";
import { Text } from "../../../../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../../../../intl/index.native";
import { getMediaGridItemStyles } from "../../../../SearchPlatformUtils";
import { MediaVerticalSeparator } from "../../../list/rows/Separators";
const { SEARCH_LIST_SECTION_TOP_PADDING, SEARCH_LIST_HORIZONTAL_PADDING } = _SearchConstants;
const useStyles = createStyles({
container: {
zIndex: 1,
position: "absolute",
width: "100%"
},
recentsContainer: {
position: "relative",
paddingHorizontal: SEARCH_LIST_HORIZONTAL_PADDING
},
row: {
flexDirection: "row"
},
section: {
flex: 1,
display: "flex",
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
textTransform: "none",
paddingTop: SEARCH_LIST_SECTION_TOP_PADDING,
paddingBottom: 8
},
sectionItem: {
borderRadius: Module712.radii.xs,
backgroundColor: Module712.colors.BORDER_SUBTLE
},
sectionText: {
opacity: 0
}
});
export default function MediaGridPlaceholderItem(props) {
const { size: size2, containerStyle } = props;
return <ReanimatedRexport.View style={[containerStyle, usePlaceholderAnimatedStyle(true)]} pointerEvents="none">
<GridItemPlaceholder height={size2} width={size2} style={containerStyle} />
</ReanimatedRexport.View>;
};
export function RecentsMediaGridPlaceholder(props) {
let memo2;
const { visible, size, numRows } = props;
memo2 = void 0;
const styles = useStyles();
const memo = useMemo(() => range(0, numRows * MEDIA_NUM_COLUMNS), [numRows]);
memo2 = useMemo(() => chunk(memo, MEDIA_NUM_COLUMNS), [memo]);
return <ReanimatedRexport.View style={[styles.container, styles.recentsContainer, usePlaceholderAnimatedStyle(visible)]} pointerEvents="none">
<View style={styles.section}>
<View style={styles.sectionItem}>
<Text style={styles.sectionText} maxFontSizeMultiplier={2} accessibilityRole="header" variant="text-sm/semibold" color="interactive-text-default">
{intl.string(t.LBYpDH)}
</Text>
</View>
<View style={styles.sectionItem}>
<Text variant="text-sm/semibold" color="text-brand" style={styles.sectionText}>
{intl.string(t.LFTAUp)}
</Text>
</View>
</View>
{memo2.map((item, index) => {
let c28057_0 = index;
return <Fragment key={index}>
<View style={styles.row}>
{item.map((item, index) => <GridItemPlaceholder key={index} height={size} width={size} style={getMediaGridItemStyles({
itemIndex: c28057_0 * MEDIA_NUM_COLUMNS + index,
numItems: memo.length,
numColumns: MEDIA_NUM_COLUMNS,
spacing: MEDIA_ITEM_GAP_WIDTH
})} />)}
</View>
{index < memo2.length - 1 && <MediaVerticalSeparator />}
</Fragment>;
})}
</ReanimatedRexport.View>;
}
@@ -0,0 +1,11 @@
// Metro module 15517 (f15518).
import { createStyles } from "../../../../../../../design/components/Styles/native/createStyles";
import FormRowPlaceholder from "./FormRowPlaceholder";
const useStyles = createStyles({
container: {
paddingHorizontal: 0
}
});
export default function MemberRowPlaceholderItem() {
return <FormRowPlaceholder style={useStyles().container} />;
};
@@ -0,0 +1,4 @@
// Metro module 15534 (f15535).
export function getAdjustedPlaceholderCount({ numColumns, numResults, placeholderCount }) {
return placeholderCount !== 0 ? placeholderCount + (numColumns - numResults % numColumns) : 0;
}