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,17 @@
// Metro module 10290 (f10291).
import { Fonts } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { hexOpacityToRgba } from "../../../../utils/ColorUtils";
import Module712 from "../../../../_bundle/Module712";
import { LegacyText } from "../../../../design/void/native";
const useStyles = createStyles({
text: {
fontFamily: Fonts.PRIMARY_BOLD,
backgroundColor: hexOpacityToRgba(Module712.unsafe_rawColors.YELLOW_300, 0.3),
color: Module712.colors.TEXT_STRONG
}
});
export default function HighlightText(props) {
const children = props.children;
return <LegacyText style={useStyles().text}>{children}</LegacyText>;
};
@@ -0,0 +1,213 @@
// Metro module 15464 (f15465).
import * as Module19 from "react";
import { forwardRef, useMemo, useRef, useImperativeHandle, useEffect, useCallback } from "react";
import { View } from "react-native";
import ChannelStore from "../../../../../stores/ChannelStore";
import GuildStore from "../../../../../stores/GuildStore";
import RelationshipStore from "../../../../../stores/RelationshipStore";
import UserStore from "../../../../../stores/UserStore";
import SearchQueryStore from "../../stores/SearchQueryStore";
import { SEARCH_BAR_HEIGHT, SearchQueryTagTypes } from "../../../SearchConstants";
import { SearchFilterAddLocations } from "../../tracking/TrackingConstants";
import { SearchTypes } from "../../../../../Constants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { intl, t } from "../../../../../intl/index.native";
import { computeChannelName } from "../../../../channel/useChannelName";
import { useStateFromStores } from "../../../../../_bundle/Module589";
import MobileVisualRefreshExperiment from "../../../../themes/experiments/MobileVisualRefreshExperiment";
import { useFontScale } from "../../../../screen/native/useFontScale";
import SearchPlatformUtils, { toSearchBarTag } from "../../SearchPlatformUtils";
import SearchPlatformActionCreators from "../../SearchPlatformActionCreators";
import { AccessibilityAnnouncer } from "../../../../../_bundle/Module3902";
import Tracking from "../../tracking/Tracking";
import { isValidFilterAnswerForSubmit } from "../../../tokens/SearchTokens";
import TagListInput_native from "../../../../../design/components/TagListInput/native/TagListInput.native";
import SearchBarActivityIcon from "./SearchBarActivityIcon";
const useStyles = createStyles((a0, a1) => ({
searchBar: {
...a0 ? {
minHeight: a1 + 2
} : {
borderRadius: Module712.radii.round,
minHeight: a1
}
},
icon: {
width: 32,
minHeight: a1,
justifyContent: "center",
zIndex: 10
}
}));
const r50 = Module19.memo(forwardRef(function({ searchContext, setSuggestionsDismissed }, a1) {
let ref;
let searchContext2;
ref = void 0;
const styles = useStyles(MobileVisualRefreshExperiment("SearchBar"), SEARCH_BAR_HEIGHT * Math.min(2, useFontScale()));
const stateFromStores = useStateFromStores([SearchQueryStore], () => SearchQueryStore.getTags(searchContext), [searchContext]);
const memo2 = useMemo(() => stateFromStores.map(toSearchBarTag), [stateFromStores]);
const memo = useMemo(() => {
if (stateFromStores.length !== 0) {
return intl.formatToPlainString(t["0zoRaK"], {
text: stateFromStores.map((stateFromStore) => stateFromStore.text).join(", ")
});
}
}, [stateFromStores]);
ref = useRef(null);
searchContext2 = searchContext;
const stateFromStores2 = useStateFromStores([SearchQueryStore], () => {
let r89;
const channelIds = SearchQueryStore.getChannelIds(searchContext2);
const type = searchContext2.type;
if (SearchTypes.GUILD_CHANNEL !== type && SearchTypes.GUILD !== type) {
if (SearchTypes.CHANNEL === type) {
const channel = ChannelStore.getChannel(searchContext2.channelId);
return channel == null ? intl.string(t["5h0QOP"]) : intl.formatToPlainString(t.LDpotA, {
guildName: computeChannelName(channel, UserStore, RelationshipStore, true)
});
}
if (SearchTypes.DMS === type) {
return intl.string(t.m7OrlR);
}
return intl.string(t["5h0QOP"]);
}
if (channelIds.size === 0) {
const name = GuildStore.getGuild(searchContext2.guildId)?.name;
r89 = name == null ? intl.string(t["5h0QOP"]) : intl.formatToPlainString(t.LDpotA, {
guildName: name
});
} else {
r89 = intl.string(t["5h0QOP"]);
}
return r89;
}, [searchContext]);
useImperativeHandle(a1, () => ({
setText: (a0) => {
const current = ref.current;
return current == null ? void 0 : current.setText(a0);
},
getText: () => {
const current = ref.current;
let r6 = current == null ? void 0 : current.getText();
if (r6 == null) {
r6 = "";
}
return r6;
},
blur: () => {
const current = ref.current;
return current == null ? void 0 : current.blur();
},
focus: () => {
const current = ref.current;
return current == null ? void 0 : current.focus();
},
isFocused: () => {
const current = ref.current;
let r6 = current == null ? void 0 : current.isFocused();
if (r6 == null) {
r6 = false;
}
return r6;
},
measure: (a0) => {
const current = ref.current;
return current == null ? void 0 : current.measure(a0);
},
measureInWindow: (a0) => {
const current = ref.current;
return current == null ? void 0 : current.measureInWindow(a0);
},
measureLayout: (a0, a1, a2) => {
const current = ref.current;
return current == null ? void 0 : current.measureLayout(a0, a1, a2);
}
}));
useEffect(() => SearchPlatformUtils.subscribeTextInputValue(searchContext, (a0, a1, a2) => {
if (!(a2 ? a2 : a0 == null)) {
const current = ref.current;
if (current != null) {
current.setText(a0);
}
}
}), [searchContext]);
const callback = useCallback((a0) => {
let c28031_0 = a0;
if (SearchQueryStore.getTextInputValue(searchContext) !== a0) {
SearchPlatformActionCreators.updateSearchQuery(searchContext, (a0) => {
a0.setTextInputValue(c28031_0, true);
});
SearchPlatformUtils.syncAutocompleteDebounced(searchContext);
if (!SearchQueryStore.isAutocompleteVisible(searchContext)) {
if (SearchQueryStore.isInitialSearchQuery(searchContext)) {
SearchPlatformUtils.fetchInitialMessages(searchContext);
} else {
SearchPlatformUtils.fetchInitialMessagesDebounced(searchContext);
}
}
}
}, [searchContext]);
const callback2 = useCallback((a0) => {
let c28032_0 = a0;
const r10 = SearchQueryStore.getTags(searchContext)[a0];
let c28032_1 = r10;
if (r10 != null) {
AccessibilityAnnouncer.announce(intl.formatToPlainString(t.srlxB8, {
text: r10.text
}));
if (r10.type === SearchQueryTagTypes.COMPLETE) {
Tracking.trackSearchFilterRemove({
searchContext,
searchTokenType: r10.searchTokenType,
isDefault: r10.location === SearchFilterAddLocations.CLIENT_AUTO_ADD
});
}
SearchPlatformActionCreators.updateSearchQuery(searchContext, (a0) => {
a0.removeTag(c28032_0);
if (c28032_1.type === SearchQueryTagTypes.PREFIX) {
a0.restoreDraftTextInputValue();
}
});
SearchPlatformUtils.syncAutocompleteDebounced(searchContext);
const queryString = SearchQueryStore.getQueryString(searchContext);
const searchResultsQuery = SearchQueryStore.getSearchResultsQuery(searchContext);
const isInitialSearchQuery = SearchQueryStore.isInitialSearchQuery(searchContext);
if (queryString !== searchResultsQuery) {
if (isInitialSearchQuery) {
SearchPlatformUtils.fetchInitialMessages(searchContext);
} else {
SearchPlatformUtils.fetchInitialMessagesDebounced(searchContext);
}
}
}
}, [searchContext]);
const memo3 = useMemo(() => () => {
setSuggestionsDismissed();
const prefixTag = SearchQueryStore.getPrefixTag(searchContext);
const text = SearchQueryStore.getTextInputValue(searchContext).trim();
if (prefixTag != null && text !== "" && isValidFilterAnswerForSubmit(prefixTag.searchTokenType, text)) {
SearchPlatformActionCreators.updateSearchQuery(searchContext, (a0) => {
a0.setTextInputValue("");
a0.addTag({
type: SearchQueryTagTypes.ANSWER,
text
});
a0.restoreDraftTextInputValue();
});
Tracking.trackSearchFilterAdd({
searchContext,
searchTokenType: prefixTag.searchTokenType,
location: prefixTag.location
});
}
if (!SearchQueryStore.isQueryStringEmpty(searchContext)) {
SearchPlatformActionCreators.updateSearchQuery(searchContext, (a0) => a0.markExplicitSearchSubmitted());
SearchPlatformUtils.fetchInitialMessages(searchContext);
}
}, [searchContext, setSuggestionsDismissed]);
return <TagListInput_native ref={ref} accessibilityHint={memo} autoFocus defaultValue={SearchQueryStore.getTextInputValue(searchContext)} style={styles.searchBar} tags={memo2} icon={<View style={styles.icon}>
<SearchBarActivityIcon searchContext={searchContext} />
</View>} onChangeText={callback} onRemove={callback2} placeholder={stateFromStores2} onSubmitEditing={memo3} leadingFade horizontal autoClearInputOnTagAdd={false} />;
}));
export default r50;
@@ -0,0 +1,104 @@
// Metro module 15465 (f15466).
import { memo, useEffect } from "react";
import { ActivityIndicator } from "react-native";
import SearchMessageStore from "../../../SearchMessageStore";
import SearchQueryStore from "../../stores/SearchQueryStore";
import { SEARCH_MESSAGE_TAB_SENTINEL } from "../../../SearchConstants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../../_bundle/defaultAreStatesEqual";
import { getSearchTabFetchId } from "../../../SearchUtils";
import * as _ReanimatedRexport from "../../../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useSharedValue, useAnimatedStyle } from "../../../../reanimated/ReanimatedRexport";
import { withTiming } from "../../../../../design/animation/reanimated/timing/timing";
import { MagnifyingGlassIcon } from "../../../../../design/components/Icon/native/redesign/generated/MagnifyingGlassIcon";
import { isAndroid } from "../../../../../utils/PlatformUtils";
const useStyles = createStyles({
spinnerColor: {
color: Module712.colors.INTERACTIVE_TEXT_DEFAULT
},
spinner: {
width: 18,
height: 18,
alignItems: "center",
justifyContent: "center",
position: "absolute"
},
icon: {
marginLeft: 12,
marginRight: 4
}
});
let c11001_12 = {
START: 0,
0: "START",
END: 1,
1: "END"
};
const ANIMATION_STATE_INPUT = [c11001_12.START, c11001_12.END];
const __initData = {
code: "function SearchBarActivityIconTsx1(){const{interpolate,fadeAnimationState,ANIMATION_STATE_INPUT}=this.__closure;return{opacity:interpolate(fadeAnimationState.get(),ANIMATION_STATE_INPUT,[0,0.5])};}"
};
const __initData2 = {
code: "function SearchBarActivityIconTsx2(){const{interpolate,fadeAnimationState,ANIMATION_STATE_INPUT}=this.__closure;return{opacity:interpolate(fadeAnimationState.get(),ANIMATION_STATE_INPUT,[1,0])};}"
};
const r54 = memo(function SearchBarActivityIcon(props) {
let sharedValue;
const searchContext = props.searchContext;
sharedValue = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([SearchQueryStore, SearchMessageStore], () => {
const isInitialFetchComplete = SearchMessageStore.getIsInitialFetchComplete(getSearchTabFetchId(searchContext, SEARCH_MESSAGE_TAB_SENTINEL, SearchQueryStore.getSearchResultsQuery(searchContext)));
let r18 = !isInitialFetchComplete;
const isInitialSearchQuery = SearchQueryStore.isInitialSearchQuery(searchContext);
const isAutocompleteVisible = SearchQueryStore.isAutocompleteVisible(searchContext);
if (!isInitialFetchComplete) {
r18 = !isInitialSearchQuery;
}
if (r18) {
r18 = !isAutocompleteVisible;
}
return r18;
}, [searchContext]);
sharedValue = useSharedValue(c11001_12.START);
useEffect(() => {
if (stateFromStores) {
sharedValue.set(withTiming(c11001_12.END));
} else {
sharedValue.set(withTiming(c11001_12.START));
}
}, [stateFromStores, sharedValue]);
const E = function E() {
return {
opacity: _ReanimatedRexport.interpolate(sharedValue.get(), ANIMATION_STATE_INPUT, [0, 0.5])
};
};
E.__closure = {
interpolate: _ReanimatedRexport.interpolate,
fadeAnimationState: sharedValue,
ANIMATION_STATE_INPUT
};
E.__workletHash = 12880513119188;
E.__initData = __initData;
const animatedStyle = useAnimatedStyle(E);
const v = function v() {
return {
opacity: _ReanimatedRexport.interpolate(sharedValue.get(), ANIMATION_STATE_INPUT, [1, 0])
};
};
v.__closure = {
interpolate: _ReanimatedRexport.interpolate,
fadeAnimationState: sharedValue,
ANIMATION_STATE_INPUT
};
v.__workletHash = 11061952032557;
v.__initData = __initData2;
return <>
{[<ReanimatedRexport.View style={animatedStyle}>
<ActivityIndicator color={styles.spinnerColor.color} style={[styles.icon, styles.spinner]} />
</ReanimatedRexport.View>, <ReanimatedRexport.View style={useAnimatedStyle(v)}>
<MagnifyingGlassIcon style={styles.icon} size={isAndroid() ? "sm" : "xs"} color="interactive-text-default" />
</ReanimatedRexport.View>]}
</>;
});
export default r54;
@@ -0,0 +1,37 @@
// Metro module 15474 (f15475).
import { memo } from "react";
import { View } from "react-native";
import SearchQueryStore from "../../stores/SearchQueryStore";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import AppFreezer from "../../../../panels/morphable/native/AppFreezer";
import { useStateFromStores } from "../../../../../_bundle/Module589";
import SearchTabsLayout from "../tabs/SearchTabsLayout";
import AutocompleteScreen from "./autocomplete/AutocompleteScreen";
let useStyles;
const SearchFreezeContainer = function SearchFreezeContainer(props) {
const { visible, children, containerStyle } = props;
const styles = useStyles();
return <AppFreezer manualFreeze={!visible} placeholder={null}>
<View style={[containerStyle, visible ? styles.visible : styles.hidden]} aria-hidden={!visible}>{children}</View>
</AppFreezer>;
};
useStyles = createStyles({
hidden: {
opacity: 0
},
visible: {
flex: 1
}
});
const r35 = memo(function({ searchContext, containerStyle, width }) {
const stateFromStores = useStateFromStores([SearchQueryStore], () => SearchQueryStore.isAutocompleteVisible(searchContext), [searchContext]);
return <>
<SearchFreezeContainer visible={!stateFromStores} containerStyle={containerStyle}>
<SearchTabsLayout searchContext={searchContext} width={width} />
</SearchFreezeContainer>
<SearchFreezeContainer visible={stateFromStores} containerStyle={containerStyle}>
<AutocompleteScreen searchContext={searchContext} />
</SearchFreezeContainer>
</>;
});
export default r35;
@@ -0,0 +1,54 @@
// Metro module 15463 (f15464).
import { memo, forwardRef } from "react";
import { View } from "react-native";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import SearchBar from "./SearchBar";
import SearchFilterSuggestions from "./autocomplete/SearchFilterSuggestions";
import SearchFilterButton from "./autocomplete/SearchFilterButton";
const useStyles = createStyles({
header: {
flexDirection: "row",
alignItems: "center",
paddingLeft: 16,
zIndex: 10
},
headerWithBackButton: {
paddingLeft: 0
},
headerSearch: {
flex: 1,
flexGrow: 1
},
headerControlsRight: {
paddingRight: 16,
paddingLeft: 12
},
suggestionsAnchor: {
height: 0
},
suggestions: {
position: "absolute",
left: 0,
right: -50,
top: 8
},
suggestionsWithBackButton: {
left: -28
}
});
const r38 = memo(forwardRef(function({ searchContext, onSuggestionsLayoutMesure, suggestionsDismissed, setSuggestionsDismissed, backButton }, a1) {
const styles = useStyles();
return <View style={[styles.header, backButton != null && styles.headerWithBackButton]}>
{backButton}
<View style={styles.headerSearch}>
<SearchBar ref={a1} searchContext={searchContext} setSuggestionsDismissed={setSuggestionsDismissed} />
<View style={styles.suggestionsAnchor}>
<SearchFilterSuggestions searchContext={searchContext} onLayoutMeasure={onSuggestionsLayoutMesure} dismissed={suggestionsDismissed} containerStyle={[styles.suggestions, backButton != null && styles.suggestionsWithBackButton]} />
</View>
</View>
<View style={styles.headerControlsRight}>
<SearchFilterButton searchContext={searchContext} />
</View>
</View>;
}));
export default r38;
@@ -0,0 +1,259 @@
// Metro module 15559 (f15560).
import * as Module19 from "react";
import { useState, useCallback, useEffect, useMemo } from "react";
import ChannelStore from "../../../../../../stores/ChannelStore";
import RelationshipStore from "../../../../../../stores/RelationshipStore";
import UserStore from "../../../../../../stores/UserStore";
import SearchAutocompleteStore from "../../../../SearchAutocompleteStore";
import SearchQueryStore from "../../../stores/SearchQueryStore";
import { SearchListItemTypes, SearchQueryTagTypes, USER_ESTIMATED_ITEM_SIZE } from "../../../../SearchConstants";
import { SearchPopoutModes, SearchTokenTypes } from "../../../../../../Constants";
import { useStateFromStores, statesWillNeverBeEqual } from "../../../../../../_bundle/Module589";
import { useFullscreenPlaceholderCount } from "../../../hooks/usePlaceholderStyles";
import SearchPlatformUtils from "../../../SearchPlatformUtils";
import SearchPlatformActionCreators from "../../../SearchPlatformActionCreators";
import Tracking from "../../../tracking/Tracking";
import UserUtils from "../../../../../../utils/UserUtils";
import { computeChannelName } from "../../../../../channel/useChannelName";
import { quoteChannelName } from "../../../../SearchUtils";
import { getSearchQueryUserIds, getSearchQueryChannelIds, toSearchListUserItem, toSearchListChannelItem, getSearchFilterHasIcon, getSearchFilterAuthorTypeIcon } from "./AutocompleteScreenUtils";
import { Token } from "../../../../../../lib/QueryTokenizer";
import { isValidUserAutocomplete, isValidChannelAutocomplete } from "../../../../tokens/SearchTokens";
import { useMessageTabCountsErrorText } from "../../../hooks/useSearchScreenError";
import ErrorScreen from "../../tabs/pages/ErrorScreen";
import { intl, t } from "../../../../../../intl/index.native";
import SearchList from "../../list/SearchList";
let c11085_16 = [];
const r42 = Module19.memo(function AutocompleteScreen(props) {
let r97;
let searchContext, stateFromStores, state, setState, fullscreenPlaceholderCount, callback, callback2, callback3, callback4;
L12: {
searchContext = props.searchContext;
stateFromStores = void 0;
state = void 0;
setState = void 0;
fullscreenPlaceholderCount = void 0;
callback = void 0;
callback2 = void 0;
callback3 = void 0;
callback4 = void 0;
stateFromStores = useStateFromStores([SearchAutocompleteStore], () => SearchAutocompleteStore.getState(searchContext), [searchContext], statesWillNeverBeEqual);
[state, setState] = useState(false);
const stateFromStores2 = useStateFromStores([SearchQueryStore], () => SearchQueryStore.isTextInputValueEmpty(searchContext), [searchContext]);
fullscreenPlaceholderCount = useFullscreenPlaceholderCount({
placeholderHeight: USER_ESTIMATED_ITEM_SIZE,
numColumns: 1
});
callback = useCallback(() => {
SearchPlatformUtils.syncAutocomplete(searchContext);
SearchPlatformUtils.fetchInitialMessages(searchContext);
}, [searchContext]);
callback2 = useCallback((text) => {
const prefixTag = SearchQueryStore.getPrefixTag(searchContext);
if (prefixTag != null) {
SearchPlatformActionCreators.updateSearchQuery(searchContext, (a0) => {
a0.setTextInputValue("");
a0.addTag({
type: SearchQueryTagTypes.ANSWER,
text
});
a0.restoreDraftTextInputValue();
});
Tracking.trackSearchFilterAdd({
searchContext,
searchTokenType: prefixTag.searchTokenType,
location: prefixTag.location
});
callback();
}
}, [callback, searchContext]);
callback3 = useCallback((a0) => {
const user = UserStore.getUser(a0);
if (user != null) {
const prefixTag = SearchQueryStore.getPrefixTag(searchContext);
if (prefixTag != null) {
SearchPlatformActionCreators.updateSearchQuery(searchContext, (a0) => {
a0.setTextInputValue("");
a0.addTag({
type: SearchQueryTagTypes.ANSWER,
text: UserUtils.getUserTag(user),
userId: user.id
});
a0.restoreDraftTextInputValue();
});
Tracking.trackSearchFilterAdd({
searchContext,
searchTokenType: prefixTag.searchTokenType,
location: prefixTag.location
});
callback();
}
}
}, [callback, searchContext]);
callback4 = useCallback((a0) => {
let userTag;
const channelId = a0;
const channel = ChannelStore.getChannel(a0);
if (channel != null) {
const prefixTag = SearchQueryStore.getPrefixTag(searchContext);
if (prefixTag != null) {
userTag = computeChannelName(channel, UserStore, RelationshipStore);
if (channel.isDM()) {
const user2 = UserStore.getUser(channel.getRecipientId());
if (user2 == null) {
return void 0;
}
userTag = UserUtils.getUserTag(user2);
}
SearchPlatformActionCreators.updateSearchQuery(searchContext, (a0) => {
a0.setTextInputValue("");
a0.addTag({
type: SearchQueryTagTypes.ANSWER,
text: quoteChannelName(userTag),
channelId
});
a0.restoreDraftTextInputValue();
});
Tracking.trackSearchFilterAdd({
searchContext,
searchTokenType: prefixTag.searchTokenType,
location: prefixTag.location
});
callback();
}
}
}, [callback, searchContext]);
useEffect(() => SearchPlatformUtils.subscribeSearchQueryState(searchContext, (a0) => {
const r1 = {
isAutocompleteVisible: a0.isAutocompleteVisible(),
textInputValue: a0.getTextInputValue(),
prefixTag: null
};
let prefixTag = a0.getPrefixTag();
if (prefixTag == null) {
prefixTag = null;
}
r1.prefixTag = prefixTag;
return r1;
}, (a0, a1) => {
const { textInputValue, prefixTag } = a0;
if (a0.isAutocompleteVisible && !(textInputValue === a1?.textInputValue && prefixTag === a1?.prefixTag)) {
setState(true);
}
}, true), [searchContext]);
useEffect(() => {
setState(false);
}, [stateFromStores.autocompletes]);
const memo = useMemo(() => {
const r6 = [];
let c28083_0 = r6;
if (state) {
let r101 = 0;
while (r101 < fullscreenPlaceholderCount) {
r6.push({
type: SearchListItemTypes.MESSAGE_PLACEHOLDER,
key: `message-placeholder-${r101}`
});
r101 = r101 + 1;
}
return r6;
}
const set = new Set(getSearchQueryUserIds(searchContext));
let c28083_1 = set;
let c28083_2 = new Set(getSearchQueryChannelIds(searchContext));
const { autocompletes, tokens, mode } = stateFromStores;
autocompletes.forEach((autocomplete) => {
if (mode.type === SearchPopoutModes.FILTER) {
const { results, group } = autocomplete;
if (results.length !== 0) {
results.forEach(({ user: user2, channel, text: text2 }) => {
const r20 = toSearchListUserItem(searchContext, user2, callback3);
const id = user2?.id;
if (!(r20 == null || id == null || c28083_1.has(id) || RelationshipStore.isBlockedOrIgnored(id))) {
c28083_1.add(id);
c28083_0.push(r20);
}
const r38 = toSearchListChannelItem(channel, callback4);
const id2 = channel?.id;
if (!(r38 == null || id2 == null || c28083_2.has(id2))) {
c28083_2.add(id2);
c28083_0.push(r38);
}
if (group === SearchTokenTypes.FILTER_HAS && text2 != null) {
c28083_0.push({
type: SearchListItemTypes.GENERIC,
props: {
text: text2,
icon: getSearchFilterHasIcon(text2),
onPress: callback2
}
});
}
if (group === SearchTokenTypes.FILTER_AUTHOR_TYPE && text2 != null) {
c28083_0.push({
type: SearchListItemTypes.GENERIC,
props: {
text: text2,
icon: getSearchFilterAuthorTypeIcon(text2),
onPress: callback2
}
});
}
});
}
}
});
if (r6.length === 0 && mode.type !== SearchPopoutModes.FILTER) {
const r50 = tokens[tokens.length - 1];
if (r50 != null) {
const token = new Token(r50);
if (!(token.type !== SearchTokenTypes.ANSWER_USERNAME_FROM && token.type !== SearchTokenTypes.ANSWER_USERNAME_MENTIONS) && isValidUserAutocomplete(token)) {
const data = token.getData("userId");
if (data != null) {
const user2 = UserStore.getUser(data);
const r77 = toSearchListUserItem(searchContext, user2, callback3);
const id = user2?.id;
if (!(r77 == null || id == null || set.has(id) || RelationshipStore.isBlockedOrIgnored(id))) {
set.add(id);
r6.push(r77);
}
}
}
if (token.type === SearchTokenTypes.ANSWER_IN && isValidChannelAutocomplete(token, searchContext)) {
const data2 = token.getData("channelIds");
if (data2 != null) {
data2.forEach((item) => {
const channel = ChannelStore.getChannel(item);
const r17 = toSearchListChannelItem(channel, callback4);
const id = channel?.id;
if (!(r17 == null || id == null || c28083_2.has(id))) {
c28083_2.add(id);
c28083_0.push(r17);
}
});
}
}
}
}
return r6.length > 0 ? r6 : c11085_16;
}, [state, searchContext, fullscreenPlaceholderCount, stateFromStores, callback3, callback4, callback2]);
const messageTabCountsErrorText = useMessageTabCountsErrorText({
searchContext
});
if (messageTabCountsErrorText != null) {
r97 = <ErrorScreen text={messageTabCountsErrorText} />;
} else {
if (stateFromStores2 && memo.length === 0) {
r97 = <ErrorScreen text={intl.string(t["E4HqQ+"])} />;
break L12;
}
if (!stateFromStores2 && memo.length === 0 && !state) {
r97 = <ErrorScreen text={intl.string(t.Dr1vko)} />;
break L12;
}
r97 = <SearchList data={memo} />;
}
}
return r97;
});
export default r42;
@@ -0,0 +1,146 @@
// Metro module 15560 (f15561).
import GuildMemberStore from "../../../../../../stores/GuildMemberStore";
import RelationshipStore from "../../../../../../stores/RelationshipStore";
import UserStore from "../../../../../../stores/UserStore";
import SearchQueryStore from "../../../stores/SearchQueryStore";
import { SearchListItemTypes } from "../../../../SearchConstants";
import { RelationshipTypes } from "../../../../../../Constants";
import { intl, t } from "../../../../../../intl/index.native";
import ForwardingIcon from "../../../../../forwarding/native/ForwardingIcon";
import { LinkIcon } from "../../../../../../design/components/Icon/native/redesign/generated/LinkIcon";
import { EmbedIcon } from "../../../../../../design/components/Icon/native/redesign/generated/EmbedIcon";
import { PollsIcon } from "../../../../../../design/components/Icon/native/redesign/generated/PollsIcon";
import { AttachmentIcon } from "../../../../../../design/components/Icon/native/redesign/generated/AttachmentIcon";
import { VideoIcon } from "../../../../../../design/components/Icon/native/redesign/generated/VideoIcon";
import { ImageIcon } from "../../../../../../design/components/Icon/native/redesign/generated/ImageIcon";
import { SoundboardIcon } from "../../../../../../design/components/Icon/native/redesign/generated/SoundboardIcon";
import { StickerIcon } from "../../../../../../design/components/Icon/native/redesign/generated/StickerIcon";
import { UserIcon } from "../../../../../../design/components/Icon/native/redesign/generated/UserIcon";
import { RobotIcon } from "../../../../../../design/components/Icon/native/redesign/generated/RobotIcon";
import { WebhookIcon } from "../../../../../../design/components/Icon/native/redesign/generated/WebhookIcon";
import { getGuildIdFromSearchContext } from "../../../../SearchUtils";
import UserUtils from "../../../../../../utils/UserUtils";
export function getSearchQueryChannelIds(a0) {
return new Set(SearchQueryStore.getChannelIds(a0));
}
export function getSearchQueryUserIds(a0) {
const prefixTag = SearchQueryStore.getPrefixTag(a0);
if (prefixTag == null) {
return new Set();
}
return new Set(SearchQueryStore.getUserIds(a0, prefixTag.searchTokenType));
}
export function getSearchFilterHasIcon(a0) {
if (intl.string(t.nrpA5E) === a0) {
return ForwardingIcon;
}
if (intl.string(t.ZNR2fi) === a0) {
return LinkIcon;
}
if (intl.string(t["20uQR3"]) === a0) {
return EmbedIcon;
}
if (intl.string(t.L4lxyE) === a0) {
return PollsIcon;
}
if (intl.string(t["AV/v6i"]) === a0) {
return AttachmentIcon;
}
if (intl.string(t.XM9XGP) === a0) {
return VideoIcon;
}
if (intl.string(t.TNLcpx) === a0) {
return ImageIcon;
}
if (intl.string(t.F8Wf0e) === a0) {
return SoundboardIcon;
}
if (intl.string(t.PJgX2h) === a0) {
return StickerIcon;
}
}
export function getSearchFilterAuthorTypeIcon(a0) {
if (intl.string(t.tPZo4p) === a0) {
return UserIcon;
}
if (intl.string(t.JL7sRS) === a0) {
return RobotIcon;
}
if (intl.string(t.WjkIKU) === a0) {
return WebhookIcon;
}
}
export function toSearchListUserItem(a0, a1, a2) {
let guildId = getGuildIdFromSearchContext(a0);
if (a1 == null) {
return null;
}
let nickname = guildId == null ? RelationshipStore.getNickname(a1.id) : null;
if (nickname == null) {
nickname = GuildMemberStore.getNick(guildId, a1.id);
}
if (nickname == null) {
nickname = UserUtils.getName(a1);
}
if (guildId == null) {
guildId = void 0;
}
return {
type: SearchListItemTypes.DM,
props: {
type: RelationshipTypes.NONE,
user: a1,
nickname,
onPress: a2,
guildId
}
};
}
export function toSearchListChannelItem(a0, a1) {
let r16;
if (a0 == null) {
return null;
}
if (a0.isDM()) {
const user = UserStore.getUser(a0.getRecipientId());
const r0 = user == null;
let r23 = null;
if (!r0) {
let nickname = RelationshipStore.getNickname(user.id);
if (nickname == null) {
nickname = UserUtils.getName(user);
}
r23 = {
type: SearchListItemTypes.DM,
props: {
type: RelationshipTypes.NONE,
user,
nickname,
onPress: () => a1(a0.id)
}
};
}
return r23;
}
const isGroupDM = a0.isGroupDM();
const r4 = {
type: null,
props: null
};
if (isGroupDM) {
r4.type = SearchListItemTypes.GROUP_DM;
r4.props = {
channel: a0,
onPress: a1
};
r16 = r4;
} else {
r4.type = SearchListItemTypes.GUILD_TEXT_CHANNEL;
r4.props = {
channel: a0,
onPress: a1
};
r16 = r4;
}
return r16;
}
@@ -0,0 +1,29 @@
// Metro module 15473 (f15474).
import * as Module19 from "react";
import { useMemo } from "react";
import { SearchFilterAddLocations } from "../../../tracking/TrackingConstants";
import { useValidOrderedFilterTokens } from "../../../../tokens/hooks/useValidFilterTokens";
import { getSearchTokenLabel, getSearchTokenIcon, getSearchTokenPressHandler } from "./SearchFilterUtils";
import MobileVisualRefreshExperiment from "../../../../../themes/experiments/MobileVisualRefreshExperiment";
import { ContextMenu } from "../../../../../../design/components/ContextMenu/native/ContextMenu.native";
import { intl, t } from "../../../../../../intl/index.native";
import { IconButton } from "../../../../../../design/components/Button/native/IconButton.native";
import { FiltersHorizontalIcon } from "../../../../../../design/components/Icon/native/redesign/generated/FiltersHorizontalIcon";
const r23 = Module19.memo(function({ searchContext }) {
let c22041_2;
c22041_2 = void 0;
const validOrderedFilterTokens = useValidOrderedFilterTokens(searchContext);
const memo = useMemo(() => validOrderedFilterTokens.map((validOrderedFilterToken) => ({
label: getSearchTokenLabel(searchContext, validOrderedFilterToken),
IconComponent: getSearchTokenIcon(validOrderedFilterToken),
action: getSearchTokenPressHandler(searchContext, validOrderedFilterToken, SearchFilterAddLocations.CONTEXT_MENU)
})), [searchContext, validOrderedFilterTokens]);
c22041_2 = MobileVisualRefreshExperiment("SearchFilterButton");
return <ContextMenu items={memo} align="below" title={intl.string(t.oYEmhB)} keyboardShouldPersistTaps="handled">
{(a0) => {
const { ref, ...rest } = a0;
return <IconButton ref={a0.ref} {...rest} variant="tertiary" accessibilityLabel={intl.string(t.kP6oFy)} size={c22041_2 ? "md" : "sm"} icon={<FiltersHorizontalIcon size="sm" color="redesign-button-tertiary-text" />} />;
}}
</ContextMenu>;
});
export default r23;
@@ -0,0 +1,190 @@
// Metro module 15466 (f15467).
import * as Module19 from "react";
import { useMemo, useCallback, useEffect, useState, useRef } from "react";
import { View } from "react-native";
import { SearchFilterAddLocations } from "../../../tracking/TrackingConstants";
import { createStyles } from "../../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../../_bundle/Module712";
import { getSearchTokenIcon, getSearchTokenSubLabel, getSearchFilterSuggestions, getSearchTokenPressHandler } from "./SearchFilterUtils";
import { TableRow } from "../../../../../../design/components/TableRow/native/TableRow.native";
import { Text } from "../../../../../../design/components/Text/native/Text";
import * as _ReanimatedRexport from "../../../../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useSharedValue, useAnimatedStyle, useAnimatedReaction } from "../../../../../reanimated/ReanimatedRexport";
import * as _spring from "../../../../../../design/animation/reanimated/spring/spring";
import * as _springPresets from "../../../../../../design/animation/reanimated/spring/springPresets";
import * as _TransitionGroup from "../../../../../../design/components/TransitionGroup/TransitionGroup";
import { TransitionGroup } from "../../../../../../design/components/TransitionGroup/TransitionGroup";
import { useValidFilterTokens } from "../../../../tokens/hooks/useValidFilterTokens";
import SearchPlatformUtils from "../../../SearchPlatformUtils";
function $mk96613() {
return (a0) => a0.text;
}
let useStyles, getSuggestionsKey, __initData, __initData2, AnimatedEnterExitContainer, EMPTY_SEARCH_FILTER_ROWS, __initData3, __initData4;
const SearchFilterPrefixRow = function SearchFilterPrefixRow(props) {
const { text, searchTokenType, onPress, ...props2 } = props;
const memo2 = useMemo(() => {
const SearchTokenIcon = getSearchTokenIcon(searchTokenType);
return SearchTokenIcon != null ? <SearchTokenIcon size="sm" /> : null;
}, [searchTokenType]);
const memo3 = useMemo(() => getSearchTokenSubLabel(searchTokenType), [searchTokenType]);
return <TableRow icon={memo2} onPress={useCallback(() => {
onPress(text);
}, [onPress, text])} label={<Text lineClamp={1} variant="text-md/semibold" color="mobile-text-heading-primary">{text}</Text>} subLabel={memo3} {...props2} />;
};
getSuggestionsKey = function getSuggestionsKey(a0) {
return a0.map($mk96613()).join(" ");
};
AnimatedEnterExitContainer = function AnimatedEnterExitContainer(props) {
const { children, state, cleanUp } = props;
const sharedValue = useSharedValue(0);
const l = () => {
const r10 = sharedValue.get();
const t = function t(a0) {
if (a0 ? state === _TransitionGroup.TransitionStates.YEETED : a0) {
_ReanimatedRexport.runOnJS(cleanUp)();
}
};
t.__closure = {
state,
TransitionStates: _TransitionGroup.TransitionStates,
runOnJS: _ReanimatedRexport.runOnJS,
cleanUp
};
t.__workletHash = 10696166249954;
t.__initData = __initData2;
return {
opacity: _spring.withSpring(r10, _springPresets.springStandard, "respect-motion-settings", t),
transform: [{
translateY: _spring.withSpring(sharedValue.get() === 1 ? 0 : -15, _springPresets.springStandard)
}]
};
};
l.__closure = {
withSpring: _spring.withSpring,
opacity: sharedValue,
springStandard: _springPresets.springStandard,
state,
TransitionStates: _TransitionGroup.TransitionStates,
runOnJS: _ReanimatedRexport.runOnJS,
cleanUp
};
l.__workletHash = 334512108462;
l.__initData = __initData;
const animatedStyle = useAnimatedStyle(l);
useEffect(() => {
sharedValue.set(state === _TransitionGroup.TransitionStates.YEETED ? 0 : 1);
}, [sharedValue, state]);
return <ReanimatedRexport.View style={animatedStyle}>{children}</ReanimatedRexport.View>;
};
useStyles = createStyles({
card: {
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGHEST,
borderRadius: Module712.radii.lg,
borderColor: Module712.colors.BORDER_SUBTLE,
borderWidth: 1,
...Module712.shadows.SHADOW_LOW
}
});
__initData = {
code: "function SearchFilterSuggestionsTsx1(){const{withSpring,opacity,springStandard,state,TransitionStates,runOnJS,cleanUp}=this.__closure;return{opacity:withSpring(opacity.get(),springStandard,'respect-motion-settings',function(finished){if(finished&&state===TransitionStates.YEETED){runOnJS(cleanUp)();}}),transform:[{translateY:withSpring(opacity.get()===1?0:-15,springStandard)}]};}"
};
__initData2 = {
code: "function SearchFilterSuggestionsTsx2(finished){const{state,TransitionStates,runOnJS,cleanUp}=this.__closure;if(finished&&state===TransitionStates.YEETED){runOnJS(cleanUp)();}}"
};
EMPTY_SEARCH_FILTER_ROWS = [];
__initData3 = {
code: "function SearchFilterSuggestionsTsx3(){const{dismissed}=this.__closure;return dismissed.get();}"
};
__initData4 = {
code: "function SearchFilterSuggestionsTsx4(isDismissed){const{runOnJS,setSuggestions,EMPTY_SEARCH_FILTER_ROWS}=this.__closure;if(isDismissed){runOnJS(setSuggestions)(EMPTY_SEARCH_FILTER_ROWS);}}"
};
const r61 = Module19.memo(function SearchFilterSuggestions(props) {
let memo, ref, callback;
const { searchContext, onLayoutMeasure, containerStyle, dismissed } = props;
memo = void 0;
ref = void 0;
callback = void 0;
const styles = useStyles();
const validFilterTokens = useValidFilterTokens(searchContext);
const [state2, setState] = useState([]);
useEffect(() => SearchPlatformUtils.subscribeSearchQueryState(searchContext, (a0) => ({
textInputValue: a0.getTextInputValue(),
isAutocompleteVisible: a0.isAutocompleteVisible()
}), (a0) => {
L6: {
const { textInputValue, isAutocompleteVisible } = a0;
if (textInputValue.trim() !== "" && !isAutocompleteVisible) {
let c30878_1;
const searchFilterSuggestions = getSearchFilterSuggestions(textInputValue);
if (searchFilterSuggestions.length !== 0) {
c30878_1 = [];
searchFilterSuggestions.forEach(({ text: text2, token }, index) => {
if (validFilterTokens.has(token)) {
c30878_1.push({
text: text2,
searchTokenType: token,
start: index === 0,
end: index === searchFilterSuggestions.length - 1,
onPress: getSearchTokenPressHandler(searchContext, token, SearchFilterAddLocations.SEARCH_INPUT_DROPDOWN)
});
}
});
setState((prevState) => {
const r4 = prevState.map($mk96613()).join(" ");
let r10 = c30878_1;
if (r4 === r10.map($mk96613()).join(" ")) {
r10 = prevState;
}
return r10;
});
break L6;
}
setState(EMPTY_SEARCH_FILTER_ROWS);
} else {
setState(EMPTY_SEARCH_FILTER_ROWS);
}
}
}), [validFilterTokens, searchContext, setState]);
const b = () => dismissed.get();
b.__closure = {
dismissed
};
b.__workletHash = 17191989548971;
b.__initData = __initData3;
const E = function E(a0) {
if (a0) {
_ReanimatedRexport.runOnJS(setState)(EMPTY_SEARCH_FILTER_ROWS);
}
};
E.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
setSuggestions: setState,
EMPTY_SEARCH_FILTER_ROWS
};
E.__workletHash = 8991360021943;
E.__initData = __initData4;
useAnimatedReaction(b, E);
memo = useMemo(() => [styles.card, containerStyle], [containerStyle, styles.card]);
ref = useRef(null);
callback = useCallback(() => {
setTimeout(() => {
const current = ref.current;
if (current != null) {
current.measure((a0, a1, a2, a3, a4, a5) => {
onLayoutMeasure({
top: a5,
bottom: a5 + a3,
left: a4,
right: a4 + a2
});
});
}
});
}, [onLayoutMeasure]);
return <TransitionGroup items={useMemo(() => state2.length > 0 ? [state2] : [], [state2])} renderItem={useCallback((a0, a1, a2, a3) => <AnimatedEnterExitContainer key={a0} state={a2} cleanUp={a3}>
<View ref={ref} style={memo} collapsable={false} onLayout={callback}>
{a1.map((item) => <SearchFilterPrefixRow key={item.text} {...item} />)}
</View>
</AnimatedEnterExitContainer>, [memo, callback])} getItemKey={getSuggestionsKey} />;
});
export default r61;
@@ -0,0 +1,189 @@
// Metro module 15467 (f15468).
import { EMPTY_SEARCH_QUERY_STRING, SearchQueryTagTypes } from "../../../../SearchConstants";
import { SearchFilterAddLocations } from "../../../tracking/TrackingConstants";
import { SEARCH_DATE_FORMAT, SearchTokenTypes, SearchTypes } from "../../../../../../Constants";
import { intl, t } from "../../../../../../intl/index.native";
import { UserIcon } from "../../../../../../design/components/Icon/native/redesign/generated/UserIcon";
import { AttachmentIcon } from "../../../../../../design/components/Icon/native/redesign/generated/AttachmentIcon";
import { ChannelListMagnifyingGlassIcon } from "../../../../../../design/components/Icon/native/redesign/generated/ChannelListMagnifyingGlassIcon";
import { AtIcon } from "../../../../../../design/components/Icon/native/redesign/generated/AtIcon";
import { CalendarIcon } from "../../../../../../design/components/Icon/native/redesign/generated/CalendarIcon";
import { CalendarMinusIcon } from "../../../../../../design/components/Icon/native/redesign/generated/CalendarMinusIcon";
import { CalendarPlusIcon } from "../../../../../../design/components/Icon/native/redesign/generated/CalendarPlusIcon";
import { RobotIcon } from "../../../../../../design/components/Icon/native/redesign/generated/RobotIcon";
import SearchTokens, { rebuildSearchTokenConfigs, isSearchFilterTokenType } from "../../../../tokens/SearchTokens";
import SearchPlatformActionCreators from "../../../SearchPlatformActionCreators";
import SearchPlatformUtils, { performKeyboardAwareNavigation } from "../../../SearchPlatformUtils";
import ActionSheetActionCreators from "../../../../../action_sheet/native/ActionSheetActionCreators";
import Tracking from "../../../tracking/Tracking";
export function getSearchTokenLabel(a0, a1) {
if (SearchTokenTypes.FILTER_FROM === a1) {
return intl.string(t["6iuVMn"]);
}
if (SearchTokenTypes.FILTER_HAS === a1) {
return intl.string(t.DMAzx8);
}
if (SearchTokenTypes.FILTER_MENTIONS === a1) {
return intl.string(t.CMKzQx);
}
if (SearchTokenTypes.FILTER_IN === a1) {
return a0.type === SearchTypes.DMS ? intl.string(t["8Fmo42"]) : intl.string(t.cdPmq8);
}
if (SearchTokenTypes.FILTER_ON === a1) {
return intl.string(t.h4qGfp);
}
if (SearchTokenTypes.FILTER_BEFORE === a1) {
return intl.string(t.c9qSBR);
}
if (SearchTokenTypes.FILTER_AFTER === a1) {
return intl.string(t.hcMwDW);
}
if (SearchTokenTypes.FILTER_AUTHOR_TYPE === a1) {
return intl.string(t.C4r6xL);
}
throw new Error(`[getSearchTokenLabel] Unhandled search token type: ${a1}`);
}
export function getSearchTokenSubLabel(a0) {
if (SearchTokenTypes.FILTER_FROM === a0) {
return intl.string(t.kkGlww);
}
if (SearchTokenTypes.FILTER_HAS === a0) {
return intl.string(t.gUfZa2);
}
if (SearchTokenTypes.FILTER_IN === a0) {
return intl.string(t.qDUdlT);
}
if (SearchTokenTypes.FILTER_MENTIONS === a0) {
return intl.string(t.ILtwK5);
}
if (SearchTokenTypes.FILTER_ON === a0) {
return intl.string(t.t8bWvr);
}
if (SearchTokenTypes.FILTER_BEFORE === a0) {
return intl.string(t.YEN3uU);
}
if (SearchTokenTypes.FILTER_AFTER === a0) {
return intl.string(t.hwbB7s);
}
if (SearchTokenTypes.FILTER_AUTHOR_TYPE === a0) {
return intl.string(t.tJPdhZ);
}
throw new Error(`[getSearchTokenSubLabel] Unhandled search token type: ${a0}`);
}
export function getSearchTokenIcon(a0) {
if (SearchTokenTypes.FILTER_FROM === a0) {
return UserIcon;
}
if (SearchTokenTypes.FILTER_HAS === a0) {
return AttachmentIcon;
}
if (SearchTokenTypes.FILTER_IN === a0) {
return ChannelListMagnifyingGlassIcon;
}
if (SearchTokenTypes.FILTER_MENTIONS === a0) {
return AtIcon;
}
if (SearchTokenTypes.FILTER_ON === a0) {
return CalendarIcon;
}
if (SearchTokenTypes.FILTER_BEFORE === a0) {
return CalendarMinusIcon;
}
if (SearchTokenTypes.FILTER_AFTER === a0) {
return CalendarPlusIcon;
}
if (SearchTokenTypes.FILTER_AUTHOR_TYPE === a0) {
return RobotIcon;
}
throw new Error(`[getSearchTokenIcon] Unhandled search token type: ${a0}`);
}
export function getSearchTokenPressHandler(c22037_0, a1, c22037_2) {
if (SearchTokenTypes.FILTER_FROM !== a1 && SearchTokenTypes.FILTER_IN !== a1 && SearchTokenTypes.FILTER_HAS !== a1 && SearchTokenTypes.FILTER_MENTIONS !== a1 && SearchTokenTypes.FILTER_AUTHOR_TYPE !== a1) {
if (SearchTokenTypes.FILTER_ON !== a1 && SearchTokenTypes.FILTER_BEFORE !== a1 && SearchTokenTypes.FILTER_AFTER !== a1) {
throw new Error(`[getSearchTokenPressHandler] Unhandled search token type: ${a1}`);
}
return () => {
const searchContext = c22037_0;
const searchTokenType2 = a1;
const location3 = c22037_2;
performKeyboardAwareNavigation(() => {
ActionSheetActionCreators.openLazy(import("../../../../../../components_native/DatePickerActionSheet"), "DatePicker", {
onSubmit: (a0) => {
let c32070_0 = a0.format(SEARCH_DATE_FORMAT);
SearchPlatformActionCreators.updateSearchQuery(searchContext, (a0) => {
if (location3 === SearchFilterAddLocations.SEARCH_INPUT_DROPDOWN) {
a0.setTextInputValue(EMPTY_SEARCH_QUERY_STRING);
}
a0.removePrefixTags();
const addTag = a0.addTag;
let r24 = SearchTokens[searchTokenType2];
if (r24 == null) {
rebuildSearchTokenConfigs();
r24 = SearchTokens[searchTokenType2];
}
let r31 = r24?.key;
if (r31 == null) {
r31 = searchTokenType2.toString();
}
addTag.call(a0, {
type: SearchQueryTagTypes.COMPLETE,
text: `${r31} ${c32070_0}`,
searchTokenType: searchTokenType2,
location: location3
});
});
Tracking.trackSearchFilterAdd({
searchContext,
searchTokenType: searchTokenType2,
location: location3
});
SearchPlatformUtils.fetchInitialMessages(searchContext);
}
});
});
};
}
return () => {
const searchTokenType = a1;
const location2 = c22037_2;
SearchPlatformActionCreators.updateSearchQuery(c22037_0, (a0) => {
if (location2 === SearchFilterAddLocations.CONTEXT_MENU) {
a0.saveDraftTextInputValue();
}
a0.setTextInputValue(EMPTY_SEARCH_QUERY_STRING);
const addTag = a0.addTag;
let r24 = SearchTokens[searchTokenType];
if (r24 == null) {
rebuildSearchTokenConfigs();
r24 = SearchTokens[searchTokenType];
}
let text = r24?.key;
if (text == null) {
text = searchTokenType.toString();
}
addTag.call(a0, {
type: SearchQueryTagTypes.PREFIX,
searchTokenType,
location: location2,
text
});
});
SearchPlatformUtils.syncAutocomplete(c22037_0);
};
}
export function getSearchFilterSuggestions(c22038_0) {
const r7 = [];
let c22038_1 = r7;
Object.keys(SearchTokens).forEach((item) => {
if (isSearchFilterTokenType(item)) {
const plainText = SearchTokens[item].plainText;
if (plainText != null && new RegExp(`^${plainText}(?:: ?)?\$`, "i").test(c22038_0)) {
c22038_1.push({
token: item,
text: plainText
});
}
}
});
return r7;
}
@@ -0,0 +1,71 @@
// Metro module 15461 (f15462).
import { useCallback, useEffect, useMemo } from "react";
import { useSharedValue } from "../../../../../reanimated/ReanimatedRexport";
import SearchPlatformUtils from "../../../SearchPlatformUtils";
import useSafeAreaInsets_native from "../../../../../safe_area/useSafeAreaInsets.native";
import { isAndroid } from "../../../../../../utils/PlatformUtils";
import { Gesture } from "../../../../../../_bundle/Module5273";
let inBoundingBox, __initData;
const inBoundingBox2 = function inBoundingBox(a0, a1, a2) {
const r4 = a0.allTouches[0];
return r4 != null && (a1.left < r4.absoluteX && r4.absoluteX < a1.right && a1.top < r4.absoluteY + a2 && r4.absoluteY + a2 < a1.bottom);
};
inBoundingBox2.__closure = {};
inBoundingBox2.__workletHash = 14606221606756;
inBoundingBox2.__initData = {
code: "function inBoundingBox_useSearchSuggestionsGestureTsx1(e,coordinates,safeAreaTop){const touch=e.allTouches[0];if(touch==null)return false;return coordinates.left<touch.absoluteX&&touch.absoluteX<coordinates.right&&coordinates.top<touch.absoluteY+safeAreaTop&&touch.absoluteY+safeAreaTop<coordinates.bottom;}"
};
inBoundingBox = inBoundingBox2;
__initData = {
code: "function useSearchSuggestionsGestureTsx2(e,manager){const{coordinates,inBoundingBox,safeAreaTop,dismissed}=this.__closure;manager.fail();const _coordinates=coordinates.get();if(_coordinates==null||inBoundingBox(e,_coordinates,safeAreaTop))return;dismissed.set(true);}"
};
export function useSearchSuggestionsGesture(a0) {
let top, memo, callback2, callback3;
let c22029_0 = a0;
const sharedValue = useSharedValue(false);
const sharedValue2 = useSharedValue(null);
const callback = useCallback((a0, a1) => {
if (a0 !== a1) {
sharedValue.set(false);
}
}, [sharedValue]);
useEffect(() => SearchPlatformUtils.subscribeTextInputValue(c22029_0, callback), [sharedValue, a0, callback]);
const top2 = useSafeAreaInsets_native().top;
top = isAndroid() ? top2 : 0;
memo = useMemo(() => {
const r4 = Gesture.Manual().manualActivation(true);
const e = function e(a0, a1) {
a1.fail();
const r14 = sharedValue2.get();
let r1 = r14 == null;
if (!r1) {
const r20 = a0.allTouches[0];
r1 = r20 != null && (r14.left < r20.absoluteX && r20.absoluteX < r14.right && r14.top < r20.absoluteY + top && r20.absoluteY + top < r14.bottom);
}
if (!r1) {
sharedValue.set(true);
}
};
e.__closure = {
coordinates: sharedValue2,
inBoundingBox,
safeAreaTop: top,
dismissed: sharedValue
};
e.__workletHash = 2369649298113;
e.__initData = __initData;
return r4.onTouchesDown(e);
}, [sharedValue2, top, sharedValue]);
callback2 = useCallback((a0) => {
sharedValue2.set(a0);
}, [sharedValue2]);
callback3 = useCallback(() => {
sharedValue.set(true);
}, [sharedValue]);
return useMemo(() => ({
gesture: memo,
dismissed: sharedValue,
onLayoutMeasure: callback2,
setDismissed: callback3
}), [sharedValue, callback3, memo, callback2]);
}
@@ -0,0 +1,184 @@
// Metro module 15488 (f15489).
import { memo, useRef } from "react";
import { StyleSheet, View } from "react-native";
import { SearchHistoryItemTypes, SearchListItemTypes } from "../../../SearchConstants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import DMRow from "./rows/DMRow";
import GroupDMRow from "./rows/GroupDMRow";
import SearchHistoryRow from "./rows/SearchHistoryRow";
import MediaGridItem from "./rows/MediaGridItem";
import MediaGridPlaceholder from "../tabs/pages/placeholders/MediaGridPlaceholder";
import FileOrLinkGridPlaceholder from "../tabs/pages/placeholders/FileOrLinkGridPlaceholder";
import MediaGrid from "./rows/MediaGrid";
import GuildTextChannelRow from "./rows/GuildTextChannelRow";
import GuildVoiceOrStageChannelRow from "./rows/GuildVoiceOrStageChannelRow";
import MessageRow from "./rows/MessageRow";
import FormRowPlaceholder from "../tabs/pages/placeholders/FormRowPlaceholder";
import LinkGridItem from "./rows/LinkGridItem";
import FileGridItem from "./rows/FileGridItem";
import GuildChannelMemberRow from "./rows/GuildChannelMemberRow";
import MemberRowPlaceholder from "../tabs/pages/placeholders/MemberRowPlaceholder";
import GenericTextRow from "./rows/GenericTextRow";
import SearchListSection from "./SearchListSection";
import useSafeAreaInsets_native from "../../../../safe_area/useSafeAreaInsets.native";
import ErrorScreen from "../tabs/pages/ErrorScreen";
import { intl, t } from "../../../../../intl/index.native";
import { AnimatedFlashList } from "../../../../../_bundle/noop_6676";
let useStyles, getItemType, renderItem;
const keyExtractor = function keyExtractor(a0) {
let r33, r115, type;
L40: {
type = a0.type;
const type2 = a0.type;
if (SearchListItemTypes.DM === type2) {
r33 = `${a0.section}-${a0.props.user.id}-${a0.props.guildId}`;
} else if (SearchListItemTypes.GUILD_CHANNEL_MEMBER === type2) {
r33 = `${a0.props.user.id}-${a0.props.guildId}`;
} else if (SearchListItemTypes.SEARCH_HISTORY_ITEM === type2) {
L37: {
const searchHistoryItem = a0.props.searchHistoryItem;
const type3 = searchHistoryItem.type;
if (SearchHistoryItemTypes.TEXT === type3) {
const { text, tags } = searchHistoryItem;
r115 = `${text} ${tags == null ? void 0 : tags.map((tag) => tag.text).join(" ")}`;
} else {
if (SearchHistoryItemTypes.GROUP_DM !== type3 && SearchHistoryItemTypes.GUILD_TEXT_CHANNEL !== type3 && SearchHistoryItemTypes.GUILD_VOICE_CHANNEL !== type3) {
const DM = SearchHistoryItemTypes.DM;
r115 = void 0;
if (DM !== type3) {
break L37;
}
r115 = `${searchHistoryItem.userId}`;
break L37;
}
r115 = `${searchHistoryItem.channelId}`;
}
}
r33 = r115;
} else if (SearchListItemTypes.MEDIA_GRID === type2) {
r33 = a0.props.media.map((item) => `${item.messageId}-${item.mediaIndex}`).join("-");
} else if (SearchListItemTypes.MEDIA === type2) {
r33 = `${a0.props.media.messageId}-${a0.props.media.mediaIndex}`;
} else {
if (SearchListItemTypes.MEDIA_PLACEHOLDER !== type2 && SearchListItemTypes.FILE_OR_LINK_PLACEHOLDER !== type2 && SearchListItemTypes.MESSAGE_PLACEHOLDER !== type2 && SearchListItemTypes.GUILD_CHANNEL_MEMBER_PLACEHOLDER !== type2) {
if (SearchListItemTypes.GROUP_DM === type2) {
r33 = `${a0.section}-${a0.props.channel.id}`;
break L40;
}
if (SearchListItemTypes.GUILD_TEXT_CHANNEL !== type2 && SearchListItemTypes.GUILD_VOICE_CHANNEL !== type2) {
if (SearchListItemTypes.MESSAGE === type2) {
r33 = `${a0.props.message.id}`;
break L40;
}
if (SearchListItemTypes.LINK === type2) {
r33 = `${a0.props.data.messageId}-${a0.props.data.linkIndex}`;
break L40;
}
if (SearchListItemTypes.FILE === type2) {
r33 = `${a0.props.data.messageId}-${a0.props.data.fileIndex}`;
break L40;
}
if (SearchListItemTypes.GENERIC === type2) {
r33 = `${a0.props.text}`;
break L40;
}
const SECTION = SearchListItemTypes.SECTION;
r33 = void 0;
if (SECTION !== type2) {
break L40;
}
r33 = `${a0.props.title}`;
break L40;
}
r33 = `${a0.props.channel.id}`;
break L40;
}
r33 = a0.key;
}
}
return `${type}-${r33}`;
};
getItemType = function getItemType(a0) {
return a0.type;
};
renderItem = function renderItem({ item }) {
const type = item.type;
if (SearchListItemTypes.DM === type) {
return <DMRow {...item.props} />;
}
if (SearchListItemTypes.GROUP_DM === type) {
return <GroupDMRow {...item.props} />;
}
if (SearchListItemTypes.SEARCH_HISTORY_ITEM === type) {
return <SearchHistoryRow {...item.props} />;
}
if (SearchListItemTypes.MEDIA === type) {
return <MediaGridItem {...item.props} />;
}
if (SearchListItemTypes.MEDIA_PLACEHOLDER === type) {
return <MediaGridPlaceholder {...item.props} />;
}
if (SearchListItemTypes.FILE_OR_LINK_PLACEHOLDER === type) {
return <FileOrLinkGridPlaceholder {...item.props} />;
}
if (SearchListItemTypes.MEDIA_GRID === type) {
return <MediaGrid {...item.props} />;
}
if (SearchListItemTypes.GUILD_TEXT_CHANNEL === type) {
return <GuildTextChannelRow {...item.props} />;
}
if (SearchListItemTypes.GUILD_VOICE_CHANNEL === type) {
return <GuildVoiceOrStageChannelRow {...item.props} />;
}
if (SearchListItemTypes.MESSAGE === type) {
return <MessageRow {...item.props} />;
}
if (SearchListItemTypes.MESSAGE_PLACEHOLDER === type) {
return <FormRowPlaceholder />;
}
if (SearchListItemTypes.LINK === type) {
return <LinkGridItem {...item.props} />;
}
if (SearchListItemTypes.FILE === type) {
return <FileGridItem {...item.props} />;
}
if (SearchListItemTypes.GUILD_CHANNEL_MEMBER === type) {
return <GuildChannelMemberRow {...item.props} />;
}
if (SearchListItemTypes.GUILD_CHANNEL_MEMBER_PLACEHOLDER === type) {
return <MemberRowPlaceholder />;
}
if (SearchListItemTypes.GENERIC === type) {
return <GenericTextRow {...item.props} />;
}
if (SearchListItemTypes.SECTION === type) {
return <SearchListSection {...item.props} />;
}
return null;
};
useStyles = createStyles({
container: {
flex: 1
}
});
const r38 = memo(function SearchList(props) {
const { contentContainerStyle, data, onEndReached, ItemSeparatorComponent, ListHeaderComponent, ListFooterComponent, numColumns } = props;
const ref = useRef(null);
const styles = useStyles();
const bottom = useSafeAreaInsets_native().bottom;
const onEndReachedThreshold = numColumns == null ? 0.5 : numColumns !== 1 ? numColumns !== 2 ? numColumns >= 3 ? 0.99 : void 0 : 0.8 : 0.5;
const r42 = data.length === 0 && ListFooterComponent == null && ListHeaderComponent == null;
return <View style={styles.container}>
{r42 && <View style={StyleSheet.absoluteFill}>
<ErrorScreen text={intl.string(t.V6nAfF)} />
</View>}
<AnimatedFlashList ref={ref} overrideProps={r42 ? {
importantForAccessibility: "no",
scrollEnabled: false
} : void 0} keyboardDismissMode="on-drag" keyboardShouldPersistTaps="handled" data={data} renderItem={renderItem} onEndReachedThreshold={onEndReachedThreshold} onEndReached={onEndReached} scrollsToTop contentContainerStyle={{
paddingBottom: 16 + bottom,
...contentContainerStyle
}} keyExtractor={keyExtractor} getItemType={getItemType} ListHeaderComponent={ListHeaderComponent} ListFooterComponent={ListFooterComponent} ItemSeparatorComponent={ItemSeparatorComponent} numColumns={numColumns} />
</View>;
});
export default r38;
@@ -0,0 +1,158 @@
// Metro module 15505 (f15506).
import { useMemo } from "react";
import { View } from "react-native";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { Avatar, AvatarSizes, Icon } from "../../../../../design/void/native";
import { Text } from "../../../../../design/components/Text/native/Text";
import UserUtils from "../../../../../utils/UserUtils";
import useChannelName from "../../../../channel/useChannelName";
import GroupDMAvatar from "../../../../group_dm/native/GroupDMAvatar";
import { ForumIcon } from "../../../../../design/components/Icon/native/redesign/generated/ForumIcon";
import { intl, t } from "../../../../../intl/index.native";
import { getChannelIcon } from "../../../../../utils/native/ChannelUtils";
import { Card } from "../../../../../design/components/Card/native/Card.native";
let useStyles, SearchListPrivateChannel, SearchListGuildChannel;
const SearchListContentAuthor = function SearchListContentAuthor(props) {
const { author, avatarSource } = props;
const styles = useStyles();
return <View style={styles.author}>
<Avatar source={avatarSource} size={AvatarSizes.SIZE_16} style={styles.avatar} avatarDecoration={author.avatarDecoration} />
<Text style={styles.authorName} variant="text-xs/medium" color="interactive-text-default" lineClamp={1}>
{UserUtils.getName(author)}
</Text>
</View>;
};
SearchListPrivateChannel = function SearchListPrivateChannel(props) {
let r40;
const channel2 = props.channel;
const styles = useStyles();
const channelName = useChannelName(channel2);
const isGroupDM = channel2.isGroupDM();
const props2 = {
style: null,
children: null
};
if (isGroupDM) {
props2.style = styles.channel;
props2.children = [<View style={styles.gdmIcon}>
<GroupDMAvatar channel={channel2} size={AvatarSizes.SIZE_16} />
</View>, <Text style={styles.channelName} variant="text-xs/medium" color="interactive-text-default" lineClamp={1}>{channelName}</Text>];
r40 = <View {...props2} />;
} else {
props2.style = styles.privateChannelIcon;
props2.children = [<ForumIcon style={styles.icon} size="xs" color="interactive-text-default" />, <Text variant="text-xs/medium" color="interactive-text-default" lineClamp={1}>
{intl.string(t.ACgJhM)}
</Text>];
r40 = <View {...props2} />;
}
return r40;
};
SearchListGuildChannel = function SearchListGuildChannel(props) {
const channel2 = props.channel;
const styles = useStyles();
const channelName = useChannelName(channel2);
return <View style={styles.channel}>
<Icon size={Icon.Sizes.REFRESH_SMALL_16} source={getChannelIcon(channel2, {
ignoreTraits: true
})} color={styles.channelIcon.color} />
<Text style={styles.channelName} variant="text-xs/medium" color="interactive-text-default" lineClamp={1}>{channelName}</Text>
</View>;
};
useStyles = createStyles({
channelName: {
flexShrink: 1,
marginStart: 4
},
channelIcon: {
color: Module712.colors.INTERACTIVE_TEXT_DEFAULT
},
avatar: {
marginRight: 2
},
channel: {
flexDirection: "row",
alignItems: "center"
},
author: {
flexDirection: "row",
alignItems: "center"
},
authorName: {
flexShrink: 1,
marginStart: 2
},
container: {
flex: 1,
padding: 0,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
overflow: "hidden"
},
content: {
paddingTop: 12,
paddingHorizontal: 12,
paddingBottom: 4
},
footer: {
flexDirection: "column",
paddingTop: 4,
paddingHorizontal: 12,
paddingBottom: 12,
gap: 4
},
thumbnail: {
flex: 1,
overflow: "hidden",
borderTopRightRadius: Module712.radii.lg,
borderTopLeftRadius: Module712.radii.lg,
backgroundColor: Module712.colors.BACKGROUND_MOD_SUBTLE,
borderBottomWidth: 1,
borderBottomColor: Module712.colors.BORDER_SUBTLE
},
privateChannelIcon: {
flexDirection: "row",
alignItems: "center"
},
icon: {
marginRight: 4
},
gdmIcon: {
width: 18
}
});
export { SearchListContentAuthor };
export { SearchListGuildChannel };
export function SearchListCardContainer(props) {
const { children, onPress, containerStyle } = props;
return <Card shadow="low" border="subtle" onPress={onPress} style={[useStyles().container, containerStyle]}>{children}</Card>;
}
export function SearchListCardThumbnail(props) {
const thumbnail = props.thumbnail;
return <View style={useStyles().thumbnail}>{thumbnail}</View>;
}
export function SearchListCardContent(props) {
const { label, subLabel } = props;
const props2 = {
style: useStyles().content,
children: null
};
let r5 = label;
if (typeof r5 === "string") {
r5 = <Text variant="text-md/semibold" color="mobile-text-heading-primary" lineClamp={1}>{label}</Text>;
}
const children = [r5, ,];
let r20 = subLabel;
if (typeof r20 === "string") {
r20 = <Text variant="text-sm/normal" color="text-default" lineClamp={1}>{subLabel}</Text>;
}
children[1] = r20;
props2.children = children;
return <View {...props2} />;
}
export function SearchListCardFooter(props) {
const { author, avatarSource, channel } = props;
return <View style={useStyles().footer}>
<SearchListContentAuthor author={author} avatarSource={avatarSource} />
{useMemo(() => channel == null ? null : channel.getGuildId() == null ? <SearchListPrivateChannel channel={channel} /> : <SearchListGuildChannel channel={channel} />, [channel])}
</View>;
}
@@ -0,0 +1,58 @@
// Metro module 15490 (f15491).
import { memo } from "react";
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 { PressableHighlight } from "../../../../../design/void/Pressables/native/Pressables";
import { Text } from "../../../../../design/components/Text/native/Text";
const useStyles = createStyles((a0) => ({
pressable: {
paddingHorizontal: 16,
paddingVertical: SEARCH_ROW_TAP_STATE_PADDING
},
body: {
flexDirection: "row",
alignItems: "center"
},
labels: {
justifyContent: "center",
flex: 1
},
underlayColor: {
backgroundColor: Module712.colors.INTERACTIVE_BACKGROUND_ACTIVE
},
text: {
flexShrink: 1
},
iconContainer: {
marginRight: 12
},
extrasContainer: {
marginLeft: a0
}
}));
const r32 = memo(function(a0) {
const { containerStyle, onPress, label, subLabel, icon, iconContainerStyle } = a0;
let iconWidth = a0.iconWidth;
const { trailing, extras, header, accessible = true, accessibilityRole = "button", accessibilityLabel, accessibilityHint, accessibilityActions, onAccessibilityAction, bodyStyle } = a0;
if (iconWidth == null) {
iconWidth = 0;
}
const styles = useStyles(iconWidth);
const r35 = [header, , ,];
const r45 = [<View style={[styles.iconContainer, iconContainerStyle]}>{icon}</View>, , ,];
let r48 = label;
if (typeof r48 === "string") {
r48 = <Text lineClamp={1} variant="text-md/semibold" color="mobile-text-heading-primary" style={styles.text}>{label}</Text>;
}
r45[1] = <View style={styles.labels}>
{r48}
{subLabel}
</View>;
r45[2] = trailing;
r35[1] = <View style={[styles.body, bodyStyle]}>{r45}</View>;
r35[2] = extras != null && <View style={[styles.extrasContainer]}>{extras}</View>;
return <PressableHighlight accessible={accessible} accessibilityRole={accessibilityRole} accessibilityLabel={accessibilityLabel} accessibilityHint={accessibilityHint} accessibilityActions={accessibilityActions} onAccessibilityAction={onAccessibilityAction} style={[styles.pressable, containerStyle]} onPress={onPress} unstable_pressDelay={130} underlayColor={styles.underlayColor.backgroundColor}>{r35}</PressableHighlight>;
});
export { r32 as SearchListRow };
@@ -0,0 +1,26 @@
// Metro module 15519 (f15520).
import { memo } from "react";
import { View } from "react-native";
import { SEARCH_LIST_SECTION_TOP_PADDING } from "../../../SearchConstants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import { Text } from "../../../../../design/components/Text/native/Text";
const useStyles = createStyles({
section: {
flex: 1,
display: "flex",
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
textTransform: "none",
paddingTop: SEARCH_LIST_SECTION_TOP_PADDING,
paddingHorizontal: 16,
paddingBottom: 8
}
});
const r32 = memo(function({ title, trailing }) {
return <View style={useStyles().section}>
<Text maxFontSizeMultiplier={2} accessibilityRole="header" variant="text-sm/semibold" color="interactive-text-default">{title}</Text>
{trailing}
</View>;
});
export default r32;
@@ -0,0 +1,145 @@
// Metro module 15503 (f15504).
import _slicedToArray from "../../../../../_bundle/_slicedToArray";
import * as Module19 from "react";
import { useMemo } from "react";
import { ImageBackground, StyleSheet, View } from "react-native";
import SearchMessageStore from "../../../SearchMessageStore";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import useTheme from "../../../../../hooks/useTheme";
import { isThemeDark } from "../../../../../design/shared";
import { ObscureReason } from "../../../../explicit_media_redaction/ObscureMediaModels";
import { SpoilerIcon } from "../../../../../design/components/Icon/native/redesign/generated/SpoilerIcon";
import { ImageWarningIcon } from "../../../../../design/components/Icon/native/redesign/generated/ImageWarningIcon";
import VisualEffectView from "../../../../visual_effect_view/native/VisualEffectView";
import { getSrcWithWidthAndHeight } from "../../../../../utils/native/ImageUtils";
import { getObscuredAlt, getObscureReasonForAttachment, getObscureReasonForEmbed, getObscureReasonForUnfurledMediaItem } from "../../../../messages/MessageAttachmentUtils";
import { isAndroid } from "../../../../../utils/PlatformUtils";
import { intl, t } from "../../../../../intl/index.native";
import { ImageWithPlaceholder } from "../../../../../components_native/common/ImageWithPlaceholder";
import { useEnabledHarmTypesBitmaskForChannelAndAuthorId } from "../../../../explicit_media_redaction/hooks/useContentHarmTypes";
import { getAttachmentUrl, flattenSource, getEmbedMedia, getEmbedUrl } from "../../../../media_viewer/native/MediaSourceUtil";
import { useStateFromStores } from "../../../../../_bundle/Module589";
import { CirclePlayIcon } from "../../../../../design/components/Icon/native/redesign/generated/CirclePlayIcon";
import { AttachmentIcon } from "../../../../media/native/AttachmentPreview";
let useStyles, Component;
const SearchMediaObscurityIcon = function SearchMediaObscurityIcon(props) {
const { obscureReason, height, width } = props;
const styles = useStyles();
const blurTheme = isThemeDark(useTheme()) ? "dark" : "light";
const memo = useMemo(() => ({
height,
width
}), [height, width]);
const memo2 = useMemo(() => {
if (ObscureReason.SPOILER === obscureReason) {
return <SpoilerIcon size="lg" />;
}
if (ObscureReason.EXPLICIT_CONTENT !== obscureReason && ObscureReason.GORE_CONTENT !== obscureReason && ObscureReason.SELF_HARM_CONTENT !== obscureReason) {
if (ObscureReason.POTENTIAL_EXPLICIT_CONTENT === obscureReason) {
return null;
}
return void 0;
}
return <ImageWarningIcon size="lg" />;
}, [obscureReason]);
return <>
<VisualEffectView blurTheme={blurTheme} style={[StyleSheet.absoluteFill, memo]} />
{memo2 != null && <View style={[StyleSheet.absoluteFill, styles.container]}>{memo2}</View>}
</>;
};
useStyles = createStyles({
container: {
justifyContent: "center",
alignItems: "center"
},
sound: {
justifyContent: "center",
alignItems: "center"
}
});
Component = Module19.memo(function({ mediaUrl, mediaHeight, mediaWidth, containerStyle, placeholder, placeholderVersion, renderFallback, obscureReason: obscureReason2, containerHeight, containerWidth, scale }) {
const memo = useMemo(() => ({
height: containerHeight,
width: containerWidth
}), [containerHeight, containerWidth]);
if (mediaUrl != null && mediaHeight != null && mediaWidth != null) {
const r26 = containerHeight * scale;
const r27 = containerWidth * scale;
const r42 = _slicedToArray(mediaWidth > mediaHeight ? [Math.round(mediaWidth * (r27 / mediaHeight)), r27] : [r26, Math.round(mediaHeight * (r26 / mediaWidth))], 2);
const srcWithWidthAndHeight = getSrcWithWidthAndHeight({
src: mediaUrl,
sourceWidth: mediaWidth,
sourceHeight: mediaHeight,
targetWidth: r42[0],
targetHeight: r42[1],
format: "png"
});
const obscuredAlt = getObscuredAlt(obscureReason2);
const r54 = obscureReason2 != null ? <SearchMediaObscurityIcon obscureReason={obscureReason2} height={containerHeight} width={containerWidth} /> : null;
if (isAndroid() && obscureReason2 != null) {
return <View style={containerStyle}>
<ImageBackground style={memo} source={{
uri: srcWithWidthAndHeight
}} blurRadius={10} resizeMode="cover" accessibilityLabel={obscuredAlt} />
{r54}
</View>;
}
return <View style={containerStyle}>
<ImageWithPlaceholder style={memo} uri={srcWithWidthAndHeight} placeholder={placeholder} placeholderVersion={placeholderVersion} alt={isAndroid() ? intl.string(t.jes7FG) : obscuredAlt} />
{r54}
</View>;
}
return renderFallback != null ? <>
{renderFallback()}
</> : null;
});
export function SearchAttachmentMediaImage(props) {
const { attachment, channelId, authorId, ...props2 } = props;
const enabledHarmTypesBitmaskForChannelAndAuthorId = useEnabledHarmTypesBitmaskForChannelAndAuthorId(channelId, authorId);
return <Component {...props2} obscureReason={useMemo(() => getObscureReasonForAttachment(attachment, enabledHarmTypesBitmaskForChannelAndAuthorId), [attachment, enabledHarmTypesBitmaskForChannelAndAuthorId])} mediaUrl={getAttachmentUrl(attachment)} mediaHeight={attachment.height} mediaWidth={attachment.width} />;
}
export function SearchEmbedMediaImage(props) {
const { embed, sources, messageId, channelId, authorId, ...props2 } = props;
const enabledHarmTypesBitmaskForChannelAndAuthorId2 = useEnabledHarmTypesBitmaskForChannelAndAuthorId(channelId, authorId);
const stateFromStores = useStateFromStores([SearchMessageStore], () => {
const message = SearchMessageStore.getMessage(messageId);
if (message == null) {
return null;
}
let r22 = flattenSource(sources, false)?.spoiler;
if (r22 == null) {
r22 = false;
}
return getObscureReasonForEmbed(embed, message, r22, enabledHarmTypesBitmaskForChannelAndAuthorId2);
});
const thumbnail = embed.thumbnail;
const embedMedia = getEmbedMedia(embed);
let mediaUrl = embedMedia != null ? getEmbedUrl(embedMedia) : null;
if (thumbnail != null) {
mediaUrl = thumbnail.url;
}
return <Component {...props2} obscureReason={stateFromStores} mediaUrl={mediaUrl} mediaHeight={thumbnail != null ? thumbnail.height : embedMedia?.height} mediaWidth={thumbnail != null ? thumbnail.width : embedMedia?.width} />;
}
export function SearchSoundMediaImage(props) {
const { height: height2, width: width2, containerStyle } = props;
return <View style={[useStyles().sound, containerStyle, useMemo(() => ({
height: height2,
width: width2
}), [height2, width2])]}>
<CirclePlayIcon size="lg" color="interactive-text-default" />
</View>;
}
export function SearchFileMediaImage(props) {
const { fileName, height: height3, width: width3, containerStyle } = props;
return <View style={[useStyles().sound, containerStyle, useMemo(() => ({
height: height3,
width: width3
}), [height3, width3])]}>
<AttachmentIcon fileName={fileName} />
</View>;
}
export function SearchComponentMediaImage(props) {
const { unfurledMediaItem, sources: sources2, channelId, authorId, isBot, ...props2 } = props;
const enabledHarmTypesBitmaskForChannelAndAuthorId3 = useEnabledHarmTypesBitmaskForChannelAndAuthorId(channelId, authorId);
return <Component {...props2} obscureReason={useMemo(() => getObscureReasonForUnfurledMediaItem(unfurledMediaItem, enabledHarmTypesBitmaskForChannelAndAuthorId3, !!flattenSource(sources2)?.spoiler, isBot), [unfurledMediaItem, enabledHarmTypesBitmaskForChannelAndAuthorId3, sources2, isBot])} mediaUrl={unfurledMediaItem.proxyUrl} mediaHeight={unfurledMediaItem.height} mediaWidth={unfurledMediaItem.width} />;
}
@@ -0,0 +1,139 @@
// Metro module 15489 (f15490).
import * as Module19 from "react";
import { useState, useCallback, useMemo } from "react";
import { ActivityIndicator, View } from "react-native";
import AccessibilityStore from "../../../../../a11y/AccessibilityStore";
import PresenceStore from "../../../../../../stores/PresenceStore";
import RelationshipStore from "../../../../../../stores/RelationshipStore";
import { RelationshipTypes, StatusTypes } from "../../../../../../Constants";
import { createStyles } from "../../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../../_bundle/Module712";
import { Text } from "../../../../../../design/components/Text/native/Text";
import UserUtils, { getUserTag } from "../../../../../../utils/UserUtils";
import ActivityStatus from "../../../../../activity_status/native/ActivityStatus";
import { useStateFromStoresObject, useStateFromStores } from "../../../../../../_bundle/Module589";
import BotTag from "../../../../../applications/native/BotTag";
import { Icon, Avatar, AvatarSizes } from "../../../../../../design/void/native";
import Module8287 from "../../../../../../_bundle/Module8287";
import Module12532 from "../../../../../../_bundle/Module12532";
import { SearchListRow } from "../SearchListRow";
let useStyles;
const FriendPresence = function FriendPresence(props) {
const { user: user2, type: type2, animate, guildId: guildId2 } = props;
const styles2 = useStyles();
return type2 === RelationshipTypes.PENDING_INCOMING ? <Text lineClamp={1} variant="text-sm/medium" color="text-default">
{getUserTag(user2)}
</Text> : <ActivityStatus userId={user2.id} guildId={guildId2} iconStyle={styles2.activityStatusIcon} textStyle={styles2.activityStatusText} emojiSize={16} animate={animate} />;
};
useStyles = createStyles({
activityStatusIcon: {
width: 14,
height: 14
},
activityStatusText: {
color: Module712.colors.TEXT_SUBTLE,
fontSize: 14,
lineHeight: 18,
fontWeight: "400"
},
tag: {
marginLeft: 4
},
title: {
flexDirection: "row"
}
});
const r53 = Module19.memo(function DMRow(props) {
let isMobileOnline, isVROnline, status, stateFromStores, name;
const user = props.user;
let nickname = props.nickname;
const { premiumSince, isOwner, type, guildId, onPress } = props;
let trailing = props.trailing;
const { accessibilityActions, onAccessibilityAction } = props;
isMobileOnline = void 0;
isVROnline = void 0;
status = void 0;
stateFromStores = void 0;
name = void 0;
const styles = useStyles();
const [state, setState] = useState(false);
const stateFromStoresObject = useStateFromStoresObject([PresenceStore], () => ({
isMobileOnline: PresenceStore.isMobileOnline(user.id),
isVROnline: PresenceStore.isVROnline(user.id),
status: PresenceStore.getStatus(user.id)
}));
isMobileOnline = stateFromStoresObject.isMobileOnline;
isVROnline = stateFromStoresObject.isVROnline;
status = stateFromStoresObject.status;
stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
const stateFromStores2 = useStateFromStores([RelationshipStore], () => {
let r1 = nickname;
if (r1 == null) {
r1 = RelationshipStore.getNickname(user.id);
}
return r1;
});
nickname = stateFromStores2;
const callback = useCallback(async () => {
let c28058_2;
let c28058_3 = 0;
try {
setState(true);
c28058_3 = 1;
await onPress(user.id);
c28058_3 = 0;
(0, setState)(false);
} catch ($e) {
const r22 = $e;
let r7 = r22;
c28058_2 = r22;
if (c28058_3 !== 0) {
while (true) {
try {
const r56 = c28058_2;
c28058_3 = 0;
(0, setState)(false);
throw r56;
} catch (r53) {
r7 = r53;
c28058_2 = r53;
if (c28058_3 === 0) {
break;
}
}
}
}
throw r7;
}
}, [onPress, user.id]);
let r59 = stateFromStores2;
if (r59 == null) {
r59 = UserUtils.getName(user);
}
name = r59;
const memo = useMemo(() => {
const r22 = [<Text lineClamp={1} variant="text-md/semibold" color="mobile-text-heading-primary">{name}</Text>, , , ,];
r22[1] = user.bot && <BotTag style={styles.tag} verified={user.isVerifiedBot()} type={user.isSystemUser() ? BotTag.Types.SYSTEM_DM : BotTag.Types.BOT} />;
let r34 = isOwner;
if (isOwner) {
r34 = <View style={styles.tag}>
<Icon size={Icon.Sizes.REFRESH_SMALL_16} source={Module8287} disableColor />
</View>;
}
r22[2] = r34;
r22[3] = premiumSince != null && <View style={styles.tag}>
<Icon size={Icon.Sizes.REFRESH_SMALL_16} source={Module12532} disableColor />
</View>;
return <View style={styles.title}>{r22}</View>;
}, [styles.title, styles.tag, name, user, isOwner, premiumSince]);
const memo2 = useMemo(() => <Avatar user={user} guildId={guildId} status={StatusTypes.OFFLINE !== status ? status : null} isMobileOnline={isMobileOnline} isVROnline={isVROnline} size={AvatarSizes.LARGE_48} avatarDecoration={user.avatarDecoration} autoStatusCutout />, [user, status, isMobileOnline, isVROnline, guildId]);
const memo3 = useMemo(() => {
const userTag = UserUtils.getUserTag(user);
return userTag != null && !user.isProvisional ? <Text variant="text-sm/medium" color="text-muted">{userTag}</Text> : type != null ? <FriendPresence user={user} guildId={guildId} type={type} animate={!stateFromStores} /> : null;
}, [user, guildId, type, stateFromStores]);
if (state) {
trailing = <ActivityIndicator />;
}
return <SearchListRow label={memo} subLabel={memo3} icon={memo2} onPress={callback} trailing={trailing} accessibilityActions={accessibilityActions} onAccessibilityAction={onAccessibilityAction} />;
});
export default r53;
@@ -0,0 +1,64 @@
// Metro module 15515 (f15516).
import * as Module19 from "react";
import { useMemo, useCallback } from "react";
import { View, useWindowDimensions } from "react-native";
import ChannelStore from "../../../../../../stores/ChannelStore";
import { FILE_OR_LINK_IMAGE_BUFFER, SearchFileTypes } from "../../../../SearchConstants";
import { createStyles } from "../../../../../../design/components/Styles/native/createStyles";
import { isImageFile, isVideoFile } from "../../../../../messages/MediaFormatTesters";
import { ImageIcon } from "../../../../../../design/components/Icon/native/redesign/generated/ImageIcon";
import { VideoIcon } from "../../../../../../design/components/Icon/native/redesign/generated/VideoIcon";
import { FileIcon } from "../../../../../../design/components/Icon/native/redesign/generated/FileIcon";
import { useStateFromStores } from "../../../../../../_bundle/Module589";
import getDisplayFilename from "../../../../../messages/getDisplayFilename";
import { SearchAttachmentMediaImage, SearchFileMediaImage, SearchSoundMediaImage } from "../SearchMediaImage";
import { SearchListCardContainer, SearchListCardThumbnail, SearchListCardContent, SearchListCardFooter } from "../SearchListCard";
import { sizeString } from "../../../../../../utils/FileUtils";
const useStyles = createStyles({
icon: {
alignItems: "center",
justifyContent: "center"
}
});
const r37 = Module19.memo(function FileGridItem(props) {
let fileName;
const { data, onPress, imageStyle, containerStyle } = props;
fileName = void 0;
const styles = useStyles();
const scale = useWindowDimensions().scale;
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(data.channelId));
const r30 = [data.author, ,];
const guild_id = stateFromStores?.guild_id;
const r32 = () => data.author.getAvatarSource(stateFromStores?.guild_id);
r30[1] = guild_id;
const memo = useMemo(r32, r30);
fileName = getDisplayFilename(data.attachment);
const size = data.attachment.size;
return <SearchListCardContainer containerStyle={containerStyle} onPress={useCallback(() => {
onPress({
channelId: data.channelId,
messageId: data.messageId
});
}, [data.channelId, data.messageId, onPress])}>
<SearchListCardThumbnail thumbnail={useMemo(() => {
const type = data.type;
if (SearchFileTypes.MEDIA_ATTACHMENT === type) {
return <SearchAttachmentMediaImage containerStyle={imageStyle} attachment={data.attachment} channelId={data.channelId} authorId={data.author.id} scale={scale} containerHeight={imageStyle.height + FILE_OR_LINK_IMAGE_BUFFER} containerWidth={imageStyle.width + FILE_OR_LINK_IMAGE_BUFFER} renderFallback={() => {
const filename = data.attachment.filename;
return <View style={[styles.icon, imageStyle]}>
{isImageFile(filename) ? <ImageIcon size="lg" color="interactive-text-default" /> : isVideoFile(filename) ? <VideoIcon size="lg" color="interactive-text-default" /> : <FileIcon size="lg" color="interactive-text-default" />}
</View>;
}} />;
}
if (SearchFileTypes.ATTACHMENT === type) {
return <SearchFileMediaImage fileName={fileName} containerStyle={imageStyle} height={imageStyle.height} width={imageStyle.width} />;
}
if (SearchFileTypes.AUDIO === type) {
return <SearchSoundMediaImage containerStyle={imageStyle} height={imageStyle.height} width={imageStyle.width} />;
}
}, [data, fileName, imageStyle, scale, styles.icon])} />
<SearchListCardContent label={fileName} subLabel={size > 0 ? sizeString(size) : void 0} />
<SearchListCardFooter author={data.author} avatarSource={memo} channel={stateFromStores} />
</SearchListCardContainer>;
});
export default r37;
@@ -0,0 +1,26 @@
// Metro module 15518 (f15519).
import { memo, useCallback } from "react";
import { View } from "react-native";
import { createStyles } from "../../../../../../design/components/Styles/native/createStyles";
import { Text } from "../../../../../../design/components/Text/native/Text";
import { SearchListRow } from "../SearchListRow";
const useStyles = createStyles({
title: {
flexDirection: "row"
},
container: {
padding: 10
}
});
const r32 = memo(function GenericTextRow(props) {
const { text, icon: Icon, onPress, trailing, accessibilityActions, onAccessibilityAction } = props;
const styles = useStyles();
const callback = useCallback(async () => {
await onPress(text);
}, [onPress, text]);
const label = <View style={styles.title}>
<Text lineClamp={1} variant="text-md/medium" color="mobile-text-heading-primary" style={styles.container}>{text}</Text>
</View>;
return <SearchListRow icon={Icon != null && <Icon size="sm" color="mobile-text-heading-primary" />} label={label} onPress={callback} trailing={trailing} accessibilityActions={accessibilityActions} onAccessibilityAction={onAccessibilityAction} />;
});
export default r32;
@@ -0,0 +1,23 @@
// Metro module 15491 (f15492).
import { useCallback } from "react";
import useChannelName from "../../../../../channel/useChannelName";
import GroupDMAvatar from "../../../../../group_dm/native/GroupDMAvatar";
import { AvatarSizes } from "../../../../../../design/void/native";
import { useRecipientsLabel } from "../../../../../main_tabs_v2/useRecipientsLabel";
import { Text } from "../../../../../../design/components/Text/native/Text";
import { SearchListRow } from "../SearchListRow";
export default function GroupDMRow(props) {
const { channel, trailing, onPress, onAccessibilityAction, accessibilityActions } = props;
let accessibilityLabel = useChannelName(channel);
const callback = useCallback(() => {
onPress(channel.id);
}, [channel.id, onPress]);
const icon = <GroupDMAvatar size={AvatarSizes.LARGE_48} channel={channel} />;
const recipientsLabel = useRecipientsLabel(channel);
const subLabel = recipientsLabel != null ? <Text variant="text-xs/medium" color="text-muted" lineClamp={1}>{recipientsLabel}</Text> : void 0;
const label = accessibilityLabel == null ? "" : accessibilityLabel;
if (accessibilityLabel == null) {
accessibilityLabel = "";
}
return <SearchListRow label={label} icon={icon} onPress={callback} accessibilityLabel={accessibilityLabel} subLabel={subLabel} trailing={trailing} accessibilityActions={accessibilityActions} onAccessibilityAction={onAccessibilityAction} />;
};
@@ -0,0 +1,5 @@
// Metro module 15516 (f15517).
import UserRow from "../../../../../main_tabs_v2/native/shared_components/user_list/UserRow";
export default function GuildChannelMemberRow(props) {
return <UserRow {...props} />;
};
@@ -0,0 +1,51 @@
// Metro module 15497 (f15498).
import { memo } from "react";
import { Image as Image2, View } from "react-native";
import { CHANNEL_LIST_SEARCH_LAYOUT } from "../../../../SearchConstants";
import { createStyles } from "../../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../../_bundle/Module712";
import useChannelName from "../../../../../channel/useChannelName";
import { renderChannelContent } from "../../../../../main_tabs_v2/native/shared_components/guild_channels/ChannelContent";
import { getSimpleChannelIcon } from "../../../../../../utils/native/ChannelUtils";
import { getChannelAccessibilityProps } from "../../../../../main_tabs_v2/native/shared_components/guild_channels/ChannelItem";
import { SearchListRow } from "../SearchListRow";
let useStyles;
const GuildChannelLabel = function GuildChannelLabel(props) {
const channel = props.channel;
return <View style={useStyles().content}>
{renderChannelContent({
channel,
layout: CHANNEL_LIST_SEARCH_LAYOUT,
name: useChannelName(channel)
})}
</View>;
};
useStyles = createStyles({
container: {
paddingVertical: 10
},
content: {
flexDirection: "row",
alignItems: "center"
},
iconContainer: {
marginRight: 0
},
simpleIcon: {
width: 20,
height: 20,
marginRight: 8,
tintColor: Module712.colors.TEXT_MUTED
}
});
const r41 = memo(function GuildChannelRow(props) {
const { channel, subtitle, trailing, extras, onPress, voiceStates, ...props2 } = props;
const styles = useStyles();
return <SearchListRow {...getChannelAccessibilityProps({
channel,
unread: false,
mentionCount: 0,
voiceStates
})} {...props2} containerStyle={styles.container} iconContainerStyle={styles.iconContainer} icon={<Image2 style={styles.simpleIcon} source={getSimpleChannelIcon(channel)} />} iconWidth={32} label={<GuildChannelLabel channel={channel} />} subLabel={subtitle} onPress={onPress} trailing={trailing} extras={extras} />;
});
export default r41;
@@ -0,0 +1,34 @@
// Metro module 15501 (f15502).
import { memo, useMemo, useCallback } from "react";
import { CHANNEL_LIST_SEARCH_LAYOUT } from "../../../../SearchConstants";
import SnowflakeUtils from "../../../../../../utils/SnowflakeUtils";
import { renderChannelSubtitle } from "../../../../../main_tabs_v2/native/shared_components/guild_channels/ChannelSubtitle";
import { getChannelActiveAgoTimestamp } from "../../../../SearchUtils";
import GuildChannelRow from "./GuildChannelRow";
import { HermesBuiltin } from "../../../../../../_hermes/prelude";
const r23 = memo(function GuildTextChannelRow(props) {
const { channel, trailing, lastMessageId, onPress } = props;
const r16 = {};
let r4 = null;
const props2 = HermesBuiltin.copyDataProperties(r16, props, {
__proto__: null,
channel: 0,
trailing: 0,
lastMessageId: 0,
onPress: 0
});
const { id, guild_id } = channel;
if (lastMessageId != null) {
r4 = SnowflakeUtils.extractTimestamp(lastMessageId);
}
let c22086_4 = r4;
return <GuildChannelRow {...props2} subtitle={useMemo(() => renderChannelSubtitle({
subtitle: c22086_4 != null ? getChannelActiveAgoTimestamp(c22086_4) : null,
layout: CHANNEL_LIST_SEARCH_LAYOUT,
channelId: id,
guildId: guild_id
}), [id, guild_id, r4])} channel={channel} trailing={trailing} onPress={useCallback(() => {
onPress(channel.id);
}, [channel.id, onPress])} />;
});
export default r23;
@@ -0,0 +1,144 @@
// Metro module 15493 (f15494).
import { useMemo, memo, useCallback } from "react";
import { View } from "react-native";
import StageInstanceStore from "../../../../../stage_channels/StageInstanceStore";
import { CHANNEL_LIST_SEARCH_LAYOUT } from "../../../../SearchConstants";
import * as _ChannelListLayout from "../../../../../main_tabs_v2/native/shared_components/guild_channels/layouts/ChannelListLayout";
import UserUtils from "../../../../../../utils/UserUtils";
import { t, intl } from "../../../../../../intl/index.native";
import { createStyles } from "../../../../../../design/components/Styles/native/createStyles";
import { useStateFromStores } from "../../../../../../_bundle/Module589";
import { renderChannelSubtitle } from "../../../../../main_tabs_v2/native/shared_components/guild_channels/ChannelSubtitle";
import { useStageParticipantsCount } from "../../../../../stage_channels/StageChannelParticipantStoreHooks";
import { StageChannelParticipantNamedIndex } from "../../../../../stage_channels/StageChannelParticipants";
import VoiceOrStageSummaryRow from "../../../../../main_tabs_v2/native/shared_components/guild_channels/VoiceOrStageSummaryRow";
import GuildChannelRow from "./GuildChannelRow";
import { VocalChannelJoinButton } from "../../../../../channel_list_v2/native/components/index";
let useStyles, GuildVoiceChannelExtras;
const GuildVoiceChannelSubtitle = function GuildVoiceChannelSubtitle(props) {
const { channel, voiceStates } = props;
const { id, guild_id } = channel;
const styles = useStyles();
const stateFromStores = useStateFromStores([StageInstanceStore], () => StageInstanceStore.getStageInstanceByChannel(channel.id)?.topic, [channel.id]);
return <View style={styles.subtitle}>
{useMemo(() => {
let subtitle = stateFromStores;
if (stateFromStores == null) {
const isLayoutCompact = _ChannelListLayout.isLayoutCompact(CHANNEL_LIST_SEARCH_LAYOUT);
let r22 = null;
if (!isLayoutCompact) {
const length = voiceStates.length;
r22 = null;
if (length !== 0) {
if (length === 1) {
const r109 = t["/GCyII"];
const r110 = voiceStates[0];
let r112 = r110 == null ? void 0 : r110.member?.nick;
if (r112 == null) {
r112 = UserUtils.getName(voiceStates[0]?.user);
}
r22 = intl.formatToPlainString(r109, {
a: r112
});
} else if (length === 2) {
const r70 = t["2efxiV"];
const r71 = voiceStates[0];
let r73 = r71 == null ? void 0 : r71.member?.nick;
if (r73 == null) {
r73 = UserUtils.getName(voiceStates[0]?.user);
}
const r85 = voiceStates[1];
let r87 = r85 == null ? void 0 : r85.member?.nick;
if (r87 == null) {
r87 = UserUtils.getName(voiceStates[1]?.user);
}
r22 = intl.formatToPlainString(r70, {
a: r73,
b: r87
});
} else {
const o2nmbk = t.o2nmbk;
const r36 = voiceStates[0];
let r13 = r36 == null ? void 0 : r36.member?.nick;
if (r13 == null) {
r13 = UserUtils.getName(voiceStates[0]?.user);
}
const r45 = voiceStates[1];
let r47 = r45 == null ? void 0 : r45.member?.nick;
if (r47 == null) {
r47 = UserUtils.getName(voiceStates[1]?.user);
}
r22 = intl.formatToPlainString(o2nmbk, {
a: r13,
b: r47,
n: voiceStates.length - 2
});
}
}
}
subtitle = r22;
}
return renderChannelSubtitle({
subtitle,
muted: false,
layout: CHANNEL_LIST_SEARCH_LAYOUT,
channelId: id,
guildId: guild_id
});
}, [stateFromStores, voiceStates, id, guild_id])}
</View>;
};
GuildVoiceChannelExtras = function GuildVoiceChannelExtras(props) {
const { channel: channel3, users } = props;
const styles = useStyles();
const stageParticipantsCount = useStageParticipantsCount(channel3.id, StageChannelParticipantNamedIndex.AUDIENCE);
return <View style={styles.subtitle}>
{users.length !== 0 && <View style={styles.users}>
<VoiceOrStageSummaryRow users={users} max={5} guildId={channel3.guild_id} layout={CHANNEL_LIST_SEARCH_LAYOUT} audienceCount={stageParticipantsCount} />
</View>}
</View>;
};
useStyles = createStyles({
users: {
marginTop: 4
},
subtitle: {
marginEnd: 16
},
trailing: {
paddingVertical: 4,
alignItems: "center",
alignSelf: "center"
}
});
const r38 = memo(function GuildVoiceChannelRow(props) {
const channel2 = props.channel;
let voiceStates2 = props.voiceStates;
const speakerVoiceStates = props.speakerVoiceStates;
let trailing = props.trailing;
const onPress = props.onPress;
const styles = useStyles();
if (channel2.isGuildStageVoice()) {
voiceStates2 = speakerVoiceStates;
}
const users = voiceStates2.map((item) => item.user);
const props2 = {
onPress: useCallback(() => {
onPress(channel2.id);
}, [channel2.id, onPress]),
voiceStates: voiceStates2,
channel: channel2,
subtitle: <GuildVoiceChannelSubtitle channel={channel2} voiceStates={voiceStates2} users={users} />,
trailing: null,
extras: null
};
if (trailing == null) {
trailing = <View style={styles.trailing}>
<VocalChannelJoinButton channel={channel2} voiceStates={voiceStates2} />
</View>;
}
props2.trailing = trailing;
props2.extras = <GuildVoiceChannelExtras channel={channel2} voiceStates={voiceStates2} users={users} />;
return <GuildChannelRow {...props2} />;
});
export default r38;
@@ -0,0 +1,409 @@
// Metro module 15512 (f15513).
import * as Module19 from "react";
import { useState, useCallback, useMemo } from "react";
import { View, useWindowDimensions } from "react-native";
import ChannelStore from "../../../../../../stores/ChannelStore";
import SearchMessageStore from "../../../../SearchMessageStore";
import { FILE_OR_LINK_IMAGE_BUFFER, SearchLinkTypes } from "../../../../SearchConstants";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../../../../design/components/Styles/native/createStyles";
import { useStateFromStores } from "../../../../../../_bundle/Module589";
import { intl, t } from "../../../../../../intl/index.native";
import { renderMessageMarkupWithParser } from "../../../../../messages/renderMessageMarkup";
import { NativeSearchResultLinkPreviewParser } from "../../../SearchResultLinkPreviewMarkup";
import { Text } from "../../../../../../design/components/Text/native/Text";
import { ChatIcon } from "../../../../../../design/components/Icon/native/redesign/generated/ChatIcon";
import { getUrlIcon } from "../../../SearchPlatformUtils";
import { LinkIcon } from "../../../../../../design/components/Icon/native/redesign/generated/LinkIcon";
import { isLinkTrusted } from "../../../../../markup/MarkupReactLinkUtils";
import { SearchListCardContainer, SearchListCardThumbnail, SearchListCardContent, SearchListCardFooter } from "../SearchListCard";
import { PressableHighlight } from "../../../../../../design/void/Pressables/native/Pressables";
import { SearchEmbedMediaImage } from "../SearchMediaImage";
import Module38 from "../../../../../../_bundle/Module38";
import * as _MaskedLinkUtils from "../../../../../../utils/MaskedLinkUtils";
function $mk96737($env) {
return (a0) => {
let env28059;
L25: {
const r5 = $env;
const r8 = $env.$parent;
const r7 = r5[0];
const r6 = r5[1];
const r16 = env28059 = {
$parent: r8
};
env28059[0] = r7;
env28059[1] = r6;
if (Array.isArray(a0)) {
a0.forEach($mk96737(r16));
} else {
if (a0.type !== "link" && a0.type !== "channelMention") {
if (a0.content == null) {
break L25;
}
let env28060;
const content = a0.content;
const r22 = env28060 = {
$parent: r8
};
env28060[0] = r7;
env28060[1] = r6;
if (Array.isArray(content)) {
content.forEach($mk96737(r22));
break L25;
}
if (content.type !== "link" && content.type !== "channelMention") {
if (content.content == null) {
break L25;
}
(0, r8[14])(content.content, r7, r6);
break L25;
}
if (r7 === 0) {
r6(content);
break L25;
}
(0, r8[14])(content, r7 - 1, r6);
break L25;
}
if (r7 === 0) {
r6(a0);
} else {
let env28061;
const r40 = r7 - 1;
const r41 = env28061 = {
$parent: r8
};
env28061[0] = r40;
env28061[1] = r6;
if (Array.isArray(a0)) {
a0.forEach($mk96737(r41));
} else {
if (a0.type !== "link" && a0.type !== "channelMention") {
if (a0.content == null) {
break L25;
}
(0, r8[14])(a0.content, r40, r6);
break L25;
}
if (r40 === 0) {
r6(a0);
} else {
(0, r8[14])(a0, r40 - 1, r6);
}
}
}
}
}
return a0;
};
}
let LinkParsedGridItem, LinkEmbedGridItem, useStyles;
let env11043 = {};
const getLinkNodeAtIndex = function getLinkNodeAtIndex(a0, a1, a2) {
let env22102;
L9: {
const r4 = env22102 = {
$parent: env11043
};
env22102[0] = a1;
env22102[1] = a2;
if (Array.isArray(a0)) {
a0.forEach($mk96737(r4));
} else {
if (a0.type !== "link" && a0.type !== "channelMention") {
if (a0.content == null) {
break L9;
}
getLinkNodeAtIndex(a0.content, a1, a2);
break L9;
}
if (a1 === 0) {
a2(a0);
} else {
getLinkNodeAtIndex(a0, a1 - 1, a2);
}
}
}
return a0;
};
LinkParsedGridItem = function LinkParsedGridItem(props) {
let stateFromStores2, state, setState, callback;
const { author, linkIndex, channelId, messageId, onPressSearchLink, onPressGuildVoiceChannelMention, onPress, imageStyle: imageStyle2, containerStyle } = props;
stateFromStores2 = void 0;
state = void 0;
setState = void 0;
callback = void 0;
const styles = useStyles();
let c22103_7 = styles;
const stateFromStores = useStateFromStores([SearchMessageStore], () => SearchMessageStore.getMessage(messageId));
stateFromStores2 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId));
[state, setState] = useState(null);
callback = useCallback((a0) => {
let env28062;
L25: {
const r8 = env11043;
const r16 = env28062 = {
$parent: r8
};
env28062[0] = linkIndex;
env28062[1] = setState;
if (Array.isArray(a0)) {
a0.forEach($mk96737(r16));
} else {
if (a0.type !== "link" && a0.type !== "channelMention") {
if (a0.content == null) {
break L25;
}
let env28063;
const content = a0.content;
const r22 = env28063 = {
$parent: r8
};
env28063[0] = linkIndex;
env28063[1] = setState;
if (Array.isArray(content)) {
content.forEach($mk96737(r22));
break L25;
}
if (content.type !== "link" && content.type !== "channelMention") {
if (content.content == null) {
break L25;
}
getLinkNodeAtIndex(content.content, linkIndex, setState);
break L25;
}
if (linkIndex === 0) {
setState(content);
break L25;
}
getLinkNodeAtIndex(content, linkIndex - 1, setState);
break L25;
}
if (linkIndex === 0) {
setState(a0);
} else {
let env28064;
const r40 = linkIndex - 1;
const r41 = env28064 = {
$parent: r8
};
env28064[0] = r40;
env28064[1] = setState;
if (Array.isArray(a0)) {
a0.forEach($mk96737(r41));
} else {
if (a0.type !== "link" && a0.type !== "channelMention") {
if (a0.content == null) {
break L25;
}
getLinkNodeAtIndex(a0.content, r40, setState);
break L25;
}
if (r40 === 0) {
setState(a0);
} else {
getLinkNodeAtIndex(a0, r40 - 1, setState);
}
}
}
}
}
return a0;
}, [linkIndex]);
const memo = useMemo(() => {
if (stateFromStores == null) {
return intl.string(t.mE3KJN);
}
return <View pointerEvents="none">
<Text variant="text-md/semibold" color="mobile-text-heading-primary" lineClamp={1}>{renderMessageMarkupWithParser(NativeSearchResultLinkPreviewParser, stateFromStores, {
postProcessor: callback
}).content}</Text>
</View>;
}, [stateFromStores, callback]);
const memo2 = useMemo(() => {
if (state != null && state.type === "link" && state.target != null && state.target !== "") {
return (0, jsx)(Text, {
variant: "text-xs/normal",
color: "text-link",
lineClamp: 1,
children: state.target
});
}
if (state != null && state?.type === "channelMention") {
return (0, jsx)(Text, {
variant: "text-xs/normal",
color: "text-link",
lineClamp: 1,
children: state.originalLink
});
}
return (0, jsx)(Text, {
variant: "text-xs/normal",
color: "interactive-text-default",
lineClamp: 1,
style: c22103_7.tapToSee,
children: intl.string(t.q2IIoP)
});
}, [state, styles.tapToSee]);
const r57 = [state?.target, ,];
const type = state?.type;
const r59 = () => {
const type = state?.type;
if (type === "channelMention") {
return (0, jsx)(ChatIcon, {
size: "lg"
});
}
if (type === "link") {
return (0, jsx)(getUrlIcon(state.target), {
size: "lg"
});
}
return (0, jsx)(LinkIcon, {
size: "lg"
});
};
r57[1] = type;
const memo3 = useMemo(r59, r57);
const callback2 = useCallback(() => {
if (state == null) {
onPress({
channelId,
messageId
});
} else if (state.type === "link") {
onPressSearchLink({
url: state.target,
trusted: isLinkTrusted(state),
messageId,
channelId
});
} else if (state.type === "channelMention") {
const channelId3 = state.channelId;
const channel = ChannelStore.getChannel(channelId3);
if (channel == null ? void 0 : channel.isGuildVocal()) {
onPressGuildVoiceChannelMention({
channelId,
messageId,
mentionedChannelId: channelId3
});
} else {
onPressSearchLink({
url: state.originalLink,
trusted: true,
messageId,
channelId
});
}
}
}, [channelId, messageId, state, onPress, onPressGuildVoiceChannelMention, onPressSearchLink]);
const memo4 = useMemo(() => author.getAvatarSource(stateFromStores2?.guild_id), [author, stateFromStores2?.guild_id]);
return <SearchListCardContainer containerStyle={containerStyle} onPress={callback2}>
<SearchListCardThumbnail thumbnail={<View style={[styles.iconContainer, imageStyle2]}>{memo3}</View>} />
<SearchListCardContent label={memo} subLabel={memo2} />
<PressableHighlight onPress={useCallback(() => {
onPress({
channelId,
messageId
});
}, [channelId, messageId, onPress])}>
<SearchListCardFooter author={author} avatarSource={memo4} channel={stateFromStores2} />
</PressableHighlight>
</SearchListCardContainer>;
};
LinkEmbedGridItem = function LinkEmbedGridItem(props) {
let stateFromStores3, scale, url, url2;
const { embed, sources, author: author2, channelId: channelId2, messageId: messageId2, onPressSearchLink: onPressSearchLink2, onPress: onPress2, imageStyle, containerStyle } = props;
stateFromStores3 = void 0;
scale = void 0;
url = void 0;
url2 = void 0;
const styles = useStyles();
let c22104_8 = styles;
const stateFromStores4 = useStateFromStores([SearchMessageStore], () => SearchMessageStore.getMessage(messageId2));
stateFromStores3 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId2));
scale = (0, useWindowDimensions)().scale;
let url3 = embed.url;
url = url3;
let rawTitle = embed.rawTitle;
if (rawTitle == null) {
rawTitle = embed.author?.name;
}
if (rawTitle == null) {
rawTitle = embed.url;
}
url2 = rawTitle;
const memo = useMemo(() => <SearchEmbedMediaImage messageId={messageId2} channelId={channelId2} authorId={author2.id} sources={sources} embed={embed} containerStyle={imageStyle} renderFallback={() => <View style={[c22104_8.iconContainer, imageStyle]}>
<LinkIcon size="md" />
</View>} scale={scale} containerHeight={imageStyle.height + FILE_OR_LINK_IMAGE_BUFFER} containerWidth={imageStyle.width + FILE_OR_LINK_IMAGE_BUFFER} />, [author2.id, channelId2, embed, imageStyle, messageId2, scale, sources, styles.iconContainer]);
const memo2 = useMemo(() => author2.getAvatarSource(stateFromStores3?.guild_id), [author2, stateFromStores3?.guild_id]);
const callback2 = useCallback(() => {
Module38(url != null, "[LinkGridItem] Embed url cannot be null");
onPressSearchLink2({
url,
trusted: _MaskedLinkUtils.isLinkTrusted(url, url2),
messageId: messageId2,
channelId: channelId2
});
}, [url, onPressSearchLink2, url2, channelId2, messageId2]);
const callback3 = useCallback(() => {
onPress2({
channelId: channelId2,
messageId: messageId2
});
}, [channelId2, messageId2, onPress2]);
const r72 = [<SearchListCardThumbnail thumbnail={memo} />, , ,];
if (stateFromStores4 == null) {
rawTitle = intl.string(t.mE3KJN);
}
if (url == null) {
url3 = intl.string(t.q2IIoP);
}
r72[1] = <SearchListCardContent label={rawTitle} subLabel={<Text variant="text-xs/normal" color="text-link" lineClamp={1}>{url3}</Text>} />;
r72[2] = <PressableHighlight onPress={callback3}>
<SearchListCardFooter author={author2} avatarSource={memo2} channel={stateFromStores3} />
</PressableHighlight>;
return <SearchListCardContainer containerStyle={containerStyle} onPress={callback2}>{r72}</SearchListCardContainer>;
};
useStyles = createStyles({
iconContainer: {
alignItems: "center",
justifyContent: "center"
},
tapToSee: {
fontStyle: "italic"
}
});
const r45 = Module19.memo(function LinkGridItem({ data, onPressSearchLink: onPressSearchLink3, onPressGuildVoiceChannelMention: onPressGuildVoiceChannelMention2, onPress: onPress3, imageStyle: imageStyle2, containerStyle }) {
const type = data.type;
if (SearchLinkTypes.EMBED === type) {
return (0, jsx)(LinkEmbedGridItem, {
embed: data.embed,
sources: data.sources,
messageId: data.messageId,
channelId: data.channelId,
author: data.author,
linkIndex: data.linkIndex,
onPressSearchLink: onPressSearchLink3,
onPress: onPress3,
imageStyle: imageStyle2,
containerStyle
});
}
if (SearchLinkTypes.TEXT === type) {
return (0, jsx)(LinkParsedGridItem, {
messageId: data.messageId,
channelId: data.channelId,
author: data.author,
linkIndex: data.linkIndex,
onPressSearchLink: onPressSearchLink3,
onPressGuildVoiceChannelMention: onPressGuildVoiceChannelMention2,
onPress: onPress3,
imageStyle: imageStyle2,
containerStyle
});
}
return null;
});
export default r45;
@@ -0,0 +1,26 @@
// Metro module 15506 (f15507).
import { useCallback } from "react";
import { View } from "react-native";
import { MEDIA_ITEM_GAP_WIDTH, MEDIA_NUM_COLUMNS, SEARCH_LIST_HORIZONTAL_PADDING } from "../../../../SearchConstants";
import { createStyles } from "../../../../../../design/components/Styles/native/createStyles";
import MediaGridItem from "./MediaGridItem";
import { getMediaGridItemStyles } from "../../../SearchPlatformUtils";
import { FlashList } from "../../../../../../_bundle/noop_6676";
import { MediaVerticalSeparator } from "./Separators";
const useStyles = createStyles({
container: {
paddingLeft: SEARCH_LIST_HORIZONTAL_PADDING - 2,
paddingRight: SEARCH_LIST_HORIZONTAL_PADDING + 4
}
});
export default function MediaGrid(props) {
const { media, mediaSize, onPress, animate } = props;
return <View style={useStyles().container}>
<FlashList numColumns={MEDIA_NUM_COLUMNS} data={media} renderItem={useCallback((a0) => <MediaGridItem animate={animate} size={mediaSize} media={a0.item} onPress={onPress} containerStyle={getMediaGridItemStyles({
itemIndex: a0.index,
numItems: media.length,
numColumns: MEDIA_NUM_COLUMNS,
spacing: MEDIA_ITEM_GAP_WIDTH
})} />, [media.length, mediaSize, onPress, animate])} ItemSeparatorComponent={MediaVerticalSeparator} scrollEnabled={false} />
</View>;
};
@@ -0,0 +1,92 @@
// Metro module 15502 (f15503).
import * as Module19 from "react";
import { useRef, useMemo, useCallback, useEffect } from "react";
import { Pressable, View, useWindowDimensions } from "react-native";
import ChannelStore from "../../../../../../stores/ChannelStore";
import { SearchMediaTypes } from "../../../../SearchConstants";
import { createStyles } from "../../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../../../_bundle/Module589";
import ReanimatedRexport, { useSharedValue, useAnimatedStyle } from "../../../../../reanimated/ReanimatedRexport";
import * as _timing from "../../../../../../design/animation/reanimated/timing/timing";
import * as _timingPresets from "../../../../../../design/animation/reanimated/timing/timingPresets";
import { SearchEmbedMediaImage, SearchAttachmentMediaImage, SearchSoundMediaImage, SearchComponentMediaImage } from "../SearchMediaImage";
import { Card } from "../../../../../../design/components/Card/native/Card.native";
import { Avatar, AvatarSizes } from "../../../../../../design/void/native";
const useStyles = createStyles({
container: {
borderRadius: Module712.radii.xs,
overflow: "hidden",
backgroundColor: Module712.colors.BORDER_SUBTLE
},
avatar: {
position: "absolute",
top: 8,
right: 8
},
card: {
padding: 0
}
});
let c11034_12 = {
HIDDEN: 0,
0: "HIDDEN",
VISIBLE: 1,
1: "VISIBLE"
};
const __initData = {
code: "function MediaGridItemTsx1(){const{withTiming,opacity,timingStandard}=this.__closure;return{opacity:withTiming(opacity.get(),timingStandard)};}"
};
const r53 = Module19.memo(function MediaGridItem(props) {
let sharedValue;
const { media, size, containerStyle, onPress, animate } = props;
sharedValue = void 0;
const styles = useStyles();
const scale = useWindowDimensions().scale;
const ref = useRef(null);
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(media.channelId));
const r34 = [media.author, ,];
const guild_id = stateFromStores?.guild_id;
const r36 = () => media.author.getAvatarSource(stateFromStores?.guild_id);
r34[1] = guild_id;
const memo = useMemo(r36, r34);
const callback = useCallback(() => {
onPress({
media,
originView: ref.current
});
}, [media, onPress]);
sharedValue = useSharedValue(animate ? c11034_12.HIDDEN : c11034_12.VISIBLE);
const f = () => ({
opacity: _timing.withTiming(sharedValue.get(), _timingPresets.timingStandard)
});
f.__closure = {
withTiming: _timing.withTiming,
opacity: sharedValue,
timingStandard: _timingPresets.timingStandard
};
f.__workletHash = 9644750191833;
f.__initData = __initData;
const animatedStyle = useAnimatedStyle(f);
useEffect(() => {
sharedValue.set(c11034_12.VISIBLE);
}, [sharedValue]);
const memo2 = useMemo(() => ({
width: size,
height: size
}), [size]);
return <ReanimatedRexport.View style={[styles.container, containerStyle, memo2, animatedStyle]}>
<Pressable ref={ref} style={memo2} accessibilityRole="button" onPress={callback}>
{media.type === SearchMediaTypes.EMBED && <SearchEmbedMediaImage sources={media.sources} embed={media.embed} messageId={media.messageId} channelId={media.channelId} authorId={media.author.id} scale={scale} containerHeight={size} containerWidth={size} />}
{media.type === SearchMediaTypes.ATTACHMENT && <SearchAttachmentMediaImage attachment={media.attachment} channelId={media.channelId} authorId={media.author.id} scale={scale} containerHeight={size} containerWidth={size} />}
{media.type === SearchMediaTypes.AUDIO && <SearchSoundMediaImage height={size} width={size} />}
{media.type === SearchMediaTypes.COMPONENT && <SearchComponentMediaImage unfurledMediaItem={media.unfurledMediaItem} sources={media.sources} channelId={media.channelId} authorId={media.author.id} isBot={media.author.bot} scale={scale} containerHeight={size} containerWidth={size} />}
{memo != null && <View style={styles.avatar}>
<Card shadow="low" style={styles.card}>
<Avatar source={memo} size={AvatarSizes.XSMALL} avatarDecoration={media.author.avatarDecoration} />
</Card>
</View>}
</Pressable>
</ReanimatedRexport.View>;
});
export default r53;
@@ -0,0 +1,173 @@
// Metro module 15507 (f15508).
import * as Module19 from "react";
import { useMemo, useEffect, useCallback } from "react";
import { View, Platform } from "react-native";
import AccessibilityStore from "../../../../../a11y/AccessibilityStore";
import FavoriteStore from "../../../../../favorites/FavoriteStore";
import ChannelStore from "../../../../../../stores/ChannelStore";
import GuildStore from "../../../../../../stores/GuildStore";
import UserGuildSettingsStore from "../../../../../../stores/UserGuildSettingsStore";
import { MessageFlags } from "../../../../../../Constants";
import { createStyles } from "../../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../../../_bundle/Module589";
import { getChannelIcon } from "../../../../../../utils/native/ChannelUtils";
import useChannelName from "../../../../../channel/useChannelName";
import { Icon, Avatar, AvatarSizes, RoleDot } from "../../../../../../design/void/native";
import { Text } from "../../../../../../design/components/Text/native/Text";
import Module10308 from "../../../../../../_bundle/Module10308";
import Module9624 from "../../../../../../_bundle/Module9624";
import BotTag from "../../../../../applications/native/BotTag";
import UserUtils from "../../../../../../utils/UserUtils";
import { getUser } from "../../../../../../actions/UserActionCreators";
import { useSearchMessageTimestamp } from "../../../hooks/useSearchMessageTimestamp";
import { BellZIcon } from "../../../../../../design/components/Icon/native/redesign/generated/BellZIcon";
import PollBadge from "../../../../../polls/native/PollBadge";
import useMessageAuthor from "../../../../../messages/useMessageAuthor";
import { useProcessColorStringsArray, useIsRoleStyleAndRoleColorsEligibleForERC } from "../../../../../premium/enhanced_role_colors/native/EnhancedRoleColorUtils";
import { useIsChannelSpoilerGated } from "../../../../../spoiler_channels/SpoilerChannelUtils";
import { SearchListRow } from "../SearchListRow";
import { intl, t } from "../../../../../../intl/index.native";
import { NativeMessageChannelRowPreview } from "../../../../../main_tabs_v2/native/shared_components/ChannelRowPreview";
import { ChannelListLayoutTypes } from "../../../../../main_tabs_v2/ChannelListLayoutTypes";
let useStyles, MessageRowIcon, PrivateChannelMessageRowLabel, GuildChannelMessageRowLabel;
const GuildChannelMessageRowHeader = function GuildChannelMessageRowHeader(props) {
const channel = props.channel;
let muted = props.muted;
let isFavorite = props.isFavorite;
const styles = useStyles();
const r45 = [<Icon source={getChannelIcon(channel, {
isRulesChannel: useStateFromStores([GuildStore], () => GuildStore.getGuild(channel.guild_id)?.rulesChannelId) === channel.id
})} size={Icon.Sizes.REFRESH_SMALL_16} style={styles.channelIcon} />, <Text lineClamp={1} variant="text-sm/semibold" color="interactive-text-default">
{useChannelName(channel)}
</Text>, , , ,];
if (muted) {
muted = <Icon source={Module10308} size={Icon.Sizes.EXTRA_SMALL} style={styles.channelStatus} />;
}
r45[2] = muted;
if (isFavorite) {
isFavorite = <Icon source={Module9624} size={Icon.Sizes.EXTRA_SMALL} style={styles.channelStatus} />;
}
r45[3] = isFavorite;
r45[4] = channel.isSystemDM() && <BotTag type={BotTag.Types.SYSTEM_DM} verified />;
return <View style={styles.header}>{r45}</View>;
};
MessageRowIcon = function MessageRowIcon(props) {
const message3 = props.message;
return <Avatar user={message3.author} guildId={props.channel.guild_id} size={AvatarSizes.LARGE_48} avatarDecoration={message3.author.avatarDecoration} />;
};
PrivateChannelMessageRowLabel = function PrivateChannelMessageRowLabel(props) {
const { message, channel: channel2 } = props;
let muted = props.muted;
const styles = useStyles();
const memo = useMemo(() => UserUtils.getName(message.author), [message.author]);
useEffect(() => {
if (channel2.isDM() || channel2.isGroupDM()) {
channel2.recipients.forEach((recipient) => getUser(recipient));
}
}, [channel2]);
const searchMessageTimestamp = useSearchMessageTimestamp(message, channel2);
const { timestamp, timestampAccessibilityLabel } = searchMessageTimestamp;
const r41 = [<Text lineClamp={1} variant="text-md/semibold" color="interactive-text-active">{memo}</Text>, , ,];
if (muted) {
muted = <Icon source={Module10308} size={Icon.Sizes.EXTRA_SMALL} style={styles.channelStatus} />;
}
r41[1] = muted;
r41[2] = channel2.isSystemDM() && <BotTag type={BotTag.Types.SYSTEM_DM} verified />;
return <View style={styles.labelContainer}>
<View style={styles.authorRow}>{r41}</View>
<Text variant="text-xs/medium" color="interactive-text-active" lineClamp={1} style={styles.timestamp} accessibilityLabel={timestampAccessibilityLabel}>{timestamp}</Text>
{message.hasFlag(MessageFlags.SUPPRESS_NOTIFICATIONS) ? <BellZIcon size="xs" style={styles.suppressNotificationsIcon} /> : null}
{message.isPoll() ? <PollBadge style={styles.pollBadge} /> : null}
</View>;
};
GuildChannelMessageRowLabel = function GuildChannelMessageRowLabel(props) {
const { message: message3, channel: channel3 } = props;
const styles = useStyles();
const stateFromStores4 = useStateFromStores([AccessibilityStore], () => AccessibilityStore.roleStyle);
const messageAuthor = useMessageAuthor(message3);
const { nick, colorString, colorStrings } = messageAuthor;
const style = stateFromStores4 === "username" && colorString != null ? {
color: colorString
} : {};
const processColorStringsArray = useProcessColorStringsArray(colorStrings);
const isRoleStyleAndRoleColorsEligibleForERC = useIsRoleStyleAndRoleColorsEligibleForERC(channel3.guild_id, message3.author.id, stateFromStores4, processColorStringsArray);
const searchMessageTimestamp = useSearchMessageTimestamp(message3, channel3);
return <View style={styles.labelContainer}>
<View style={styles.authorRow}>
{stateFromStores4 === "dot" && colorString != null && <RoleDot size="small" color={colorString} colors={colorStrings} />}
<Text variant="text-sm/semibold" color="interactive-text-active" lineClamp={1} style={style} gradientColors={isRoleStyleAndRoleColorsEligibleForERC ? processColorStringsArray : void 0}>{nick}</Text>
</View>
<Text variant="text-xs/medium" color="text-default" lineClamp={1} style={styles.timestamp} accessibilityLabel={searchMessageTimestamp.timestampAccessibilityLabel}>{searchMessageTimestamp.timestamp}</Text>
{message3.hasFlag(MessageFlags.SUPPRESS_NOTIFICATIONS) ? <BellZIcon size="xs" style={styles.suppressNotificationsIcon} /> : null}
{message3.isPoll() ? <PollBadge style={styles.pollBadge} /> : null}
</View>;
};
Platform;
useStyles = createStyles({
channelIcon: {
marginRight: 5,
alignSelf: "center"
},
channelStatus: {
marginLeft: 5,
alignSelf: "center",
tintColor: Module712.colors.INTERACTIVE_TEXT_DEFAULT
},
labelContainer: {
flexDirection: "row",
width: "100%",
marginBottom: 2,
alignItems: "center"
},
authorRow: {
flexShrink: 1,
minWidth: 0,
flexDirection: "row"
},
timestamp: {
marginLeft: 8
},
header: {
flexDirection: "row",
marginRight: 16,
marginBottom: 12
},
body: {
alignItems: "flex-start"
},
pollBadge: {
marginLeft: 8
},
suppressNotificationsIcon: {
marginLeft: 4
},
spoilerText: {
fontStyle: "italic"
}
});
const r61 = Module19.memo(function MessageRow(props) {
let guild_id, stateFromStores2, stateFromStores3;
const { message: message2, onPress, lineClamp, messageSizeCacheRef } = props;
guild_id = void 0;
stateFromStores2 = void 0;
stateFromStores3 = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(message2.channel_id));
guild_id = stateFromStores?.guild_id;
stateFromStores2 = useStateFromStores([FavoriteStore], () => guild_id != null && FavoriteStore.isFavorite(message2.channel_id));
stateFromStores3 = useStateFromStores([UserGuildSettingsStore], () => UserGuildSettingsStore.isChannelMuted(guild_id, message2.channel_id));
const isChannelSpoilerGated = useIsChannelSpoilerGated(stateFromStores);
const callback = useCallback(() => {
onPress({
channelId: message2.channel_id,
messageId: message2.id
});
}, [message2.channel_id, message2.id, onPress]);
const Memo = useMemo(() => stateFromStores?.guild_id == null ? PrivateChannelMessageRowLabel : GuildChannelMessageRowLabel, [stateFromStores?.guild_id]);
const memo2 = useMemo(() => stateFromStores?.guild_id != null ? <GuildChannelMessageRowHeader channel={stateFromStores} muted={stateFromStores3} isFavorite={stateFromStores2} /> : null, [stateFromStores, stateFromStores2, stateFromStores3]);
return stateFromStores == null ? null : <SearchListRow header={memo2} icon={<MessageRowIcon message={message2} channel={stateFromStores} />} label={<Memo message={message2} channel={stateFromStores} muted={stateFromStores3} />} subLabel={isChannelSpoilerGated ? <Text variant="text-sm/normal" color="text-muted" style={styles.spoilerText}>
{intl.string(t["5uaI/7"])}
</Text> : <NativeMessageChannelRowPreview message={message2} channel={stateFromStores} muted={false} layout={ChannelListLayoutTypes.COZY} color="interactive-text-default" lineClamp={lineClamp} messageSizeCacheRef={messageSizeCacheRef} />} onPress={callback} bodyStyle={styles.body} />;
});
export default r61;
@@ -0,0 +1,285 @@
// Metro module 15492 (f15493).
import * as Module19 from "react";
import { useCallback, useEffect, useMemo } from "react";
import { View } from "react-native";
import ChannelStore from "../../../../../../stores/ChannelStore";
import ReadStateStore from "../../../../../../stores/ReadStateStore";
import UserStore from "../../../../../../stores/UserStore";
import { SearchHistoryItemTypes } from "../../../../SearchConstants";
import { createStyles } from "../../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../../_bundle/Module712";
import SearchPlatformActionCreators from "../../../SearchPlatformActionCreators";
import { PressableHighlight } from "../../../../../../design/void/Pressables/native/Pressables";
import { XSmallIcon } from "../../../../../../design/components/Icon/native/redesign/generated/XSmallIcon";
import { useOnPressSearchHistoryText, useOnPressGroupDMItem, useOnPressDMItem, useOnPressGuildVoiceChannel, useOnPressGuildTextChannel } from "../../../hooks/useOnPressSearchItem";
import Tracking from "../../../tracking/Tracking";
import { SearchListRow } from "../SearchListRow";
import { Text } from "../../../../../../design/components/Text/native/Text";
import { MagnifyingGlassIcon } from "../../../../../../design/components/Icon/native/redesign/generated/MagnifyingGlassIcon";
import { useStateFromStores } from "../../../../../../_bundle/defaultAreStatesEqual";
import GroupDMRow from "./GroupDMRow";
import { getUser } from "../../../../../../actions/UserActionCreators";
import ChannelActionCreators from "../../../../../../actions/ChannelActionCreators";
import DMRow from "./DMRow";
import GuildVoiceOrStageChannelRow from "./GuildVoiceOrStageChannelRow";
import GuildTextChannelRow from "./GuildTextChannelRow";
import { intl, t } from "../../../../../../intl/index.native";
function $mk96699($env) {
return (a0) => {
if (a0.nativeEvent.actionName === "remove") {
const r7 = $env;
const r8 = $env.$parent;
(0, r8[1])(r8[2][10]).removeSearchHistoryItem(r7[0], r7[1]);
}
};
}
let SearchHistoryTextRow, SearchHistoryGroupDMRow, SearchHistoryDMRow, SearchHistoryGuildVoiceChannelRow, SearchHistoryGuildTextChannelRow, useStyles, c11025_17;
let $mk96698 = function() {
return () => [{
name: "remove",
label: intl.string(t.Ov3VO7)
}];
};
let env11025 = {};
const SearchHistoryRemoveIcon = function SearchHistoryRemoveIcon(props) {
const { searchContext, searchHistoryItem } = props;
return <PressableHighlight onPress={useCallback(() => {
SearchPlatformActionCreators.removeSearchHistoryItem(searchContext, searchHistoryItem);
}, [searchContext, searchHistoryItem])} accessibilityRole="button" unstable_pressDelay={130} style={{
marginLeft: 16
}} hitSlop={{
bottom: 16,
left: 16,
right: 16,
top: 16
}}>
<XSmallIcon size="sm" color="interactive-text-default" />
</PressableHighlight>;
};
SearchHistoryTextRow = function SearchHistoryTextRow(props) {
const { searchContext: searchContext2, searchHistoryItem: searchHistoryItem2 } = props;
const styles = useStyles();
let c22072_2 = styles;
const onPressSearchHistoryText = useOnPressSearchHistoryText({
searchContext: searchContext2
});
const callback = useCallback(() => {
Tracking.trackSearchHistoryClicked({
searchContext: searchContext2,
searchHistoryItemType: searchHistoryItem2.type
});
onPressSearchHistoryText(searchHistoryItem2.text, searchHistoryItem2.tags);
}, [onPressSearchHistoryText, searchContext2, searchHistoryItem2.tags, searchHistoryItem2.text, searchHistoryItem2.type]);
const tags = searchHistoryItem2.tags;
return <SearchListRow label={<View style={styles.textContainer}>
{tags == null ? void 0 : tags.map((tag) => <View key={tag.text} accessibilityRole="button" style={c22072_2.tag}>
<Text lineClamp={1} variant="text-sm/semibold" color="mobile-text-heading-primary">{tag.text}</Text>
</View>)}
<Text lineClamp={1} variant="text-md/semibold" color="mobile-text-heading-primary" style={styles.text}>{searchHistoryItem2.text}</Text>
</View>} onPress={callback} trailing={<SearchHistoryRemoveIcon searchContext={searchContext2} searchHistoryItem={searchHistoryItem2} />} iconContainerStyle={styles.textIconContainer} icon={<View style={styles.iconContainer}>
<MagnifyingGlassIcon size="sm" color="interactive-text-default" />
</View>} />;
};
SearchHistoryGroupDMRow = function SearchHistoryGroupDMRow(props) {
let onPressGroupDMItem;
let env22074;
const { searchContext: searchContext3, searchHistoryItem: searchHistoryItem3 } = props;
onPressGroupDMItem = void 0;
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(searchHistoryItem3.channelId));
useEffect(() => {
if (stateFromStores == null) {
SearchPlatformActionCreators.removeSearchHistoryItem(searchContext3, searchHistoryItem3);
}
}, [stateFromStores, searchContext3, searchHistoryItem3]);
onPressGroupDMItem = useOnPressGroupDMItem({
searchContext: searchContext3
});
const callback = useCallback((a0) => {
Tracking.trackSearchHistoryClicked({
searchContext: searchContext3,
channelId: a0,
searchHistoryItemType: searchHistoryItem3.type
});
onPressGroupDMItem(a0);
}, [onPressGroupDMItem, searchContext3, searchHistoryItem3.type]);
const r31 = env22074 = {
$parent: env11025
};
env22074[0] = searchContext3;
env22074[1] = searchHistoryItem3;
const memo = useMemo($mk96698(), []);
const callback2 = useCallback($mk96699(r31), [searchContext3, searchHistoryItem3]);
const trailing = <SearchHistoryRemoveIcon searchContext={searchContext3} searchHistoryItem={searchHistoryItem3} />;
return stateFromStores != null ? <GroupDMRow channel={stateFromStores} onPress={callback} accessibilityActions={memo} onAccessibilityAction={callback2} trailing={trailing} /> : null;
};
SearchHistoryDMRow = function SearchHistoryDMRow(props) {
let c22076_0;
let env22077;
let env22075 = {
$parent: env11025
};
const searchContext6 = props.searchContext;
env22075[0] = searchContext6;
const searchHistoryItem6 = props.searchHistoryItem;
env22075[1] = searchHistoryItem6;
env22075[2] = void 0;
const stateFromStores4 = useStateFromStores([UserStore], () => UserStore.getUser(env22075[1].userId));
useEffect(() => {
getUser(env22075[1].userId);
}, [searchHistoryItem6.userId]);
const onPressDMItem = useOnPressDMItem({
searchContext: searchContext6
});
env22075[2] = onPressDMItem;
c22076_0 = void 0;
c22076_0 = async (c30885_0) => {
let c30885_2;
c30885_2 = void 0;
let c31765_0 = c30885_0;
const orEnsurePrivateChannel = await ChannelActionCreators.getOrEnsurePrivateChannel(c30885_0);
const r46 = c30885_2;
let c31765_1 = orEnsurePrivateChannel;
const r53 = r46.$parent;
Tracking.trackSearchHistoryClicked({
searchContext: r53[0],
channelId: c31765_1,
searchHistoryItemType: r53[1].type
});
(0, r53[2])(c31765_0, c31765_1);
};
const callback = useCallback(function() {
return c22076_0.apply(this, arguments);
}, [onPressDMItem, searchContext6, searchHistoryItem6.type]);
const r36 = env22077 = {
$parent: env11025
};
env22077[0] = searchContext6;
env22077[1] = searchHistoryItem6;
const memo = useMemo($mk96698(), []);
const callback2 = useCallback($mk96699(r36), [searchContext6, searchHistoryItem6]);
const trailing = <SearchHistoryRemoveIcon searchContext={searchContext6} searchHistoryItem={searchHistoryItem6} />;
return stateFromStores4 != null ? <DMRow user={stateFromStores4} onPress={callback} accessibilityActions={memo} onAccessibilityAction={callback2} trailing={trailing} /> : null;
};
SearchHistoryGuildVoiceChannelRow = function SearchHistoryGuildVoiceChannelRow(props) {
let onPressGuildVoiceChannel;
const { searchContext: searchContext4, searchHistoryItem: searchHistoryItem4 } = props;
onPressGuildVoiceChannel = void 0;
const stateFromStores2 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(searchHistoryItem4.channelId));
useEffect(() => {
if (stateFromStores2 == null) {
SearchPlatformActionCreators.removeSearchHistoryItem(searchContext4, searchHistoryItem4);
}
}, [stateFromStores2, searchContext4, searchHistoryItem4]);
onPressGuildVoiceChannel = useOnPressGuildVoiceChannel({
searchContext: searchContext4
});
const callback = useCallback((a0) => {
Tracking.trackSearchHistoryClicked({
searchContext: searchContext4,
channelId: a0,
searchHistoryItemType: searchHistoryItem4.type
});
onPressGuildVoiceChannel(a0);
}, [onPressGuildVoiceChannel, searchContext4, searchHistoryItem4.type]);
let r31 = null;
if (stateFromStores2 != null) {
const voiceStates = c11025_17;
r31 = <GuildVoiceOrStageChannelRow channel={stateFromStores2} voiceStates={voiceStates} speakerVoiceStates={voiceStates} trailing={<SearchHistoryRemoveIcon searchContext={searchContext4} searchHistoryItem={searchHistoryItem4} />} onPress={callback} />;
}
return r31;
};
SearchHistoryGuildTextChannelRow = function SearchHistoryGuildTextChannelRow(props) {
let onPressGuildTextChannel;
let env22080;
const { searchContext: searchContext5, searchHistoryItem: searchHistoryItem5 } = props;
onPressGuildTextChannel = void 0;
const stateFromStores3 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(searchHistoryItem5.channelId));
useEffect(() => {
if (stateFromStores3 == null) {
SearchPlatformActionCreators.removeSearchHistoryItem(searchContext5, searchHistoryItem5);
}
}, [stateFromStores3, searchContext5, searchHistoryItem5]);
const stateFromStores4 = useStateFromStores([ReadStateStore], () => {
let r8 = ReadStateStore.lastMessageId(searchHistoryItem5.channelId);
if (r8 == null) {
r8 = stateFromStores3?.lastMessageId;
}
if (r8 == null) {
r8 = null;
}
return r8;
});
onPressGuildTextChannel = useOnPressGuildTextChannel({
searchContext: searchContext5
});
const callback = useCallback((a0) => {
Tracking.trackSearchHistoryClicked({
searchContext: searchContext5,
channelId: a0,
searchHistoryItemType: searchHistoryItem5.type
});
onPressGuildTextChannel(a0);
}, [onPressGuildTextChannel, searchContext5, searchHistoryItem5.type]);
const r38 = env22080 = {
$parent: env11025
};
env22080[0] = searchContext5;
env22080[1] = searchHistoryItem5;
const memo = useMemo($mk96698(), []);
const callback2 = useCallback($mk96699(r38), [searchContext5, searchHistoryItem5]);
const trailing = <SearchHistoryRemoveIcon searchContext={searchContext5} searchHistoryItem={searchHistoryItem5} />;
return stateFromStores3 != null ? <GuildTextChannelRow channel={stateFromStores3} lastMessageId={stateFromStores4} onPress={callback} accessibilityActions={memo} onAccessibilityAction={callback2} trailing={trailing} /> : null;
};
useStyles = createStyles({
iconContainer: {
height: 48,
width: 48,
borderRadius: Module712.radii.xl,
backgroundColor: Module712.colors.INPUT_BACKGROUND_DEFAULT,
alignItems: "center",
justifyContent: "center"
},
text: {
flexShrink: 1
},
textContainer: {
flexDirection: "row",
alignItems: "center",
flexWrap: "wrap",
gap: 2
},
textIconContainer: {
alignSelf: "flex-start"
},
tag: {
paddingHorizontal: 8,
paddingVertical: 4,
borderRadius: Module712.radii.lg,
overflow: "hidden",
margin: 2,
flexDirection: "row",
alignItems: "center",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST
}
});
c11025_17 = [];
const r68 = Module19.memo(function({ searchHistoryItem: searchHistoryItem6, ...props }) {
const type = searchHistoryItem6.type;
if (SearchHistoryItemTypes.GROUP_DM === type) {
return <SearchHistoryGroupDMRow {...props} searchHistoryItem={searchHistoryItem6} />;
}
if (SearchHistoryItemTypes.DM === type) {
return <SearchHistoryDMRow {...props} searchHistoryItem={searchHistoryItem6} />;
}
if (SearchHistoryItemTypes.TEXT === type) {
return <SearchHistoryTextRow {...props} searchHistoryItem={searchHistoryItem6} />;
}
if (SearchHistoryItemTypes.GUILD_TEXT_CHANNEL === type) {
return <SearchHistoryGuildTextChannelRow {...props} searchHistoryItem={searchHistoryItem6} />;
}
if (SearchHistoryItemTypes.GUILD_VOICE_CHANNEL === type) {
return <SearchHistoryGuildVoiceChannelRow {...props} searchHistoryItem={searchHistoryItem6} />;
}
return null;
});
export default r68;
@@ -0,0 +1,25 @@
// Metro module 15487 (f15488).
import { View } from "react-native";
import * as _SearchConstants from "../../../../SearchConstants";
import { createStyles } from "../../../../../../design/components/Styles/native/createStyles";
const { MEDIA_ITEM_GAP_WIDTH, FILES_OR_LINKS_GAP_WIDTH } = _SearchConstants;
const useStyles = createStyles({
filesOrLinksSeparator: {
height: FILES_OR_LINKS_GAP_WIDTH
},
mediaSeparator: {
height: MEDIA_ITEM_GAP_WIDTH
},
messageSeparator: {
height: 4
}
});
export function MessageVerticalSeparator() {
return <View style={useStyles().messageSeparator} />;
}
export function MediaVerticalSeparator() {
return <View style={useStyles().mediaSeparator} />;
}
export function CardVerticalSeparator() {
return <View style={useStyles().filesOrLinksSeparator} />;
}
@@ -0,0 +1,66 @@
// Metro module 15691 (f15692).
import { memo, useEffect } from "react";
import { View } from "react-native";
import { SearchEntrypointAnalyticsLocations } from "../../tracking/TrackingConstants";
import { SearchNavigatorScreens } from "./SearchNavigatorConstants";
import { SearchTypes } from "../../../../../Constants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { createNativeStackNavigator } from "../../../../../_bundle/Module9109";
import { useAccessibilityNativeStackOptions } from "../../../../../design/components/Navigator/native/Navigator.native";
import Tracking from "../../tracking/Tracking";
import useSafeAreaInsets_native from "../../../../safe_area/useSafeAreaInsets.native";
import * as _SearchNavigatorScreen from "./SearchNavigatorScreen";
import { renderHeader, getRenderBackImage } from "../../../../main_tabs_v2/native/shared_components/HeaderShared";
import SearchNavigatorPreviewHeader from "./SearchNavigatorPreviewHeader";
import * as _SearchNavigatorPreviewScreen from "./SearchNavigatorPreviewScreen";
const useStyles = createStyles({
container: {
flex: 1,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST
}
});
const nativeStackNavigator = createNativeStackNavigator();
const r47 = memo(function(a0) {
const searchContext = a0.route.params.searchContext;
const accessibilityNativeStackOptions = useAccessibilityNativeStackOptions();
useEffect(() => {
Tracking.trackSearchOpened({
searchContext,
searchLocation: searchContext.type === SearchTypes.GUILD ? SearchEntrypointAnalyticsLocations.GUILD : SearchEntrypointAnalyticsLocations.DM_LIST
});
return () => {
Tracking.trackSearchClosed({
searchContext
});
};
}, [searchContext]);
const styles = useStyles();
const safeAreaInsets_native = useSafeAreaInsets_native();
return <View style={[styles.container, {
paddingLeft: safeAreaInsets_native.left,
paddingRight: safeAreaInsets_native.right
}]}>
<nativeStackNavigator.Navigator id="search-navigator" screenOptions={{
...accessibilityNativeStackOptions
}}>
<nativeStackNavigator.Screen initialParams={{
searchContext
}} name={SearchNavigatorScreens.SEARCH_TABS} options={{
headerShown: false,
fullScreenGestureEnabled: true
}} getComponent={() => _SearchNavigatorScreen.default} />
<nativeStackNavigator.Screen name={SearchNavigatorScreens.SEARCH_CHAT_PREVIEW} options={(a0) => {
const route = a0.route;
return {
headerShown: true,
header: renderHeader,
headerLeft: getRenderBackImage(a0.navigation),
headerTitle: () => <SearchNavigatorPreviewHeader channelId={route.params.channelId} />,
fullScreenGestureEnabled: true
};
}} getComponent={() => _SearchNavigatorPreviewScreen.default} />
</nativeStackNavigator.Navigator>
</View>;
});
export default r47;
@@ -0,0 +1,6 @@
// Metro module 15481 (f15482).
const r8 = {
SEARCH_TABS: "search_tabs",
SEARCH_CHAT_PREVIEW: "search_chat_preview"
};
export { r8 as SearchNavigatorScreens };
@@ -0,0 +1,19 @@
// Metro module 15687 (f15688).
import { memo } from "react";
import { View } from "react-native";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import ChannelHeader from "../../../../main_tabs_v2/native/channel/header/ChannelHeader";
const useStyles = createStyles({
container: {
flexShrink: 1,
paddingRight: 12,
flexDirection: "row",
alignItems: "center"
}
});
const r29 = memo(function({ channelId }) {
return <View style={useStyles().container}>
<ChannelHeader channelId={channelId} screenIndex="none" pressable={false} isGuildMemberCountVisible={false} isNavigationScreen />
</View>;
});
export default r29;
@@ -0,0 +1,46 @@
// Metro module 15688 (f15689).
import { useCallback } from "react";
import { ScrollView } from "react-native";
import { SearchTypes } from "../../../../../Constants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import { useNavigation } from "../../../../../design/components/Navigator/native/useNavigation.native";
import { useRoute } from "../../../../../_bundle/Module1483";
import Tracking from "../../tracking/Tracking";
import MessagePreview from "../../../../../components_native/common/MessagePreview";
const useStyles = createStyles({
container: {
flex: 1
}
});
export default function SearchNavigatorPreviewScreen() {
const styles = useStyles();
const navigation = useNavigation();
const route = useRoute();
const channelId = route.params.channelId;
const searchContext = route.params.searchContext;
const onBeforeJumpToMessage = route.params.onBeforeJumpToMessage;
const callback = useCallback(() => {
Tracking.trackSearchJumpToMessage({
searchContext,
channelId
});
if (onBeforeJumpToMessage != null) {
onBeforeJumpToMessage();
}
const type = searchContext.type;
if (!(SearchTypes.DMS !== type && (SearchTypes.GUILD !== type && SearchTypes.CHANNEL !== type))) {
const parent = navigation.getParent();
if (parent == null) {
return void 0;
}
parent.goBack();
}
}, [searchContext, channelId, onBeforeJumpToMessage, navigation]);
const type = searchContext.type;
if (SearchTypes.CHANNEL !== type && SearchTypes.GUILD_CHANNEL !== type) {
return <MessagePreview channelId={channelId} onBeforeJumpToMessage={callback} />;
}
return <ScrollView horizontal scrollEnabled={false} bounces={false} contentContainerStyle={styles.container}>
<MessagePreview channelId={channelId} onBeforeJumpToMessage={callback} />
</ScrollView>;
};
@@ -0,0 +1,54 @@
// Metro module 15692 (f15693).
import { useMemo } from "react";
import { View } from "react-native";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { useSearchSuggestionsGesture } from "../layout/autocomplete/useSearchSuggestionsGesture";
import useBaseAppContainerDimensions from "../../../../screen/native/useBaseAppContainerDimensions";
import useSearchLayoutInsetTop from "../../hooks/useSearchLayoutInsetTop";
import { PressableOpacity } from "../../../../../design/void/Pressables/native/Pressables";
import { intl, t } from "../../../../../intl/index.native";
import { ArrowLargeLeftIcon } from "../../../../../design/components/Icon/native/redesign/generated/ArrowLargeLeftIcon";
import ThemedGradient from "../../../../client_themes/native/ThemedGradient";
import { NonCollapsableGestureDetector } from "../../../../gesture_handlers/native/NonCollapsableGestureDetector";
import SearchScreenSearchBar from "../layout/SearchScreenSearchBar";
import SearchScreenLayout from "../layout/SearchScreenLayout";
const useStyles = createStyles({
wrapper: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
flex: 1
},
tabs: {
flex: 1,
marginTop: Module712.space.PX_16
},
back: {
marginLeft: Module712.space.PX_16,
marginRight: Module712.space.PX_12
}
});
export default function SearchNavigatorScreen(props) {
const navigation = props.navigation;
const searchContext = props.route.params.searchContext;
const styles = useStyles();
const searchSuggestionsGesture = useSearchSuggestionsGesture(searchContext);
const { gesture, dismissed, setDismissed, onLayoutMeasure } = searchSuggestionsGesture;
const width = useBaseAppContainerDimensions().width;
return <>
<ThemedGradient absolute wide tall />
<NonCollapsableGestureDetector gesture={gesture}>
<View style={[styles.wrapper, {
paddingTop: useSearchLayoutInsetTop()
}]}>
<SearchScreenSearchBar searchContext={searchContext} suggestionsDismissed={dismissed} setSuggestionsDismissed={setDismissed} onSuggestionsLayoutMesure={onLayoutMeasure} backButton={useMemo(() => <View>
<PressableOpacity style={styles.back} accessibilityLabel={intl.string(t["13/7kX"])} accessibilityRole="button" onPress={navigation.goBack}>
<ArrowLargeLeftIcon color={Module712.colors.INTERACTIVE_TEXT_DEFAULT} />
</PressableOpacity>
</View>, [navigation.goBack, styles.back])} />
<View style={styles.tabs}>
<SearchScreenLayout searchContext={searchContext} width={width} />
</View>
</View>
</NonCollapsableGestureDetector>
</>;
};
@@ -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;
}