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,37 @@
// Metro module 15825 (f15826).
import * as _Module21 from "react/jsx-runtime";
import { PortalKeyboardRenderer } from "../../keyboard/native/PortalKeyboardRenderer";
import { isIOS, isAndroid } from "../../../utils/PlatformUtils";
import { useIsModalOpen } from "../helpers/NavigationRouteUtils.native";
import AppFreezer from "../../panels/morphable/native/AppFreezer";
import { PictureInPictureGlobalContainer, BurstReactionAnimationContainer, MenuContainer, ActionSheetContainer, Alerts, SoundPlayer, ToastContainer } from "../../../components_native/MainShared";
import { PortalKeyboardHost } from "../../keyboard/native/PortalKeyboard";
import MainViewTooltipActionSheetsV2 from "../../upsell_tooltip/native/MainViewTooltipActionSheetsV2";
import Notifications from "../../../components_native/common/Notifications";
import { ContextMenuContainer } from "../../../design/components/ContextMenu/native/ContextMenuContainer.native";
import { AlertModalContainer } from "../../../design/components/AlertModal/native/AlertModal.native";
import { AccessibilityAnnouncerLiveRegion } from "../../../_bundle/Module3903";
import ExternalPipView_android from "../../external_pip/ExternalPipView.android";
import ActivityPanelContainer from "../../activities/panel/native/ActivityPanelContainer";
import FramePanelContainer from "../../frames/panel/native/FramePanelContainer";
import VoicePanelContainer from "../../voice_panel/native/VoicePanelContainer";
import MediaPlaybackPanelContainer from "../../media_panel/native/MediaPlaybackPanelContainer";
const { jsx, jsxs } = _Module21;
let c11319_2 = jsx(PortalKeyboardRenderer, {});
const r28 = isIOS() ? () => useIsModalOpen() ? null : c11319_2 : () => c11319_2;
const r93 = jsxs(AppFreezer, {
lockKeys: ["external-pip"],
children: [jsx(PictureInPictureGlobalContainer, {}), jsx(BurstReactionAnimationContainer, {}), jsx(MenuContainer, {}), jsx(PortalKeyboardHost, {}), jsx(r28, {}), jsx(ActionSheetContainer, {
appEntryKey: "main"
}), jsx(Alerts, {}), jsx(SoundPlayer, {}), jsx(MainViewTooltipActionSheetsV2, {}), jsx(Notifications, {}), jsx(ContextMenuContainer, {}), jsx(AlertModalContainer, {}), jsx(ToastContainer, {})]
});
const r98 = isAndroid() ? jsx(AccessibilityAnnouncerLiveRegion, {}) : null;
const r106 = jsx(ExternalPipView_android, {});
const r126 = jsxs(AppFreezer, {
lockKeys: ["external-pip"],
children: [jsx(ActivityPanelContainer, {}), jsx(FramePanelContainer, {}), jsx(VoicePanelContainer, {}), jsx(MediaPlaybackPanelContainer, {})]
});
export { r93 as APP_EXTRA_COMPONENTS };
export { r98 as APP_EXTRA_COMPONENTS_NEVER_FREEZE };
export { r106 as APP_EXTRA_COMPONENTS_EXTERNAL_PIP };
export { r126 as APP_EXTRA_COMPONENTS_VOICE_AND_VIDEO };
@@ -0,0 +1,214 @@
// Metro module 15266 (f15267).
import { useMemo, useState, useEffect, useRef } from "react";
import { ActivityIndicator, View } from "react-native";
import ConnectivityIndicatorStateStore, { ConnectivityIndicatorState } from "../../connectivity/native/ConnectivityIndicatorStateStore";
import { CONNECTION_BANNER_HEIGHT, YOU_BAR_SPRING_CONFIG } from "./you_bar/YouBarConstants";
import { AnalyticEvents } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { intl, t } from "../../../intl/index.native";
import { useToken } from "../../../design/tokens/native/useToken";
import { ConnectionUnknownIcon } from "../../../design/components/Icon/native/redesign/generated/ConnectionUnknownIcon";
import { ConnectionFineIcon } from "../../../design/components/Icon/native/redesign/generated/ConnectionFineIcon";
import { Text } from "../../../design/components/Text/native/Text";
import Module689 from "../../../_bundle/Module689";
import * as _ReanimatedRexport from "../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useSharedValue, useAnimatedStyle } from "../../reanimated/ReanimatedRexport";
import Module5165 from "../../../_bundle/Module5165";
import Module4611 from "../../../_bundle/Module4611";
import { useStateFromStores } from "../../../_bundle/Module589";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { useYouBarBottomMargin } from "./you_bar/hooks/useYouBarMargins";
import { withSpring } from "../../../design/animation/reanimated/spring/spring";
import ConnectionIndicatorExperiment from "./ConnectionIndicatorExperiment";
let _excluded, locations, start, end, locations2, start2, end2, useStyles, ConnectionBannerContent, BackOnlineGlow, __initData, __initData2, ConnectionBannerInner;
const ConnectionBannerIcon = function ConnectionBannerIcon(props) {
const state = props.state;
const styles = useStyles();
const token2 = useToken(Module712.colors.INTERACTIVE_ICON_DEFAULT);
if (ConnectivityIndicatorState.WAITING_FOR_NETWORK === state) {
return <View style={styles.leadingSlot}>
<ActivityIndicator size="small" color={token2} style={styles.spinner} />
</View>;
}
if (ConnectivityIndicatorState.NO_CONNECTION === state) {
return <View style={styles.leadingSlot}>
<ConnectionUnknownIcon size="xs" color={Module712.colors.INTERACTIVE_ICON_DEFAULT} />
</View>;
}
if (ConnectivityIndicatorState.BACK_ONLINE === state) {
return <View style={styles.leadingSlot}>
<ConnectionFineIcon size="xs" color={Module712.colors.ICON_FEEDBACK_POSITIVE} />
</View>;
}
};
ConnectionBannerContent = function ConnectionBannerContent(props) {
const state = props.state;
return <View style={useStyles().content}>
<ConnectionBannerIcon state={state} />
<Text variant="text-sm/medium" color={state === ConnectivityIndicatorState.BACK_ONLINE ? "text-feedback-positive" : "text-muted"} maxFontSizeMultiplier={1.5}>
{ConnectivityIndicatorState.WAITING_FOR_NETWORK === state ? intl.string(t.XKk1gp) : ConnectivityIndicatorState.NO_CONNECTION === state ? intl.string(t.zPerw8) : ConnectivityIndicatorState.BACK_ONLINE === state ? intl.string(t.j8lYE2) : void 0}
</Text>
</View>;
};
BackOnlineGlow = function BackOnlineGlow(props) {
const progress = props.progress;
const styles = useStyles();
const token = useToken(Module712.colors.ICON_FEEDBACK_POSITIVE);
return <ReanimatedRexport.View style={[styles.glow, {
opacity: progress
}]} pointerEvents="none">
<Module5165 style={styles.glow} maskElement={<Module4611 style={styles.glowMaskGradient} colors={_excluded} locations={locations} start={start} end={end} />}>
<Module4611 style={styles.glowMaskGradient} colors={useMemo(() => {
const r4 = Module689(token);
return [r4.alpha(0).css(), r4.alpha(0.1).css(), r4.alpha(0.28).css(), r4.alpha(0.55).css()];
}, [token])} locations={locations2} start={start2} end={end2} />
</Module5165>
</ReanimatedRexport.View>;
};
ConnectionBannerInner = function ConnectionBannerInner() {
let shouldShowBanner, c21829_1, sharedValue, sharedValue2;
const styles = useStyles();
const youBarBottomMargin = useYouBarBottomMargin();
const stateFromStores2 = useStateFromStores([ConnectivityIndicatorStateStore], () => ConnectivityIndicatorStateStore.getState());
shouldShowBanner = stateFromStores2 !== ConnectivityIndicatorState.HIDDEN;
const r4 = stateFromStores2 === ConnectivityIndicatorState.BACK_ONLINE;
c21829_1 = r4;
const r33 = stateFromStores2 !== ConnectivityIndicatorState.HIDDEN ? stateFromStores2 : null;
sharedValue = useSharedValue(0);
const [state, setState] = useState(r33);
sharedValue2 = useSharedValue(0);
if (r33 != null && state !== r33) {
setState(r33);
}
useEffect(() => {
const r0 = shouldShowBanner ? 1 : 0;
const n = function n(a0) {
if (!(a0 !== true || shouldShowBanner)) {
_ReanimatedRexport.runOnJS(setState)(null);
}
};
n.__closure = {
shouldShowBanner,
runOnJS: _ReanimatedRexport.runOnJS,
setRenderState: setState
};
n.__workletHash = 3065113239920;
n.__initData = __initData;
sharedValue2.set(withSpring(r0, YOU_BAR_SPRING_CONFIG, "respect-motion-settings", n));
}, [shouldShowBanner, sharedValue2]);
useEffect(() => {
sharedValue.set(withSpring(c21829_1 ? 1 : 0, YOU_BAR_SPRING_CONFIG));
}, [r4, sharedValue]);
const A = () => ({
transform: [{
translateY: (1 - sharedValue2.get()) * CONNECTION_BANNER_HEIGHT
}],
opacity: sharedValue2.get()
});
A.__closure = {
progress: sharedValue2,
CONNECTION_BANNER_HEIGHT
};
A.__workletHash = 13973493587548;
A.__initData = __initData2;
return <ReanimatedRexport.View pointerEvents="none" style={[styles.container, {
height: youBarBottomMargin + CONNECTION_BANNER_HEIGHT
}, useAnimatedStyle(A)]}>
{state === ConnectivityIndicatorState.BACK_ONLINE ? <BackOnlineGlow progress={sharedValue} /> : null}
{state != null ? <ConnectionBannerContent state={state} /> : null}
</ReanimatedRexport.View>;
};
_excluded = ["transparent", "black", "black", "transparent"];
locations = [0, 0.25, 0.75, 1];
start = {
x: 0,
y: 0.5
};
end = {
x: 1,
y: 0.5
};
locations2 = [0, 0.4, 0.75, 1];
start2 = {
x: 0,
y: 0
};
end2 = {
x: 0,
y: 1
};
useStyles = createStyles({
container: {
position: "absolute",
left: 0,
right: 0,
bottom: 0
},
glow: {
position: "absolute",
top: 0,
bottom: 0,
left: 0,
right: 0
},
glowMaskGradient: {
flex: 1
},
content: {
position: "absolute",
top: 0,
left: 0,
right: 0,
height: CONNECTION_BANNER_HEIGHT,
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
gap: Module712.space.PX_8,
paddingHorizontal: Module712.space.PX_12
},
leadingSlot: {
width: 16,
height: 16,
alignItems: "center",
justifyContent: "center"
},
spinner: {
transform: [{
scale: 0.8
}]
}
});
__initData = {
code: "function ConnectionBannerTsx1(finished){const{shouldShowBanner,runOnJS,setRenderState}=this.__closure;if(finished===true&&!shouldShowBanner){runOnJS(setRenderState)(null);}}"
};
__initData2 = {
code: "function ConnectionBannerTsx2(){const{progress,CONNECTION_BANNER_HEIGHT}=this.__closure;return{transform:[{translateY:(1-progress.get())*CONNECTION_BANNER_HEIGHT}],opacity:progress.get()};}"
};
export default function ConnectionBanner() {
let ref;
const config = ConnectionIndicatorExperiment.useConfig({
location: "ConnectionBanner"
});
const { timeoutMs, hidden } = config;
ref = void 0;
const stateFromStores = useStateFromStores([ConnectivityIndicatorStateStore], () => ConnectivityIndicatorStateStore.getState());
ref = useRef(null);
useEffect(() => {
L10: {
const current = ref.current;
ref.current = stateFromStores;
if (current != null) {
if (current !== ConnectivityIndicatorState.HIDDEN && current !== ConnectivityIndicatorState.BACK_ONLINE) {
break L10;
}
if (stateFromStores !== ConnectivityIndicatorState.HIDDEN && stateFromStores !== ConnectivityIndicatorState.BACK_ONLINE) {
AnalyticsUtils.track(AnalyticEvents.CONNECTION_INDICATOR_SHOWN, {
connection_indicator_type: hidden ? "hidden" : stateFromStores === ConnectivityIndicatorState.NO_CONNECTION ? "offline" : "connecting"
});
}
}
}
}, [stateFromStores, hidden]);
return timeoutMs == null ? null : hidden ? null : <ConnectionBannerInner />;
};
@@ -0,0 +1,29 @@
// Metro module 12741 (f12742).
import { createApexExperiment } from "../../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2025-12-connection-indicator",
kind: "user",
defaultConfig: {
timeoutMs: void 0,
hidden: true
},
variations: {
1: {
timeoutMs: 10000,
hidden: false
},
2: {
timeoutMs: 15000,
hidden: false
},
3: {
timeoutMs: 20000,
hidden: false
},
4: {
timeoutMs: 10000,
hidden: true
}
}
});
export default apexExperiment;
@@ -0,0 +1,15 @@
// Metro module 15400 (f15401).
import { createApexExperiment } from "../../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2026-04-hide-covered-channels",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
export default apexExperiment;
@@ -0,0 +1,294 @@
// Metro module 14855 (f14856).
import { memo, useState, useMemo } from "react";
import { View } from "react-native";
import AuthenticationStore from "../../../stores/AuthenticationStore";
import { StackNavigationAnimationSettings } from "./NavigationConstants";
import { AnalyticEvents, DrawerSourceTypes } from "../../../Constants";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { isIOS, isAndroid } from "../../../utils/PlatformUtils";
import { getSystemVersionMajor, isIpadOS } from "../../../utils/native/DeviceUtils";
import createAccessibleNativeStackNavigator_native from "../../../design/components/Navigator/native/createAccessibleNativeStackNavigator.native";
import createChatPanelNativeStackNavigator from "./panels/createChatPanelNativeStackNavigator";
import * as _Auth from "../../auth/native/components/Auth";
import * as _MainTabs from "./MainTabs";
import * as _AutoAnalytics from "../../../components_native/AutoAnalytics";
import * as _MemberVerificationScreen from "../../guild_member_verification/native/components/MemberVerificationScreen";
import * as _FriendsNavigator from "./friends/FriendsNavigator";
import * as _YouScreenContainer from "./tabs/you/YouScreenContainer";
import * as _ChannelDetailsNavigator from "./sidebar/details/ChannelDetailsNavigator";
import * as _ConversationNavigator from "../../conversations/components/native/ConversationNavigator";
import * as _SearchNavigator from "../../search/native/components/navigator/SearchNavigator";
import * as _ContextMenuCommandNavigator from "../../application_commands/native/ContextMenuCommandNavigator";
import * as _ModalScreen from "./modal/ModalScreen";
import * as _MessageRequestsNavigator from "./message_requests/MessageRequestsNavigator";
import * as _Settings from "./tabs/settings/Settings";
import * as _SuspendedUserPage from "../../safety_hub/native/SuspendedUserPage";
import { getBestActiveInput } from "../../../utils/native/ChatInputUtils";
import { setKeyboardType } from "../../keyboard/native/KeyboardUIStore.native";
import { KeyboardTypes } from "../../keyboard/native/KeyboardTypes";
import AppAnalyticsUtils from "../../app_analytics/AppAnalyticsUtils";
import { getDefaultStackHeaderProps } from "./shared_components/HeaderShared";
import { useScreenReaderEnabled, useAppKeyCommands } from "../../../components_native/MainShared";
import useNativeThemeUpdater from "../../themes/native/useNativeThemeUpdater";
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
import { useHomeIndicatorStore } from "../../voice_panel/native/HomeIndicator";
import useChatLayout from "../../chat/native/useChatLayout";
import { useAccessibilityNativeStackOptions } from "../../../design/components/Navigator/native/Navigator.native";
import StartupProfiler, { Profiles } from "../../app_startup/StartupProfiler";
import VisualEffectViewTarget from "../../visual_effect_view/native/VisualEffectViewTarget";
import LaunchPadContainer from "../../launchpad/native/LaunchPadContainer";
import ParentalConsentWarningBanner from "../../parent_tools/native/ParentalConsentWarningBanner";
import GlobalStatusIndicator from "../../connectivity/native/components/GlobalStatusIndicator";
import { APP_EXTRA_COMPONENTS_VOICE_AND_VIDEO, APP_EXTRA_COMPONENTS, APP_EXTRA_COMPONENTS_NEVER_FREEZE, APP_EXTRA_COMPONENTS_EXTERNAL_PIP } from "./AppComponents";
import getNavigationModalPresentation from "./utils/getNavigationModalPresentation";
import { HermesBuiltin } from "../../../_hermes/prelude";
function $mk94629($env) {
return ({ navigation, route }) => {
const r2 = $env.$parent;
const r4 = r2[0];
const r3 = r2[2];
return {
headerShown: true,
header: r4(r3[30]).renderHeader,
...r4(r3[30]).getDefaultChannelStackHeaderProps(navigation, route),
...r2[7],
animation: $env[0]
};
};
}
let getTabsComponent, getChannelComponent, WrappedAutoAnalytics, getMemberVerificationComponent, getFriendsNavigatorComponent, getYouComponent, getChannelDetailsComponent, getConversationsComponent, getSearchComponent, getContextMenuCommandNavigatorComponent, getModalComponent, getMessageRequestsComponent, getSettingsComponent, getAccountStanding, c10496_13, useStyles, c10496_15, Component2, Component, c10496_30;
let $mk94628 = function() {
return (a0) => {
if (getBestActiveInput() != null) {
setKeyboardType({
type: KeyboardTypes.SYSTEM
});
}
const data = a0.data;
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.CHANNEL_BACK_NAVIGATED, {
source: (data == null ? void 0 : data.action?.type) === "GO_BACK" ? DrawerSourceTypes.BACK_BUTTON : DrawerSourceTypes.SWIPE
});
};
};
let env10496 = {};
const getAuthComponent = function getAuthComponent() {
return _Auth.default;
};
getTabsComponent = function getTabsComponent() {
return _MainTabs.default;
};
getChannelComponent = function getChannelComponent() {
return View;
};
WrappedAutoAnalytics = function WrappedAutoAnalytics() {
return (0, jsx)(_AutoAnalytics.default, {});
};
getMemberVerificationComponent = function getMemberVerificationComponent() {
return _MemberVerificationScreen.default;
};
getFriendsNavigatorComponent = function getFriendsNavigatorComponent() {
return _FriendsNavigator.default;
};
getYouComponent = function getYouComponent() {
return _YouScreenContainer.default;
};
getChannelDetailsComponent = function getChannelDetailsComponent() {
return _ChannelDetailsNavigator.default;
};
getConversationsComponent = function getConversationsComponent() {
return _ConversationNavigator.default;
};
getSearchComponent = function getSearchComponent() {
return _SearchNavigator.default;
};
getContextMenuCommandNavigatorComponent = function getContextMenuCommandNavigatorComponent() {
return _ContextMenuCommandNavigator.default;
};
getModalComponent = function getModalComponent() {
return _ModalScreen.default;
};
getMessageRequestsComponent = function getMessageRequestsComponent() {
return _MessageRequestsNavigator.default;
};
getSettingsComponent = function getSettingsComponent() {
return _Settings.default;
};
getAccountStanding = function getAccountStanding() {
return _SuspendedUserPage.default;
};
c10496_13 = "mainNavigator";
useStyles = createStyles({
flex: {
flex: 1
}
});
const r61 = isIOS() && getSystemVersionMajor() <= 15;
export function getChannelScreen(r1 = StackNavigationAnimationSettings.animation) {
let env21402;
const r5 = env21402 = {
$parent: env10496
};
env21402[0] = r1;
return (0, jsx)(Component.Screen, {
name: "channel",
listeners: {
beforeRemove: $mk94628()
},
options: $mk94629(r5),
getComponent: getChannelComponent
});
}
c10496_15 = r61;
Component2 = createAccessibleNativeStackNavigator_native();
Component = createChatPanelNativeStackNavigator();
c10496_30 = Object.freeze({
animation: "none"
});
const r79 = memo(function StackNavigator() {
let homeIndicatorStore, isChatBesideChannelList, accessibilityNativeStackOptions;
const styles = useStyles();
let c21403_0 = styles;
useScreenReaderEnabled();
useAppKeyCommands();
useNativeThemeUpdater();
const stateFromStores = useStateFromStores([AuthenticationStore], () => AuthenticationStore.getSessionId() != null);
const [state, setState] = useState(StackNavigationAnimationSettings.animation);
homeIndicatorStore = useHomeIndicatorStore((a0) => a0.autoHideHomeIndicator);
isChatBesideChannelList = useChatLayout().isChatBesideChannelList;
accessibilityNativeStackOptions = useAccessibilityNativeStackOptions();
return useMemo(() => {
const r43 = [stateFromStores ? <WrappedAutoAnalytics /> : null, ,];
const { Navigator, Screen } = Component2;
const options2 = c10496_30;
r43[1] = <StartupProfiler profile={Profiles.StackNavigator}>
<Navigator id="root" screenOptions={() => ({
headerShown: false,
autoHideHomeIndicator: homeIndicatorStore
})}>
<Screen name="main" options={options2}>
{() => {
const r7 = env10496;
const Navigator = Component.Navigator;
const children2 = [<Component.Screen name="tabs" getComponent={getTabsComponent} options={c10496_30} />, <Component.Screen name="member-verification" getComponent={getMemberVerificationComponent} options={{
presentation: "transparentModal",
animation: "slide_from_bottom"
}} />, ,];
let r25 = accessibilityNativeStackOptions?.animation;
if (r25 == null) {
r25 = state;
}
if (r25 === void 0) {
r25 = StackNavigationAnimationSettings.animation;
}
let env30792;
const r27 = env30792 = {
$parent: r7
};
env30792[0] = r25;
children2[2] = <Component.Screen name="channel" listeners={{
beforeRemove: $mk94628()
}} options={$mk94629(r27)} getComponent={getChannelComponent} />;
return <>
<Navigator id="tabs" screenOptions={(a0) => ({
orientation: c10496_15 ? "default" : void 0,
headerShown: false,
...getDefaultStackHeaderProps(a0.navigation),
...StackNavigationAnimationSettings
})}>{children2}</Navigator>
{APP_EXTRA_COMPONENTS_VOICE_AND_VIDEO}
</>;
}}
</Screen>
<Component2.Screen name="search" getComponent={getSearchComponent} />
<Component2.Screen name="conversations" getComponent={getConversationsComponent} options={() => getNavigationModalPresentation()} />
<Component2.Screen name="auth" getComponent={getAuthComponent} options={options2} />
<Component2.Screen name="account-standing" getComponent={getAccountStanding} options={{
presentation: "fullScreenModal",
gestureEnabled: false,
...options2
}} />
<Component2.Screen name="you" options={() => ({
...getNavigationModalPresentation(isIpadOS() ? {
presentation: "modal"
} : isAndroid() ? isChatBesideChannelList ? {
presentation: "transparentModal"
} : void 0 : void 0),
contentStyle: isAndroid() ? isChatBesideChannelList ? {
backgroundColor: "transparent"
} : void 0 : void 0,
animation: "slide_from_bottom"
})} getComponent={getYouComponent} />
<Component2.Screen name="friends" options={({ route }) => {
const params = route.params;
let presentation = params == null ? void 0 : params.params?.presentation;
if (presentation == null) {
presentation = "modal";
}
const r16 = {
...getNavigationModalPresentation({
presentation
})
};
const params2 = route.params;
r16.fullScreenGestureEnabled = (params2 == null ? void 0 : params2.params?.presentation) === "card";
return r16;
}} listeners={{
beforeRemove: isAndroid() ? void 0 : () => {
setState("none");
setTimeout(() => setState(StackNavigationAnimationSettings.animation), StackNavigationAnimationSettings.duration);
}
}} getComponent={getFriendsNavigatorComponent} />
<Component2.Screen name="settings" options={() => ({
...getNavigationModalPresentation(isIpadOS() ? {
presentation: "modal"
} : void 0),
animation: "slide_from_bottom",
fullScreenGestureEnabled: true
})} getComponent={getSettingsComponent} />
<Component2.Screen name="sidebar" getComponent={getChannelDetailsComponent} options={() => getNavigationModalPresentation({
lockOrientation: false
})} />
<Component2.Screen name="message-requests" options={getNavigationModalPresentation()} getComponent={getMessageRequestsComponent} />
<Component2.Screen name="context-menu-commands" options={getNavigationModalPresentation()} getComponent={getContextMenuCommandNavigatorComponent} />
<Component2.Screen name="modal" options={({ route }) => {
let animation = route.params.animation;
if (animation == null) {
animation = "slide_from_bottom";
}
const r12 = {
fullScreenGestureEnabled: route.params.fullScreenGestureEnabled,
animation
};
const presentation = route.params.presentation;
let presentation3 = "transparentModal";
if (presentation !== "card") {
let presentation2 = route.params.presentation;
if (presentation2 == null) {
presentation2 = "transparentModal";
}
presentation3 = presentation2;
}
HermesBuiltin.copyDataProperties(r12, getNavigationModalPresentation({
presentation: presentation3
}));
return r12;
}} getComponent={getModalComponent} />
</Navigator>
</StartupProfiler>;
return <StartupProfiler profile={Profiles.MainNavigator}>
<VisualEffectViewTarget style={c21403_0.flex} nativeID={c10496_13} collapsableChildren={false}>
<LaunchPadContainer>
<ParentalConsentWarningBanner>
<GlobalStatusIndicator>{r43}</GlobalStatusIndicator>
</ParentalConsentWarningBanner>
</LaunchPadContainer>
{APP_EXTRA_COMPONENTS}
{APP_EXTRA_COMPONENTS_NEVER_FREEZE}
{APP_EXTRA_COMPONENTS_EXTERNAL_PIP}
</VisualEffectViewTarget>
</StartupProfiler>;
}, [styles, stateFromStores, homeIndicatorStore, accessibilityNativeStackOptions, state, isChatBesideChannelList]);
});
export default r79;
export const MAIN_NAVIGATOR_ID = "mainNavigator";
+31
View File
@@ -0,0 +1,31 @@
// Metro module 14916 (f14917).
import { memo } from "react";
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import useColorThemeBackground from "../../client_themes/native/useColorThemeBackground";
import { useIsCustomThemeActive } from "../../client_themes/native/useActiveTheme";
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
import { ThemeContextProvider } from "../../../_bundle/Module3901";
import ThemedGradient from "../../client_themes/native/ThemedGradient";
import MainTabsNavigatorPanel from "./panels/MainTabsNavigatorPanel";
const useStyles = createStyles({
container: {
flex: 1
}
});
const r30 = memo(function MainTabs() {
const colorThemeBackground = useColorThemeBackground();
const isCustomThemeActive = useIsCustomThemeActive();
const styles = useStyles();
const safeAreaInsets_native = useSafeAreaInsets_native();
return <View style={[styles.container, {
marginLeft: safeAreaInsets_native.left,
marginRight: safeAreaInsets_native.right
}]}>
<ThemeContextProvider gradient={colorThemeBackground}>
<ThemedGradient absolute mix={isCustomThemeActive} />
<MainTabsNavigatorPanel />
</ThemeContextProvider>
</View>;
});
export default r30;
@@ -0,0 +1,17 @@
// Metro module 8767 (f8768).
const r9 = {
GUILDS: "guilds",
ICYMI: "icymi",
NOTIFICATIONS: "notifications"
};
const r13 = {
YOU: "you",
SETTINGS: "settings"
};
export const MODE_CHANGE_PHYSICS = {
mass: 0.5,
damping: 30,
stiffness: 320
};
export { r9 as YouBarNavigatorScreens };
export { r13 as RootNavigatorScreen };
@@ -0,0 +1,6 @@
// Metro module 14856 (f14857).
export const StackNavigationAnimationSettings = {
animation: "simple_push",
duration: 250,
fullScreenGestureEnabled: true
};
@@ -0,0 +1,178 @@
// Metro module 10254 (f10255).
import ChannelStore from "../../../stores/ChannelStore";
import Module589 from "../../../_bundle/Module589";
import Dispatcher from "../../../Dispatcher";
import { getRootNavigationRef } from "../RootNavigationRef.native";
import { coerceChannelRoute, coerceGuildsRoute } from "../helpers/NavigationRouteUtils.native";
import { getChatLayout } from "../../chat/native/useChatLayout";
function $mk84264($env) {
return (a0) => a0 !== $env[0];
}
function $mk84265($env) {
return (a0) => a0 !== $env[0];
}
let c6843_3, c6843_4, c6843_5, history2, c6843_7, removeHistoryItem, c6843_10;
const getIdFromHistoryItem = function getIdFromHistoryItem(item) {
return item.replace(c6843_5, "");
};
removeHistoryItem = function removeHistoryItem(item) {
let env17807;
const r2 = env17807 = {};
env17807[0] = item;
let r8 = !!c6843_7.delete(item);
if (r8) {
history2 = history2.filter($mk84264(r2));
r8 = true;
}
return r8;
};
const handleChannelDelete = function handleChannelDelete(a0) {
let env17808;
const r11 = `${c6843_3}${a0.channel.id}`;
const r12 = env17808 = {};
env17808[0] = r11;
let r16 = !!c6843_7.delete(r11);
if (r16) {
history2 = history2.filter($mk84264(r12));
r16 = true;
}
return r16;
};
c6843_3 = "channel-";
c6843_4 = "guild-";
c6843_5 = new RegExp(`^(?:channel-|guild-)`);
history2 = [];
c6843_7 = new Map();
class NavigationHistoryStore extends Module589.PersistedStore {
static displayName = "NavigationHistoryStore";
static persistKey = "NavigationHistoryStore";
initialize(a0) {
this.waitFor(ChannelStore);
c6843_7.clear();
let r25 = a0?.history;
if (r25 == null) {
r25 = [];
}
for (const item of r25) {
c6843_7.set(item, void 0);
}
history2 = Array.from(c6843_7.keys());
}
getState() {
return {
history: history2
};
}
getLastHistory(r4 = 1) {
return history2[history2.length - r4];
}
getLastFocusedTimestampForHistoryItem(a0) {
return c6843_7.get(a0);
}
}
c6843_10 = new NavigationHistoryStore(Dispatcher, {
LOGOUT: () => {
history2 = [];
c6843_7.clear();
},
CHANNEL_DELETE: handleChannelDelete,
THREAD_DELETE: handleChannelDelete,
GUILD_DELETE: function handleGuildDelete({ guild }) {
if (guild.unavailable === true) {
return false;
}
let r33 = removeHistoryItem(`${c6843_4}${guild.id}`);
const r34 = [...history2];
for (const item of r34) {
if (item.startsWith(c6843_3)) {
const basicChannel = ChannelStore.getBasicChannel(getIdFromHistoryItem(item));
if (!(basicChannel != null && basicChannel.guild_id !== guild.id) && removeHistoryItem(item)) {
r33 = true;
}
}
}
return r33;
}
});
export default c6843_10;
export const CHANNEL_PREFIX = "channel-";
export const GUILD_PREFIX = "guild-";
export { getIdFromHistoryItem };
export function handleHistoryStoreNavigationChange() {
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null) {
const currentRoute = rootNavigationRef.getCurrentRoute();
if (currentRoute != null && currentRoute.params != null) {
const r22 = coerceChannelRoute(currentRoute);
if (r22 == null) {
const r60 = coerceGuildsRoute(currentRoute);
if (r60 != null) {
if (getChatLayout().isChatLockedOpen) {
const channelId = r60.params?.channelId;
if (channelId != null) {
let env17811;
const r114 = `${c6843_3}${channelId}`;
const r115 = env17811 = {};
env17811[0] = r114;
const r120 = history2[history2.length - 1];
if (c6843_7.has(r114)) {
history2 = history2.filter($mk84265(r115));
}
if (r120 != null) {
c6843_7.set(r120, Date.now());
}
c6843_7.set(r114, void 0);
history2.push(r114);
if (history2.length > 100) {
history2.shift();
}
c6843_10.emitChange();
return void 0;
}
}
const guildId = r60.params?.guildId;
if (guildId != null) {
let env17810;
const r76 = `${c6843_4}${guildId}`;
const r77 = env17810 = {};
env17810[0] = r76;
const r82 = history2[history2.length - 1];
if (c6843_7.has(r76)) {
history2 = history2.filter($mk84265(r77));
}
if (r82 != null) {
c6843_7.set(r82, Date.now());
}
c6843_7.set(r76, void 0);
history2.push(r76);
if (history2.length > 100) {
history2.shift();
}
c6843_10.emitChange();
}
}
} else {
let env17809;
const r27 = `${c6843_3}${r22.params.channelId}`;
const r28 = env17809 = {};
env17809[0] = r27;
const r32 = history2[history2.length - 1];
if (c6843_7.has(r27)) {
history2 = history2.filter($mk84265(r28));
}
if (r32 != null) {
c6843_7.set(r32, Date.now());
}
c6843_7.set(r27, void 0);
history2.push(r27);
if (history2.length > 100) {
history2.shift();
}
c6843_10.emitChange();
}
}
}
}
export function getNavigationHistory() {
return history2;
}
@@ -0,0 +1,247 @@
// Metro module 9127 (f9128).
import { createElement } from "react";
import { View } from "react-native";
import ActiveThreadsStore from "../../../threads/ActiveThreadsStore";
import { THREADED_CHANNEL_TYPES } from "../../../../records/ChannelRecord";
import ChannelStore from "../../../../stores/ChannelStore";
import VoiceStateStore from "../../../../stores/VoiceStateStore";
import { setIsChannelDetailsSearchActive } from "../sidebar/details/stores/ChannelDetailsStore";
import { ChannelTypes, ChannelTypesSets, ComponentActions } from "../../../../Constants";
import { SearchEntrypointAnalyticsLocations } from "../../../search/native/tracking/TrackingConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { PhoneCallIcon } from "../../../../design/components/Icon/native/redesign/generated/PhoneCallIcon";
import Module712 from "../../../../_bundle/Module712";
import { PhoneHangUpIcon } from "../../../../design/components/Icon/native/redesign/generated/PhoneHangUpIcon";
import useIsNsfwGated from "../../../age_gate/useIsNsfwGated";
import { useCanSearchForumPosts, useHasForumSearchQuery } from "../../../forums/ForumHooks";
import useIsWindowSmall from "../../../screen/native/useIsWindowSmall";
import { useStateFromStores, useStateFromStoresObject } from "../../../../_bundle/Module589";
import { useCanJoinThreadVoice } from "../../../threads/ThreadHooks";
import Module12 from "../../../../_bundle/Module12";
import useHandleJoinThreadVoice from "../../../threads/native/useHandleJoinThreadVoice";
import { useConversationsHeaderButton } from "../../../conversations/components/native/useConversationsHeaderButton";
import { openChannelCallModal } from "../../../../utils/native/PrivateChannelCallUtils";
import { intl, t } from "../../../../intl/index.native";
import Module10051 from "../../../../_bundle/Module10051";
import { MagnifyingGlassIcon } from "../../../../design/components/Icon/native/redesign/generated/MagnifyingGlassIcon";
import GuildDirectorySearchModalActionCreators from "../../../directory_channels/native/components/GuildDirectorySearchModalActionCreators";
import ForumActionCreators from "../../../forums/ForumActionCreators";
import { isIOS } from "../../../../utils/PlatformUtils";
import { getChatInputRef } from "../../../../utils/native/ChatInputUtils";
import { getChannelDetailsSearchContext } from "../../../search/native/hooks/useSearchContext";
import Tracking from "../../../search/native/tracking/Tracking";
import { isSwipeToMemberListEnabled } from "../sidebar/member_list/SwipeToMemberListUtils";
import { ComponentDispatch } from "../../../../utils/ComponentDispatchUtils";
import { getRootNavigationRef } from "../../RootNavigationRef.native";
import Module10122 from "../../../../_bundle/Module10122";
import { ThreadIcon } from "../../../../design/components/Icon/native/redesign/generated/ThreadIcon";
import showThreadBrowserModal from "../../../threads/native/showThreadBrowserModal";
import { ConversationCoachmark } from "../../../conversations/components/native/ConversationCoachmark";
import IconActionButton from "../shared_components/IconActionButton";
import { useShouldHideChannelContent } from "../../../age_gate/AgeGateUtils";
import { ForumChannelCloseSearchButton } from "../../../forums/native/ForumChannelSearch";
import PrivateChannelButtons from "./header/PrivateChannelButtons";
let useStyles, EndCallButton, ChannelActionButtons, WrappedChannelNavButtons;
const JoinCallButton = function JoinCallButton() {
return <PhoneCallIcon size="sm" color={Module712.unsafe_rawColors.GREEN_360} />;
};
EndCallButton = function EndCallButton() {
return <PhoneHangUpIcon size="sm" color={Module712.unsafe_rawColors.RED_400} />;
};
ChannelActionButtons = function ChannelActionButtons(props) {
let c16979_2, conversationsHeaderButton;
const { channel, screenIndex } = props;
c16979_2 = void 0;
conversationsHeaderButton = void 0;
const styles = useStyles();
const isNsfwGated = useIsNsfwGated(channel);
const canSearchForumPosts = useCanSearchForumPosts(channel);
let r31 = useIsWindowSmall();
const stateFromStores = useStateFromStores([ActiveThreadsStore], () => ActiveThreadsStore.hasThreadsForChannel(channel.guild_id, channel.id));
const r35 = [];
c16979_2 = r35;
const canJoinThreadVoice = useCanJoinThreadVoice(channel);
const stateFromStores2 = useStateFromStores([VoiceStateStore], () => VoiceStateStore.isInChannel(channel.id));
const stateFromStores3 = useStateFromStores([VoiceStateStore], () => !Module12.isEmpty(VoiceStateStore.getVoiceStatesForChannel(channel.id)));
let onPress2 = useHandleJoinThreadVoice(channel);
conversationsHeaderButton = useConversationsHeaderButton(channel);
if (channel.isVocalThread() && canJoinThreadVoice && stateFromStores3) {
const IconComponent = stateFromStores2 ? EndCallButton : JoinCallButton;
if (!stateFromStores2) {
onPress2 = () => openChannelCallModal(channel);
}
r35.push({
source: null,
IconComponent,
onPress: onPress2,
accessibilityLabel: stateFromStores2 ? intl.string(t["4ry6yi"]) : intl.string(t.My50nf)
});
}
L23: {
const type = channel.type;
if (ChannelTypes.GUILD_DIRECTORY === type) {
r35.push({
source: Module10051,
IconComponent: MagnifyingGlassIcon,
onPress: () => {
GuildDirectorySearchModalActionCreators.open({
channel
});
},
accessibilityLabel: intl.string(t["5h0QOP"])
});
} else {
if (ChannelTypes.GUILD_FORUM !== type && ChannelTypes.GUILD_MEDIA !== type) {
if (conversationsHeaderButton != null) {
r35.push(conversationsHeaderButton);
}
r35.push({
source: Module10051,
IconComponent: MagnifyingGlassIcon,
onPress: () => {
setIsChannelDetailsSearchActive(channel.id, true, "initial");
if (isIOS()) {
const chatInputRef = getChatInputRef(channel.id, screenIndex);
if (chatInputRef != null) {
chatInputRef.blur();
}
}
L9: {
const isThread = channel.isThread();
Tracking.trackSearchOpened({
searchContext: getChannelDetailsSearchContext(channel.id, channel.getGuildId(), isThread),
searchLocation: SearchEntrypointAnalyticsLocations.CHANNEL_HEADER
});
if (!isSwipeToMemberListEnabled()) {
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null && rootNavigationRef.isReady()) {
rootNavigationRef.navigate("sidebar", {
channelId: channel.id,
search: true,
source: "channel-header-search"
});
break L9;
}
return void 0;
}
ComponentDispatch.dispatch(ComponentActions.SHOW_CHANNEL_DETAILS, {
source: "channel-header-search",
channelId: channel.id,
screenIndex
});
}
},
accessibilityLabel: intl.string(t["5h0QOP"])
});
break L23;
}
if (canSearchForumPosts) {
r35.push({
source: Module10051,
IconComponent: MagnifyingGlassIcon,
onPress: () => {
ForumActionCreators.updateForumSearchQuery(channel.id, "");
},
accessibilityLabel: intl.string(t["5h0QOP"])
});
}
}
}
if (r31) {
r31 = r35.length !== 0;
}
if (!r31) {
let r136 = THREADED_CHANNEL_TYPES.has(channel.type);
const r137 = (r136 ? !r136 : stateFromStores) && !ChannelTypesSets.GUILD_THREADS_ONLY.has(channel.type);
if (r136) {
r136 = !isNsfwGated;
}
if (r136) {
r136 = !channel.isForumLikeChannel();
}
if (r136) {
r136 = r137;
}
r31 = !r136;
}
if (!r31) {
r35.unshift({
source: Module10122,
IconComponent: ThreadIcon,
onPress: () => showThreadBrowserModal(channel),
accessibilityLabel: intl.string(t.B2panI)
});
}
return <View style={styles.actionWrapper}>
{r35.map((item, index) => {
const isLast = index === c16979_2.length - 1;
return item === conversationsHeaderButton ? <ConversationCoachmark key={item.accessibilityLabel} isLast={isLast}>
{(c30029_0) => <IconActionButton noMargin {...item} onPress={(event) => {
c30029_0();
const onPress2 = item.onPress;
if (onPress2 != null) {
onPress2.call(item, event);
}
}} />}
</ConversationCoachmark> : createElement(IconActionButton, {
noMargin: isLast,
...item,
key: item.accessibilityLabel
});
})}
</View>;
};
WrappedChannelNavButtons = function WrappedChannelNavButtons(props) {
const { channelId, screenIndex: screenIndex2, showCreateThread } = props;
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId));
const shouldHideChannelContent = useShouldHideChannelContent(stateFromStores);
return stateFromStores == null ? null : shouldHideChannelContent ? null : showCreateThread ? null : <ChannelActionButtons channel={stateFromStores} screenIndex={screenIndex2} />;
};
useStyles = createStyles({
actionWrapper: {
flexShrink: 0,
flexDirection: "row",
alignItems: "center"
}
});
export default function ChannelActions(props) {
let children2, props2;
let channelId2;
L7: {
channelId2 = props.channelId;
const { screenIndex: screenIndex2, containerStyle, showCreateThread } = props;
const stateFromStoresObject = useStateFromStoresObject([ChannelStore], () => {
const channel2 = ChannelStore.getChannel(channelId2);
let isMultiUserDM = channel2 == null ? void 0 : channel2.isMultiUserDM();
if (isMultiUserDM == null) {
isMultiUserDM = false;
}
const channel3 = ChannelStore.getChannel(channelId2);
let isDM = channel3 == null ? void 0 : channel3.isDM();
if (isDM == null) {
isDM = false;
}
return {
isMultiUserDM,
isDM
};
});
const { isMultiUserDM, isDM } = stateFromStoresObject;
const hasForumSearchQuery = useHasForumSearchQuery(channelId2);
props2 = {
style: containerStyle,
children: null
};
if (hasForumSearchQuery) {
children2 = <ForumChannelCloseSearchButton channelId={channelId2} />;
} else {
if (!isDM && !isMultiUserDM) {
children2 = <WrappedChannelNavButtons channelId={channelId2} screenIndex={screenIndex2} showCreateThread={showCreateThread} />;
break L7;
}
children2 = <PrivateChannelButtons channelId={channelId2} screenIndex={screenIndex2} />;
}
}
props2.children = children2;
return <View {...props2} />;
};
@@ -0,0 +1,6 @@
// Metro module 11735 (f11736).
import { isAnimatedAndroidKeyboard } from "../../../keyboard/native/AnimatedKeyboardExperiment";
import ChannelSafeAreaBottomNoop from "./ChannelSafeAreaBottomNoop";
import ChannelSafeAreaBottomAnimated_android from "./ChannelSafeAreaBottomAnimated.android";
const r16 = isAnimatedAndroidKeyboard() ? ChannelSafeAreaBottomNoop : ChannelSafeAreaBottomAnimated_android;
export default r16;
@@ -0,0 +1,27 @@
// Metro module 11737 (f11738).
import { memo } from "react";
import { StyleSheet, View } from "react-native";
import useChannelSafeAreaHeightSharedValue_android from "./useChannelSafeAreaHeightSharedValue.android";
import useChannelSafeAreaBottomStyles from "./useChannelSafeAreaBottomStyles";
import ReanimatedRexport, { useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
const __initData = {
code: "function ChannelSafeAreaBottomAnimatedAndroidTsx1(){const{heightSharedValue}=this.__closure;return{height:heightSharedValue.get()};}"
};
const r25 = memo(function ChannelSafeAreaBottom(props) {
const channelId = props.channelId;
const channelSafeAreaHeightSharedValue_android = useChannelSafeAreaHeightSharedValue_android();
let c19104_0 = channelSafeAreaHeightSharedValue_android;
const styles = useChannelSafeAreaBottomStyles(channelId);
const n = () => ({
height: c19104_0.get()
});
n.__closure = {
heightSharedValue: channelSafeAreaHeightSharedValue_android
};
n.__workletHash = 6491350126069;
n.__initData = __initData;
return <ReanimatedRexport.View style={useAnimatedStyle(n)}>
<View style={[StyleSheet.absoluteFill, styles]} />
</ReanimatedRexport.View>;
});
export default r25;
@@ -0,0 +1,7 @@
// Metro module 11736 (f11737).
import { memo } from "react";
import { View } from "react-native";
const r22 = memo(function ChannelSafeAreaNoop() {
return <View />;
});
export default r22;
@@ -0,0 +1,251 @@
// Metro module 15402 (f15403).
import * as Module19 from "react";
import { useMemo, useCallback, useRef } from "react";
import { View, StyleSheet } from "react-native";
import { HEADER_CORNER_RADIUS, MIN_HEADER_HEIGHT, MIDNIGHT_BORDER_WIDTH } from "../shared_components/MainTabsV2Constants";
import { EMPTY_STRING_SNOWFLAKE_ID, ME, ThemeTypes } from "../../../../Constants";
import { StaticChannelRoute } from "../../../channel/ChannelConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useNavigation } from "../../../../_bundle/Module1481";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { useGradientTop } from "../../../client_themes/native/ClientThemesOverrides";
import { ServerIcon } from "../../../../design/components/Icon/native/redesign/generated/ServerIcon";
import { intl, t } from "../../../../intl/index.native";
import { navigateToRootTab } from "../../helpers/NavigationRouteUtils.native";
import { ContextMenu } from "../../../../design/components/ContextMenu/native/ContextMenu.native";
import { PressableNavigatorBackIcon } from "../shared_components/navigator/PressableNavigatorBackIcon";
import { LayerScope } from "../../../../design/components/Layers/native/LayerScope.native";
import ChannelHeader from "./header/ChannelHeader";
import ChannelActions from "./ChannelActions";
import { useIsSwipeToMemberListEnabled } from "../sidebar/member_list/SwipeToMemberListUtils";
import useChannelRoleSubscriptionStatus from "../../../guild_role_subscriptions/useChannelRoleSubscriptionStatus";
import { useCanSeeOnboardingHome } from "../../../guild_onboarding_home/OnboardingHomeUtils";
import useTheme from "../../../../hooks/useTheme";
import { useMobileVisualRefreshConfig } from "../../../themes/experiments/MobileVisualRefreshExperiment";
import { useOrientation, OrientationType } from "../../../device/native/DeviceOrientation";
import { useIsForumChannelSearchActive } from "../../../forums/native/hooks/useIsForumChannelSearchActive";
import useChatLayout from "../../../chat/native/useChatLayout";
import { EmptyState } from "../../../../design/void/native";
import ThemedGradient from "../../../client_themes/native/ThemedGradient";
import GuildRoleSubscriptionsOverview from "../../../guild_role_subscriptions/native/overview_tab/GuildRoleSubscriptionsOverview";
import GuildOnboardingHomePage from "../../../guild_onboarding_home/native/GuildOnboardingHomePage";
import StandaloneMembersView from "../../../guild_settings/native/StandaloneMembersView";
import { CreateThreadView } from "../../../threads/native/components/thread_creation/CreateThreadView";
import ChatView from "../../../chat/native/ChatView";
import SwipeForMemberListWrapper from "./SwipeForMemberListWrapper";
let useStyles;
const Header = function Header(props) {
let callback;
const { channelId, screenIndex, guildId, isNavigationScreen, frame, isMIDNIGHTTheme, isChatInputFloating, showCreateThread, isBackEnabled } = props;
callback = void 0;
const navigation = useNavigation();
const styles = useStyles();
const top = useSafeAreaInsets_native().top;
const gradientTop = useGradientTop();
const memo = useMemo(() => [styles.headerWrapper, gradientTop, frame != null ? styles.headerWithFadingFrame : void 0, frame != null ? styles.splitDivider : void 0, frame != null ? styles.splitDividerTop : void 0, frame != null ? isMIDNIGHTTheme ? isChatInputFloating ? void 0 : styles.headerWithFadingFrameMidnight : void 0 : void 0, frame != null ? {
marginTop: top,
minHeight: MIN_HEADER_HEIGHT
} : {
paddingTop: top,
minHeight: top + MIN_HEADER_HEIGHT
}], [styles.headerWrapper, styles.headerWithFadingFrame, styles.splitDivider, styles.splitDividerTop, styles.headerWithFadingFrameMidnight, gradientTop, frame, isMIDNIGHTTheme, isChatInputFloating, top]);
callback = useCallback(() => {
if (isNavigationScreen) {
navigation.goBack();
}
}, [navigation, isNavigationScreen]);
const memo2 = useMemo(() => guildId != null && guildId !== ME, [guildId]);
const items = [{
IconComponent: ServerIcon,
label: intl.string(t.WYj55Y),
action: () => {
navigateToRootTab({
screen: "guilds",
guildId,
channelId,
resetRoot: false,
drawerOpen: false
});
}
}];
let r71 = memo2 ? <ContextMenu triggerOnLongPress align="below" items={items}>
{(a0) => {
const { ref, ...rest } = a0;
return <PressableNavigatorBackIcon ref={a0.ref} {...rest} onPress={callback} />;
}}
</ContextMenu> : <PressableNavigatorBackIcon onPress={callback} />;
const r88 = [frame != null ? isMIDNIGHTTheme ? isChatInputFloating ? null : <View style={[styles.midnightFrameCover, {
height: top + HEADER_CORNER_RADIUS
}]} /> : null : null, , ,];
const r94 = [<View style={styles.headerBottomBorder} />, ,];
if (!isBackEnabled) {
r71 = <View style={styles.spacer} />;
}
r94[1] = <LayerScope>
{r71}
<ChannelHeader channelId={channelId} isNavigationScreen={isNavigationScreen} screenIndex={screenIndex} showCreateThread={showCreateThread} />
<ChannelActions containerStyle={styles.actions} channelId={channelId} screenIndex={screenIndex} showCreateThread={showCreateThread} />
</LayerScope>;
r88[1] = <View style={memo}>{r94}</View>;
r88[2] = frame;
return <>{r88}</>;
};
useStyles = createStyles({
container: {
flex: 1
},
midnightContainerBorder: {
borderLeftWidth: MIDNIGHT_BORDER_WIDTH,
borderLeftColor: Module712.colors.APP_FRAME_BORDER,
borderTopWidth: MIDNIGHT_BORDER_WIDTH,
borderTopColor: "transparent"
},
contentContainer: {
flex: 1,
backgroundColor: Module712.colors.STANDALONE_CHANNEL_CONTENT_BACKGROUND
},
midnightContentContainerBorder: {
borderLeftWidth: MIDNIGHT_BORDER_WIDTH,
borderLeftColor: Module712.colors.APP_FRAME_BORDER
},
containerEmpty: {
backgroundColor: Module712.colors.STANDALONE_CHANNEL_CONTENT_BACKGROUND
},
headerWrapper: {
zIndex: 1,
backgroundColor: Module712.colors.STANDALONE_CHANNEL_CONTENT_BACKGROUND,
flexDirection: "row",
alignItems: "center",
flexShrink: 0
},
headerBottomBorder: {
...StyleSheet.absoluteFillObject,
top: void 0,
height: 1,
backgroundColor: Module712.colors.STANDALONE_CHANNEL_HEADER_BORDER
},
headerWithFadingFrame: {
borderTopLeftRadius: Module712.modules.mobile.CHANNEL_DRAWER_CORNER_RADIUS
},
splitDivider: {
borderLeftWidth: Module712.modules.mobile.CHANNEL_DRAWER_DIVIDER_WIDTH,
borderLeftColor: Module712.colors.APP_FRAME_BORDER
},
splitDividerTop: {
borderTopWidth: Module712.modules.mobile.CHANNEL_DRAWER_DIVIDER_WIDTH,
borderTopColor: Module712.colors.APP_FRAME_BORDER
},
headerWithFadingFrameMidnight: {
borderLeftColor: Module712.colors.APP_FRAME_BORDER,
borderTopColor: Module712.colors.APP_FRAME_BORDER,
borderLeftWidth: MIDNIGHT_BORDER_WIDTH,
borderTopWidth: MIDNIGHT_BORDER_WIDTH
},
midnightFrameCover: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
position: "absolute",
left: -MIDNIGHT_BORDER_WIDTH,
top: 0,
width: MIDNIGHT_BORDER_WIDTH
},
actions: {
marginRight: Module712.space.PX_16
},
spacer: {
width: Module712.space.PX_16
}
});
const r132 = Module19.memo(function StandaloneChannelScreen(props) {
let c21966_6;
const { guildId: guildId2, channelId: channelId2, isNavigationScreen: isNavigationScreen2, frame: frame2, showCreateThread, screenIndex } = props;
c21966_6 = void 0;
const styles2 = useStyles();
const navigation2 = useNavigation();
const isSwipeToMemberListEnabled = useIsSwipeToMemberListEnabled();
const needSubscriptionToAccess = useChannelRoleSubscriptionStatus(channelId2).needSubscriptionToAccess;
let r42 = guildId2;
if (r42 == null) {
r42 = EMPTY_STRING_SNOWFLAKE_ID;
}
const canSeeOnboardingHome = useCanSeeOnboardingHome(r42);
const ref = useRef(null);
const isMIDNIGHTTheme2 = useTheme() === ThemeTypes.MIDNIGHT;
let c21966_3 = isMIDNIGHTTheme2;
const chatInputFloating = useMobileVisualRefreshConfig({
location: "StandaloneChannelScreen"
}).chatInputFloating;
const orientation = useOrientation();
const memo = useMemo(() => {
let r2, r10;
L5: {
r2 = [styles2.container, ,];
const r1 = frame2 != null;
r10 = void 0;
if (!r1) {
r10 = void 0;
if (c21966_3) {
if (chatInputFloating) {
const PORTRAIT = OrientationType.PORTRAIT;
r10 = void 0;
if (orientation !== PORTRAIT) {
break L5;
}
}
r10 = styles2.midnightContainerBorder;
}
}
}
r2[1] = r10;
return r2;
}, [frame2, isMIDNIGHTTheme2, chatInputFloating, orientation, styles2.container, styles2.midnightContainerBorder]);
const memo2 = useMemo(() => [styles2.contentContainer, frame2 != null ? styles2.splitDivider : void 0, frame2 != null ? c21966_3 ? chatInputFloating ? void 0 : styles2.midnightContentContainerBorder : void 0 : void 0], [frame2, isMIDNIGHTTheme2, chatInputFloating, styles2.contentContainer, styles2.splitDivider, styles2.midnightContentContainerBorder]);
const isForumChannelSearchActive = useIsForumChannelSearchActive(channelId2);
const isChatLockedOpen = useChatLayout().isChatLockedOpen;
const isBackEnabled = (isChatLockedOpen ? isNavigationScreen2 : !isChatLockedOpen) && !isForumChannelSearchActive;
c21966_6 = isBackEnabled;
if (channelId2 != null && guildId2 != null) {
const r81 = <Header channelId={channelId2} frame={frame2} guildId={guildId2} isNavigationScreen={isNavigationScreen2} screenIndex={screenIndex} isMIDNIGHTTheme={isMIDNIGHTTheme2} isChatInputFloating={chatInputFloating} showCreateThread={showCreateThread} isBackEnabled={isBackEnabled} />;
if (channelId2 !== StaticChannelRoute.ROLE_SUBSCRIPTIONS && !needSubscriptionToAccess) {
if (channelId2 === StaticChannelRoute.GUILD_HOME) {
return <View style={memo}>
{r81}
<View style={memo2}>
{canSeeOnboardingHome ? <GuildOnboardingHomePage guildId={guildId2} /> : null}
</View>
</View>;
}
if (channelId2 === StaticChannelRoute.MEMBER_SAFETY) {
return <StandaloneMembersView guildId={guildId2} />;
}
if (showCreateThread) {
return <View style={memo2}>
{r81}
<CreateThreadView channelId={channelId2} screenIndex={screenIndex} />
</View>;
}
const r94 = <>
{r81}
<View style={memo2}>
<ChatView guildId={guildId2} channelId={channelId2} chatInputRef={ref} screenIndex={screenIndex} />
</View>
</>;
return isSwipeToMemberListEnabled ? <SwipeForMemberListWrapper style={memo} channelId={channelId2} screenIndex={screenIndex} isBackEnabled={isBackEnabled}>{r94}</SwipeForMemberListWrapper> : <View style={memo} accessible={false} onAccessibilityEscape={() => {
if (c21966_6) {
navigation2.goBack();
}
}}>{r94}</View>;
}
return <View style={memo}>
{r81}
<View style={memo2}>
<ThemedGradient absolute />
<GuildRoleSubscriptionsOverview guildId={guildId2} gatedChannelId={needSubscriptionToAccess ? channelId2 : void 0} />
</View>
</View>;
}
return <View style={[memo, styles2.containerEmpty]}>
<EmptyState title={intl.string(t.ai6Lbr)} body={intl.string(t["LTr+x9"])} />
</View>;
});
export default r132;
@@ -0,0 +1,390 @@
// Metro module 15459 (f15460).
import { createContext, useState, useEffect, useCallback, useMemo, useContext } from "react";
import { StyleSheet, View } from "react-native";
import { getIsChannelDetailsSearchActive, setIsChannelDetailsSearchActive } from "../sidebar/details/stores/ChannelDetailsStore";
import { MIDNIGHT_BORDER_WIDTH } from "../shared_components/MainTabsV2Constants";
import { AnalyticEvents, ComponentActions, ThemeTypes } from "../../../../Constants";
import Logger from "../../../debug/Logger";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import AppAnalyticsUtils from "../../../app_analytics/AppAnalyticsUtils";
import MainTabsNavigatorPanelContext, { MainTabsChannelScreenStackContext } from "../panels/MainTabsNavigatorPanelContext";
import useChatLayout, { getChatLayout } from "../../../chat/native/useChatLayout";
import ReanimatedRexport, { useDerivedValue, useAnimatedReaction, useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import { useUnmountEffect } from "../../../../hooks/useMountEffect";
import useTheme from "../../../../hooks/useTheme";
import { runAfterInteractions } from "../../../../utils/native/RunAfterInteractionsUtils";
import { dismissKeyboard } from "../../../../utils/native/ChatInputUtils";
import useChatWidth from "../../../chat/native/useChatWidth";
import { ComponentDispatch } from "../../../../utils/ComponentDispatchUtils";
import useMainTabsPanelsGesture from "../panels/useMainTabsPanelsGesture";
import { useDerivedStateFromSharedValue } from "../../../reanimated/native/useStateFromSharedValue";
import RouteManager from "../../../routing/RouteManager";
import { getRootNavigationRef } from "../../RootNavigationRef.native";
import { coerceChannelRoute, coerceGuildsRoute } from "../../helpers/NavigationRouteUtils.native";
import useBackPressHandler from "../../../routing/native/useBackPressHandler";
import { useNavigation } from "../../../../_bundle/Module1481";
import { useMainTabsChannelScreenStyles } from "../panels/useMainTabsChannelScreenStyles";
import { GestureDetector } from "../../../../_bundle/Module5273";
import { MainTabsContentScrim } from "../panels/MainTabsContentScrim";
import ThemedGradient from "../../../client_themes/native/ThemedGradient";
import { LayerScope } from "../../../../design/components/Layers/native/LayerScope.native";
import ChannelDetails from "../sidebar/details/ChannelDetails";
let c10995_15 = new Logger("SwipeForMemberListWrapper");
const context = createContext(void 0);
const useStyles = createStyles({
memberListPreview: {
flex: 1,
justifyContent: "center",
alignItems: "flex-start",
overflow: "hidden",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
content: {
...StyleSheet.absoluteFillObject,
overflow: "hidden"
},
memberListContainer: {
flex: 1,
overflow: "hidden",
backgroundColor: Module712.colors.MODAL_BACKGROUND
},
midnightBorder: {
borderLeftColor: Module712.colors.BORDER_STRONG,
borderLeftWidth: MIDNIGHT_BORDER_WIDTH
},
midnightRightOverflow: {
right: -MIDNIGHT_BORDER_WIDTH
}
});
const __initData = {
code: "function SwipeForMemberListWrapperTsx1(){const{shownPixels}=this.__closure;return shownPixels.get()>0;}"
};
const __initData2 = {
code: "function SwipeForMemberListWrapperTsx2(isVisible,wasVisible){const{mainDisallowGesture,stackDisallowGesture,panelDisallowGesture}=this.__closure;var _stackDisallowGesture;if(isVisible===wasVisible)return;mainDisallowGesture.set(isVisible);(_stackDisallowGesture=stackDisallowGesture)===null||_stackDisallowGesture===void 0||_stackDisallowGesture.set(isVisible);if(!isVisible){panelDisallowGesture.set(false);}}"
};
const __initData3 = {
code: "function SwipeForMemberListWrapperTsx3(){const{isChatLockedOpen,mainTranslateX,stackTranslateX}=this.__closure;return!isChatLockedOpen&&mainTranslateX.get()>0||stackTranslateX!=null&&stackTranslateX.get()>0;}"
};
const __initData4 = {
code: "function SwipeForMemberListWrapperTsx4(isInactive,wasInactive){const{panelDisallowGesture}=this.__closure;if(isInactive===wasInactive)return;panelDisallowGesture.set(isInactive);}"
};
const __initData5 = {
code: "function SwipeForMemberListWrapperTsx5(){const{maxWidth,translateX}=this.__closure;return maxWidth-translateX.get();}"
};
const __initData6 = {
code: "function SwipeForMemberListWrapperTsx6(){const{theme,ThemeTypes,isChatBesideChannelList,translateX,MIDNIGHT_BORDER_WIDTH}=this.__closure;if(theme!==ThemeTypes.MIDNIGHT||isChatBesideChannelList)return translateX.get();return translateX.get()-MIDNIGHT_BORDER_WIDTH;}"
};
const __initData7 = {
code: "function SwipeForMemberListWrapperTsx7(){const{shownPixels,PEEK_PIXEL_THRESHOLD}=this.__closure;const exceedsPeekThreshold=shownPixels.get()>PEEK_PIXEL_THRESHOLD*2;return{display:exceedsPeekThreshold?'none':'flex',opacity:exceedsPeekThreshold?0:1-shownPixels.get()/PEEK_PIXEL_THRESHOLD};}"
};
export default ({ channelId, screenIndex, isBackEnabled, children, style }) => {
let c22025_6, panelGestureContext, translateX, movePanel, maxWidth, derivedValue, derivedStateFromSharedValue, callback, callback2, navigation;
let channelId2, screenIndex2, isDragging, derivedStateFromSharedValue2;
let gesture, derivedValue2, gesture2, disallowGesture, translateX2, gesture3, disallowGesture2, translateX3, disallowGesture3, isChatLockedOpen;
c22025_6 = void 0;
panelGestureContext = void 0;
translateX = void 0;
movePanel = void 0;
maxWidth = void 0;
derivedValue = void 0;
derivedStateFromSharedValue = void 0;
callback = void 0;
callback2 = void 0;
navigation = void 0;
const styles = useStyles();
const theme = useTheme();
let c22025_3 = theme;
const isChatBesideChannelList = useChatLayout().isChatBesideChannelList;
const [channelId3, setState] = useState(channelId);
useEffect(() => {
let c28029_0 = runAfterInteractions(() => {
setState(channelId);
}, 200);
return () => {
c28029_0.cancel();
};
}, [channelId]);
const callback3 = useCallback(() => {
dismissKeyboard();
}, []);
const chatWidth = useChatWidth(screenIndex);
c22025_6 = chatWidth;
const memo = useMemo(() => c22025_3 === ThemeTypes.MIDNIGHT ? c22025_6 + MIDNIGHT_BORDER_WIDTH : c22025_6, [theme, chatWidth]);
const mainTabsPanelsGesture = useMainTabsPanelsGesture({
canDrag: true,
onDragStart: callback3,
onPreMovement: useCallback((a0) => {
if (!a0) {
setIsChannelDetailsSearchActive(channelId, false, "initial");
ComponentDispatch.dispatch(ComponentActions.CHANNEL_DETAILS_HIDDEN, {
channelId,
screenIndex
});
}
}, [channelId, screenIndex]),
startShown: false,
cancelOnSwipeRightFromStart: true,
openWidth: memo
});
const gesture4 = mainTabsPanelsGesture.gesture;
panelGestureContext = mainTabsPanelsGesture.panelGestureContext;
const isDragging2 = mainTabsPanelsGesture.isDragging;
translateX = mainTabsPanelsGesture.translateX;
movePanel = mainTabsPanelsGesture.movePanel;
maxWidth = mainTabsPanelsGesture.maxWidth;
const X = () => maxWidth - translateX.get();
X.__closure = {
maxWidth,
translateX
};
X.__workletHash = 10842481670591;
X.__initData = __initData5;
derivedValue = useDerivedValue(X);
derivedStateFromSharedValue = useDerivedStateFromSharedValue(derivedValue, (a0) => a0 > 0);
useEffect(() => {
if (derivedStateFromSharedValue) {
ComponentDispatch.dispatch(ComponentActions.CHANNEL_DETAILS_SHOWN, {
channelId,
screenIndex
});
}
}, [derivedStateFromSharedValue, channelId, screenIndex]);
const te = function te() {
return c22025_3 === ThemeTypes.MIDNIGHT && !isChatBesideChannelList ? translateX.get() - MIDNIGHT_BORDER_WIDTH : translateX.get();
};
te.__closure = {
theme,
ThemeTypes,
isChatBesideChannelList,
translateX,
MIDNIGHT_BORDER_WIDTH
};
te.__workletHash = 5498466465211;
te.__initData = __initData6;
const derivedValue3 = useDerivedValue(te);
callback = useCallback((a0) => {
if (a0.channelId === channelId && a0.screenIndex === screenIndex) {
dismissKeyboard();
if (a0.search === true) {
setIsChannelDetailsSearchActive(a0.channelId, true, "initial");
}
movePanel(true, false, 0, true);
}
}, [channelId, screenIndex, movePanel]);
callback2 = useCallback(() => {
movePanel(false, false, 0, true);
}, [movePanel]);
useEffect(() => {
let c28030_0 = RouteManager.addRouteChangeListener(() => {
callback2();
});
return () => {
c28030_0();
};
}, [callback2]);
useEffect(() => {
ComponentDispatch.subscribe(ComponentActions.SHOW_CHANNEL_DETAILS, callback);
ComponentDispatch.subscribe(ComponentActions.HIDE_CHANNEL_DETAILS, callback2);
return () => {
ComponentDispatch.unsubscribe(ComponentActions.SHOW_CHANNEL_DETAILS, callback);
ComponentDispatch.unsubscribe(ComponentActions.HIDE_CHANNEL_DETAILS, callback2);
};
}, [callback, callback2]);
const callback4 = useCallback(() => {
let r46;
if (derivedValue.get() <= 0) {
c10995_15.verbose("handleBackPress", "shownPixels <= 0", {
shownPixels: derivedValue.get()
});
return false;
}
const rootNavigationRef = getRootNavigationRef();
const currentRoute = rootNavigationRef == null ? void 0 : rootNavigationRef.getCurrentRoute();
const isChatLockedOpen2 = getChatLayout().isChatLockedOpen;
let route = coerceChannelRoute(currentRoute);
if (route == null && isChatLockedOpen2) {
route = coerceGuildsRoute(currentRoute);
}
c10995_15.verbose("handleBackPress", {
route,
channelId,
currentRoute,
isChatLockedOpen: isChatLockedOpen2,
routeParams: route?.params
});
if (route == null) {
c10995_15.verbose("handleBackPress", "route is null", {
currentRoute,
isChatLockedOpen: isChatLockedOpen2
});
r46 = false;
} else if (route.params?.channelId !== channelId) {
c10995_15.verbose("handleBackPress", "route channelId mismatch", {
routeChannelId: route.params?.channelId,
expectedChannelId: channelId
});
r46 = false;
} else if (getIsChannelDetailsSearchActive(channelId)) {
c10995_15.verbose("handleBackPress", "cancelling search before closing panel");
setIsChannelDetailsSearchActive(channelId, false, "initial");
r46 = true;
} else {
callback2();
r46 = true;
}
return r46;
}, [derivedValue, callback2, channelId]);
useBackPressHandler(callback4, derivedStateFromSharedValue);
useEffect(() => {
callback2();
}, [channelId, screenIndex, callback2]);
navigation = useNavigation();
channelId2 = channelId;
screenIndex2 = screenIndex;
isDragging = isDragging2;
derivedStateFromSharedValue2 = derivedStateFromSharedValue;
useEffect(() => {
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.MEMBER_LIST_SWIPE_TOGGLED, {
channel_id: channelId2,
screen_index: String(screenIndex2),
member_list_open: derivedStateFromSharedValue2
});
}, [channelId, screenIndex, derivedStateFromSharedValue]);
useEffect(() => {
let r1 = derivedStateFromSharedValue2;
if (derivedStateFromSharedValue2) {
r1 = isDragging.get();
}
if (r1) {
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.MEMBER_LIST_SWIPE_PEEK, {
channel_id: channelId2,
screen_index: String(screenIndex2)
});
}
}, [derivedStateFromSharedValue, channelId, screenIndex, isDragging]);
gesture = gesture4;
derivedValue2 = derivedValue;
gesture2 = void 0;
disallowGesture = void 0;
translateX2 = void 0;
gesture3 = void 0;
disallowGesture2 = void 0;
translateX3 = void 0;
disallowGesture3 = void 0;
isChatLockedOpen = void 0;
const context2 = useContext(MainTabsNavigatorPanelContext);
gesture2 = context2.gesture;
disallowGesture = context2.disallowGesture;
translateX2 = context2.translateX;
let r143 = useContext(MainTabsChannelScreenStackContext);
if (r143 == null) {
r143 = {};
}
gesture3 = r143.gesture;
disallowGesture2 = r143.disallowGesture;
translateX3 = r143.translateX;
disallowGesture3 = panelGestureContext.disallowGesture;
isChatLockedOpen = useChatLayout().isChatLockedOpen;
const memo2 = useMemo(() => gesture3 == null ? gesture.simultaneousWithExternalGesture(gesture2) : gesture.simultaneousWithExternalGesture(gesture2, gesture3), [gesture, gesture2, gesture3]);
const c = function c() {
return derivedValue2.get() > 0;
};
c.__closure = {
shownPixels: derivedValue
};
c.__workletHash = 15116046915956;
c.__initData = __initData;
const r159 = function(a0, a1) {
if (a0 !== a1) {
disallowGesture.set(a0);
if (disallowGesture2 != null) {
disallowGesture2.set(a0);
}
if (!a0) {
disallowGesture3.set(false);
}
}
};
r159.__closure = {
mainDisallowGesture: disallowGesture,
stackDisallowGesture: disallowGesture2,
panelDisallowGesture: disallowGesture3
};
r159.__workletHash = 13681610289748;
r159.__initData = __initData2;
useAnimatedReaction(c, r159);
const h = function h() {
return (isChatLockedOpen ? !isChatLockedOpen : translateX2.get() > 0) || translateX3 != null && translateX3.get() > 0;
};
h.__closure = {
isChatLockedOpen,
mainTranslateX: translateX2,
stackTranslateX: translateX3
};
h.__workletHash = 11938850302839;
h.__initData = __initData3;
const u = function u(a0, a1) {
if (a0 !== a1) {
disallowGesture3.set(a0);
}
};
u.__closure = {
panelDisallowGesture: disallowGesture3
};
u.__workletHash = 3362957347102;
u.__initData = __initData4;
useAnimatedReaction(h, u);
useUnmountEffect(() => {
disallowGesture3.set(false);
disallowGesture.set(false);
if (disallowGesture2 != null) {
disallowGesture2.set(false);
}
});
const memo3 = useMemo(() => ({
...panelGestureContext,
channelId,
screenIndex,
isPanelActive: derivedStateFromSharedValue
}), [panelGestureContext, channelId, screenIndex, derivedStateFromSharedValue]);
const styles2 = useMainTabsChannelScreenStyles(isDragging, derivedValue3, maxWidth);
const le = function le() {
const r3 = derivedValue.get() > 300;
return {
display: r3 ? "none" : "flex",
opacity: r3 ? 0 : 1 - derivedValue.get() / 150
};
};
le.__closure = {
shownPixels: derivedValue,
PEEK_PIXEL_THRESHOLD: 150
};
le.__workletHash = 9468759128012;
le.__initData = __initData7;
const animatedStyle = useAnimatedStyle(le);
return <context.Provider value={memo3}>
<GestureDetector gesture={memo2}>
<View style={style} onAccessibilityEscape={() => {
if (isBackEnabled) {
navigation.goBack();
}
}}>
<View style={styles.content} accessibilityElementsHidden={!!derivedStateFromSharedValue || void 0} importantForAccessibility={derivedStateFromSharedValue ? "no-hide-descendants" : void 0}>
{children}
<MainTabsContentScrim translateX={derivedValue3} maxWidth={maxWidth} />
</View>
<ReanimatedRexport.View style={[styles2, styles.memberListContainer, theme === ThemeTypes.MIDNIGHT ? styles.midnightBorder : void 0, isChatBesideChannelList ? void 0 : theme === ThemeTypes.MIDNIGHT ? styles.midnightRightOverflow : void 0]} accessibilityElementsHidden={derivedStateFromSharedValue ? void 0 : !derivedStateFromSharedValue} importantForAccessibility={derivedStateFromSharedValue ? void 0 : "no-hide-descendants"}>
<ThemedGradient absolute withOverlay overlayOpacity={0.5} />
<LayerScope>
<ChannelDetails isShowing={derivedStateFromSharedValue} channelId={channelId3} isSearchLocked={false} onBackPress={callback4} componentWidth={chatWidth} onChannelDeleted={callback2} />
</LayerScope>
<ReanimatedRexport.View style={[StyleSheet.absoluteFill, animatedStyle]}>
<View style={styles.memberListPreview} />
</ReanimatedRexport.View>
</ReanimatedRexport.View>
</View>
</GestureDetector>
</context.Provider>;
};
export { context as SwipeForMemberListContext };
@@ -0,0 +1,47 @@
// Metro module 10136 (f10137).
import ChannelStore from "../../../../../stores/ChannelStore";
import { ComponentActions } from "../../../../../Constants";
import { StaticChannelRoute } from "../../../../channel/ChannelConstants";
import { isIOS } from "../../../../../utils/PlatformUtils";
import { getChatInputRef } from "../../../../../utils/native/ChatInputUtils";
import { isSwipeToMemberListEnabled } from "../../sidebar/member_list/SwipeToMemberListUtils";
import { ComponentDispatch } from "../../../../../utils/ComponentDispatchUtils";
import { getRootNavigationRef } from "../../../RootNavigationRef.native";
import { useStateFromStores } from "../../../../../_bundle/defaultAreStatesEqual";
import { useIsChannelContentGated } from "../../../../age_gate/AgeGateUtils";
import GuildRoleSubscriptionsChannelHeader from "../../../../guild_role_subscriptions/native/overview_tab/GuildRoleSubscriptionsChannelHeader";
import HomeChannelHeader from "./HomeChannelHeader";
import PrivateChannelHeader from "./PrivateChannelHeader";
import ForumChannelHeader from "./ForumChannelHeader";
import { intl, t } from "../../../../../intl/index.native";
import GuildChannelHeader from "./GuildChannelHeader";
export default function ChannelHeader(props) {
const { channelId, screenIndex, isNavigationScreen, pressable = true, isGuildMemberCountVisible = true, showCreateThread = false } = props;
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId));
const isChannelContentGated = useIsChannelContentGated(stateFromStores);
const pressable2 = isChannelContentGated ? !isChannelContentGated : pressable;
return channelId === StaticChannelRoute.ROLE_SUBSCRIPTIONS ? <GuildRoleSubscriptionsChannelHeader /> : channelId === StaticChannelRoute.GUILD_HOME ? <HomeChannelHeader /> : (stateFromStores == null ? void 0 : stateFromStores.isPrivate()) ? <PrivateChannelHeader channelId={channelId} pressable={pressable2} screenIndex={screenIndex} /> : (stateFromStores == null ? void 0 : stateFromStores.isForumLikeChannel()) ? <ForumChannelHeader channelId={channelId} guildId={stateFromStores?.guild_id} pressable={pressable2} isGuildMemberCountVisible={isGuildMemberCountVisible} isNavigationScreen={isNavigationScreen} screenIndex={screenIndex} searchPlaceholder={stateFromStores.isForumChannel() ? void 0 : intl.string(t["L9fR+P"])} /> : <GuildChannelHeader channelId={channelId} guildId={stateFromStores?.guild_id} pressable={pressable2} isGuildMemberCountVisible={isGuildMemberCountVisible} isNavigationScreen={isNavigationScreen} screenIndex={screenIndex} showCreateThread={showCreateThread} />;
};
export function navigateToChannelDetails(a0, a1, a2) {
if (isIOS()) {
const chatInputRef = getChatInputRef(a0, a1);
if (chatInputRef != null) {
chatInputRef.blur();
}
}
if (isSwipeToMemberListEnabled()) {
ComponentDispatch.dispatch(ComponentActions.SHOW_CHANNEL_DETAILS, {
source: a2,
channelId: a0,
screenIndex: a1
});
} else {
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef == null ? void 0 : rootNavigationRef.isReady()) {
rootNavigationRef.navigate("sidebar", {
channelId: a0,
source: a2
});
}
}
}
@@ -0,0 +1,191 @@
// Metro module 10144 (f10145).
import { useState, useCallback, useMemo } from "react";
import { View } from "react-native";
import RelationshipStore from "../../../../../stores/RelationshipStore";
import UserStore from "../../../../../stores/UserStore";
import { getMinHeaderHeight } from "../../shared_components/MainTabsV2Constants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import MobileVisualRefreshExperiment from "../../../../themes/experiments/MobileVisualRefreshExperiment";
import { PressableOpacity } from "../../../../../design/void/Pressables/native/Pressables";
import { isAndroid } from "../../../../../utils/PlatformUtils";
import UsernameWithEffects from "../../../../display_name_styles/native/UsernameWithEffects";
import { Text } from "../../../../../design/components/Text/native/Text";
import { Icon, AvatarSizes, Avatar } from "../../../../../design/void/native";
import Module10145 from "../../../../../_bundle/Module10145";
import GroupDMAvatar from "../../../../group_dm/native/GroupDMAvatar";
import { useToken } from "../../../../../design/tokens/native/useToken";
import { getChannelIconWithGuild, getChannelIconComponent } from "../../../../../utils/native/ChannelUtils";
import GuildActionSheetMemberCount from "../../../../guild_action_sheet/native/components/GuildActionSheetMemberCount";
import { intl, t } from "../../../../../intl/index.native";
import { computeChannelName } from "../../../../channel/useChannelName";
let useStyles, ChannelTitle, GroupDMIcon, UserAvatar, ChannelIconRaw, MemberCountText, ParentChannelSubTitle, EmptyIcon;
const TitleWrapper = function TitleWrapper(props) {
const { children, onPress, headerAccessibilityLabel, titleContentHeight } = props;
const styles = useStyles(MobileVisualRefreshExperiment("ChannelHeaderShared"));
const [androidRippleConfig, setState] = useState(void 0);
const callback = useCallback((a0) => {
setState({
borderless: true,
radius: a0.nativeEvent.layout.width
});
}, []);
const memo = useMemo(() => {
if (titleContentHeight != null) {
const top = Math.max(0, (getMinHeaderHeight("ChannelHeaderShared") - titleContentHeight) / 2);
return {
top,
bottom: top
};
}
}, [titleContentHeight]);
return onPress == null ? <View style={styles.wrapper} accessibilityRole="header">{children}</View> : <PressableOpacity onLayout={isAndroid() ? callback : void 0} onPress={onPress} androidRippleConfig={androidRippleConfig} accessibilityRole="header" accessibilityLabel={headerAccessibilityLabel} hitSlop={memo} style={styles.wrapper}>{children}</PressableOpacity>;
};
ChannelTitle = function ChannelTitle(props) {
const { title, accessibleTitle, subtitle, disableArrow = false, userId, guildId, icon } = props;
const r21 = MobileVisualRefreshExperiment("ChannelTitle");
const styles = useStyles(r21);
return <View style={styles.channelContent}>
<View style={styles.nameWithArrow}>
{r21 ? icon ?? null : null}
{userId != null ? <UsernameWithEffects userId={userId} guildId={guildId} userName={title} variant={r21 ? "redesign/heading-18/semibold" : "heading-lg/bold"} defaultColor="mobile-text-heading-primary" lineClamp={1} style={styles.channelName} accessibilityLabel={accessibleTitle} accessibilityRole="header" maxFontSizeMultiplier={2} /> : <Text variant={r21 ? "redesign/heading-18/semibold" : "heading-lg/bold"} color="mobile-text-heading-primary" lineClamp={1} style={styles.channelName} accessibilityLabel={accessibleTitle} accessibilityRole="header" maxFontSizeMultiplier={2}>{title}</Text>}
{disableArrow ? !disableArrow : <Icon source={Module10145} size={Icon.Sizes.REFRESH_SMALL_16} style={styles.arrowIcon} />}
</View>
{subtitle != null && <View style={styles.subTitleContainer}>{subtitle}</View>}
</View>;
};
GroupDMIcon = function GroupDMIcon(props) {
return <GroupDMAvatar size={AvatarSizes.REFRESH_MEDIUM_32} channel={props.channel} style={useStyles(MobileVisualRefreshExperiment("ChannelHeaderShared")).channelIcon} />;
};
UserAvatar = function UserAvatar(props) {
const { user, status, isMobileOnline, isVROnline } = props;
const styles = useStyles(MobileVisualRefreshExperiment("ChannelHeaderShared"));
return <Avatar user={user} avatarDecoration={user.avatarDecoration} guildId={void 0} size={AvatarSizes.REFRESH_MEDIUM_32} status={user.isSystemUser() ? null : status} isMobileOnline={isMobileOnline} isVROnline={isVROnline} style={styles.channelIcon} autoStatusCutout />;
};
ChannelIconRaw = function ChannelIconRaw(props) {
const { icon, IconComponent } = props;
const r7 = MobileVisualRefreshExperiment("ChannelHeaderShared");
const token = useToken(Module712.modules.mobile.CHANNEL_HEADER_ICON_SIZE);
const styles = useStyles(r7);
return IconComponent != null ? <IconComponent size={token} color={r7 ? "icon-strong" : "text-strong"} style={r7 ? {
marginEnd: 4
} : void 0} /> : <Icon size={Icon.Sizes.SMALL_20} source={icon} color={styles.guildChannelIcon.tintColor} />;
};
MemberCountText = function MemberCountText(props) {
const presenceCount = props.presenceCount;
let memberCount = props.memberCount;
const { withSeparator, leadingAccessoryWidth } = props;
const r19 = MobileVisualRefreshExperiment("ChannelHeaderShared");
const type = presenceCount === 0 ? memberCount !== null ? "total" : "online" : "online";
if (type === "online") {
memberCount = presenceCount;
}
if (memberCount == null) {
memberCount = void 0;
}
return <>
{[<GuildActionSheetMemberCount type={type} count={memberCount} color={r19 ? "text-subtle" : "text-muted"} dotContainerWidth={r19 ? leadingAccessoryWidth : void 0} />, withSeparator ? <Text variant={r19 ? "text-sm/normal" : "text-xs/medium"} color="text-subtle">•</Text> : null]}
</>;
};
ParentChannelSubTitle = function ParentChannelSubTitle(props) {
const channel = props.channel;
const r11 = MobileVisualRefreshExperiment("ChannelHeaderShared");
const styles = useStyles(r11);
return <Text lineClamp={1} accessibilityLabel={intl.formatToPlainString(t.BjYvHO, {
channelName: computeChannelName(channel, UserStore, RelationshipStore)
})} maxFontSizeMultiplier={2} variant={r11 ? "text-sm/medium" : "text-xs/medium"} color={r11 ? "text-subtle" : "text-muted"} style={styles.parentChannelName}>
{computeChannelName(channel, UserStore, RelationshipStore)}
</Text>;
};
EmptyIcon = function EmptyIcon() {
return <View style={useStyles(MobileVisualRefreshExperiment("ChannelHeaderShared")).channelIconWrapper} />;
};
useStyles = createStyles((a0) => ({
wrapper: {
flex: 1,
alignItems: "center",
flexShrink: 1,
flexDirection: "row",
paddingEnd: 8
},
channelContent: {
flex: 1,
flexShrink: 1,
justifyContent: "center",
marginTop: a0 ? 4 : void 0
},
nameWithArrow: {
flexDirection: "row",
alignItems: "center",
flexShrink: 1
},
channelName: {
flexShrink: 1,
...a0 ? {} : {
fontSize: 18,
lineHeight: 24
}
},
arrowIcon: {
tintColor: Module712.colors.INTERACTIVE_TEXT_DEFAULT,
flexShrink: 0,
flexGrow: 0,
marginTop: 2,
marginLeft: 2
},
channelIcon: {
marginRight: 12,
flexShrink: 0
},
channelIconWrapper: {
width: 32,
height: 32,
justifyContent: "center",
alignItems: "center"
},
guildChannelIcon: {
tintColor: Module712.colors.TEXT_STRONG
},
subTitleContainer: {
flexDirection: "row",
alignItems: "center",
gap: 4,
marginBottom: 4
},
parentChannelName: {
lineHeight: 16,
flexShrink: 1
}
}));
export function renderTitleWrapper(a0, a1, a2, a3) {
return <TitleWrapper onPress={a1} headerAccessibilityLabel={a2} titleContentHeight={a3}>
{a0}
</TitleWrapper>;
}
export function renderChannelTitle(a0, r2 = {}) {
const { accessibleTitle, subtitle, disableArrow } = r2;
return <ChannelTitle title={a0} accessibleTitle={accessibleTitle} subtitle={subtitle} disableArrow={disableArrow !== void 0 && disableArrow} userId={r2.userId} guildId={r2.guildId} icon={r2.icon} />;
}
export function renderGroupDMIcon(a0) {
return <GroupDMIcon channel={a0} />;
}
export function renderUserAvatar(a0, a1, a2, a3) {
return <UserAvatar user={a0} status={a1} isMobileOnline={a2} isVROnline={a3} />;
}
export function renderChannelIconRaw(a0, a1) {
return <ChannelIconRaw icon={a0} IconComponent={a1} />;
}
export function renderChannelIcon(a0, a1) {
return <ChannelIconRaw icon={getChannelIconWithGuild(a0, a1)} IconComponent={getChannelIconComponent(a0, {
isRulesChannel: a1?.rulesChannelId === a0.id
})} />;
}
export function renderMemberCountText(a0, a1, withSeparator = false) {
return a0 == null ? a1 == null ? null : <MemberCountText presenceCount={a0} memberCount={a1} withSeparator={withSeparator} leadingAccessoryWidth={arguments[3]} /> : <MemberCountText presenceCount={a0} memberCount={a1} withSeparator={withSeparator} leadingAccessoryWidth={arguments[3]} />;
}
export function renderParentChannelSubTitle(a0) {
return <ParentChannelSubTitle channel={a0} />;
}
export function renderEmptyIcon() {
return <EmptyIcon />;
}
@@ -0,0 +1,25 @@
// Metro module 10147 (f10148).
import { memo } from "react";
import { View } from "react-native";
import { MIN_HEADER_HEIGHT } from "../../shared_components/MainTabsV2Constants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import { useIsForumChannelSearchActive } from "../../../../forums/native/hooks/useIsForumChannelSearchActive";
import { ForumChannelSearchInput } from "../../../../forums/native/ForumChannelSearch";
import GuildChannelHeader from "./GuildChannelHeader";
const useStyles = createStyles({
search: {
flex: 1,
flexShrink: 1,
flexDirection: "row",
alignItems: "center",
paddingStart: 4,
height: MIN_HEADER_HEIGHT
}
});
const r32 = memo(function({ channelId, screenIndex, guildId, pressable, isGuildMemberCountVisible, isNavigationScreen, searchPlaceholder }) {
const styles = useStyles();
return useIsForumChannelSearchActive(channelId) ? <View style={styles.search}>
<ForumChannelSearchInput channelId={channelId} guildId={guildId} placeholder={searchPlaceholder} />
</View> : <GuildChannelHeader channelId={channelId} guildId={guildId} pressable={pressable} isGuildMemberCountVisible={isGuildMemberCountVisible} isNavigationScreen={isNavigationScreen} screenIndex={screenIndex} />;
});
export default r32;
@@ -0,0 +1,198 @@
// Metro module 10149 (f10150).
import { useEffect, useMemo, memo, useRef, useCallback } from "react";
import { View } from "react-native";
import ChannelMemberCountStore from "../../../../channel/ChannelMemberCountStore";
import GatewayConnectionStore from "../../../../gateway/GatewayConnectionStore";
import { THREAD_CHANNEL_TYPES } from "../../../../../records/ChannelRecord";
import ChannelMemberStore from "../../../../../stores/ChannelMemberStore";
import ChannelStore from "../../../../../stores/ChannelStore";
import GuildMemberCountStore from "../../../../../stores/GuildMemberCountStore";
import GuildStore from "../../../../../stores/GuildStore";
import RelationshipStore from "../../../../../stores/RelationshipStore";
import UserStore from "../../../../../stores/UserStore";
import { ChannelTypes, HelpdeskArticles, StatusTypes } from "../../../../../Constants";
import { ContentDismissActionType } from "../../../../dismissible_content/DismissibleContentConstants";
import { useToken } from "../../../../../design/tokens/native/useToken";
import Module712 from "../../../../../_bundle/Module712";
import { useStateFromStoresObject, useStateFromStores } from "../../../../../_bundle/Module589";
import { renderMemberCountText, renderChannelIcon, renderParentChannelSubTitle, renderChannelTitle, renderTitleWrapper } from "./ChannelHeaderShared";
import { ICON_SIZE } from "../../../../../design/components/Icon/IconSize";
import * as _AgeGateUtils from "../../../../age_gate/native/AgeGateUtils";
import { intl, t } from "../../../../../intl/index.native";
import { computeChannelName } from "../../../../channel/useChannelName";
import { useShouldChannelShowLoadingIndicator, ChannelHeaderLoadingIndicator } from "../../../../chat/native/ChatLoadingIndicator";
import { useSelectedDismissibleContent } from "../../../../dismissible_content/hooks/useSelectedDismissibleContent";
import { DismissibleContent } from "../../../../../_bundle/Module1358";
import HelpdeskUtils from "../../../../../utils/HelpdeskUtils";
import { getChannelIconWithGuild } from "../../../../../utils/native/ChannelUtils";
import { useCoachmark } from "../../../../../design/components/Coachmark/native/useCoachmark.native";
import MobileVisualRefreshExperiment from "../../../../themes/experiments/MobileVisualRefreshExperiment";
import useGetThreadDraftSettings from "../../../../threads/useGetThreadDraftSettings";
import { navigateToChannelDetails } from "./ChannelHeader";
let computeVisibleChannelName, ChannelLinkedLobbyCoachmark;
const GuildChannelMemberCount = function GuildChannelMemberCount({ channel, withSeparator = false }) {
const token = useToken(Module712.modules.mobile.CHANNEL_HEADER_ICON_SIZE);
const stateFromStoresObject = useStateFromStoresObject([ChannelMemberStore, ChannelMemberCountStore], () => {
const groups = ChannelMemberStore.getProps(channel.guild_id, channel.id).groups;
let r30 = false;
let r31 = false;
let r33 = 0;
let online = 0;
for (const item of groups) {
if (item.count !== 0 && item.id !== StatusTypes.UNKNOWN) {
r30 = true;
const r45 = r33;
r33 = r45 + item.count;
if (item.id === StatusTypes.OFFLINE) {
r31 = true;
} else {
online = online + item.count;
}
}
}
return r30 ? {
total: r31 ? r33 : null,
online
} : ChannelMemberCountStore.getMemberCount(channel.id);
});
const { online, total } = stateFromStoresObject;
useEffect(() => {
ChannelMemberCountStore.requestCount(channel.guild_id, channel.id);
}, [channel.guild_id, channel.id]);
if (!(total != null && total > 500) && !(online != null && online > 500)) {
return renderMemberCountText(online, total, withSeparator, ICON_SIZE[token]);
}
};
computeVisibleChannelName = function computeVisibleChannelName({ channel: channel3, guildId: guildId3, showCreateThread: showCreateThread2, isConnected }) {
return _AgeGateUtils.shouldNSFWGateGuild(guildId3) ? intl.string(t.HbPHt1) : showCreateThread2 ? intl.string(t["4WNcpu"]) : channel3 == null ? isConnected ? intl.string(t.ai6Lbr) : intl.string(t.ZTNur7) : computeChannelName(channel3, UserStore, RelationshipStore);
};
ChannelLinkedLobbyCoachmark = function ChannelLinkedLobbyCoachmark({ iconRef, guild, channel: channel2 }) {
const [r22, r23] = useSelectedDismissibleContent([DismissibleContent.CHANNEL_LINKED_LOBBY_EDUCATION_TOOLTIP], void 0, true);
let c17730_2 = r23;
const visible = r22 === DismissibleContent.CHANNEL_LINKED_LOBBY_EDUCATION_TOOLTIP;
useCoachmark(iconRef, useMemo(() => ({
title: intl.string(t.YIVr4B),
description: intl.format(t.w8VWRT, {
helpdeskArticle: HelpdeskUtils.getArticleURL(HelpdeskArticles.LINKED_LOBBIES)
}),
visible: channel2?.linkedLobby != null && visible,
position: "bottom",
offsetY: 15,
onDismiss: () => c17730_2(ContentDismissActionType.USER_DISMISS),
imgSource: channel2 != null ? getChannelIconWithGuild(channel2, guild) : void 0
}), [channel2, guild, r23, visible]));
return null;
};
const r57 = memo(function GuildChannelHeader(props) {
let c17731_5;
const { channelId, screenIndex, guildId } = props;
let pressable = props.pressable;
const { isGuildMemberCountVisible, showCreateThread } = props;
c17731_5 = void 0;
const r12 = MobileVisualRefreshExperiment("GuildChannelHeader");
const ref = useRef(null);
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId));
const stateFromStores3 = useStateFromStores([GatewayConnectionStore], () => GatewayConnectionStore.isConnected());
c17731_5 = useGetThreadDraftSettings(channelId);
const stateFromStores4 = useStateFromStores([ChannelStore], () => {
let r10;
L10: {
if (stateFromStores != null && !showCreateThread) {
const r2 = stateFromStores != null;
r10 = void 0;
if (!r2) {
break L10;
}
const r11 = stateFromStores.parent_id != null;
r10 = void 0;
if (!r11) {
break L10;
}
const r13 = THREAD_CHANNEL_TYPES.has(stateFromStores.type);
r10 = void 0;
if (!r13) {
break L10;
}
r10 = ChannelStore.getChannel(stateFromStores.parent_id);
} else {
r10 = ChannelStore.getChannel(c17731_5?.parentChannelId);
}
}
return r10;
});
if (pressable) {
pressable = stateFromStores != null;
}
if (pressable) {
pressable = !showCreateThread;
}
const stateFromStores2 = useStateFromStores([GuildStore], () => GuildStore.getGuild(guildId));
const r68 = stateFromStores == null ? null : showCreateThread ? null : renderChannelIcon(stateFromStores, stateFromStores2);
const disableArrow = !pressable;
const r72 = !isGuildMemberCountVisible;
const icon = r12 ? r68 : null;
const guildId2 = guildId;
const channelName = computeVisibleChannelName({
channel: stateFromStores,
guildId,
showCreateThread,
isConnected: useStateFromStores([GatewayConnectionStore], () => GatewayConnectionStore.isConnected())
});
const shouldNSFWGateGuild = _AgeGateUtils.shouldNSFWGateGuild(guildId);
const r86 = shouldNSFWGateGuild ? !shouldNSFWGateGuild : showCreateThread ? showCreateThread : stateFromStores == null ? void 0 : stateFromStores.isThread();
const accessibleTitle = intl.formatToPlainString(r86 ? t["OkzL+Q"] : t.UbNmGc, {
channelName
});
const r97 = r86 ? stateFromStores4 != null ? renderParentChannelSubTitle(stateFromStores4) : void 0 : void 0;
let r107 = useStateFromStores([GuildMemberCountStore], () => GuildMemberCountStore.getMemberCount(guildId2));
if (r107 == null) {
r107 = 0;
}
const r108 = (isGuildMemberCountVisible ? r107 < 500 : !r72) && stateFromStores != null && !stateFromStores.isThread() && ![ChannelTypes.GUILD_DIRECTORY, ChannelTypes.GUILD_FORUM].includes(stateFromStores.type) && !showCreateThread;
const shouldChannelShowLoadingIndicator = useShouldChannelShowLoadingIndicator(stateFromStores?.id);
const r125 = stateFromStores == null ? void 0 : stateFromStores.isForumLikeChannel();
let r127 = r125 ? !r125 : shouldChannelShowLoadingIndicator;
const r147 = renderChannelTitle(channelName, {
accessibleTitle,
subtitle: r127 ? <ChannelHeaderLoadingIndicator /> : <>
{r108 ? <GuildChannelMemberCount channel={stateFromStores} withSeparator={r97 != null} /> : r108}
{stateFromStores4 != null && r97}
</>,
disableArrow,
guildId,
icon
});
if (!r127) {
r127 = r108;
}
if (!r127) {
r127 = r97 != null;
}
const callback = useCallback(() => {
navigateToChannelDetails(channelId, screenIndex, "guild-channel-header-title");
}, [channelId, screenIndex]);
const r180 = <>
{r12 ? stateFromStores2 != null ? stateFromStores?.linkedLobby != null ? <View ref={ref}>
<ChannelLinkedLobbyCoachmark iconRef={ref} guild={stateFromStores2} channel={stateFromStores} />
</View> : null : null : <View ref={ref} style={{
marginRight: 8
}}>
{r68}
{stateFromStores2 != null ? stateFromStores?.linkedLobby != null ? <ChannelLinkedLobbyCoachmark iconRef={ref} guild={stateFromStores2} channel={stateFromStores} /> : null : null}
</View>}
{r147}
</>;
const r182 = stateFromStores != null ? `${computeVisibleChannelName({
channel: stateFromStores,
guildId,
showCreateThread,
isConnected: stateFromStores3
})}, ${intl.string(t.x87QCk)}` : void 0;
if (pressable) {
return <>
{renderTitleWrapper(r180, callback, r182, r127 ? 44 : 24)}
</>;
}
return r180;
});
export default r57;
@@ -0,0 +1,26 @@
// Metro module 10139 (f10140).
import { memo } from "react";
import { View } from "react-native";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { Icon } from "../../../../../design/void/native";
import Module10140 from "../../../../../_bundle/Module10140";
import { Text } from "../../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../../intl/index.native";
const useStyles = createStyles({
container: {
flex: 1,
flexDirection: "row",
alignItems: "center",
gap: Module712.space.PX_8
}
});
const r34 = memo(function HomeChannelHeader() {
return <View style={useStyles().container}>
<Icon source={Module10140} size={Icon.Sizes.MEDIUM} disableColor />
<Text variant="heading-lg/extrabold" color="interactive-text-active">
{intl.string(t.Ym2Ri6)}
</Text>
</View>;
});
export default r34;
@@ -0,0 +1,228 @@
// Metro module 10128 (f10129).
import * as Module19 from "react";
import { useMemo, useCallback } from "react";
import { View } from "react-native";
import ChannelRTCStore, { NO_PARTICIPANTS } from "../../../../calls/ChannelRTCStore";
import ChannelStore from "../../../../../stores/ChannelStore";
import RelationshipStore from "../../../../../stores/RelationshipStore";
import UserStore from "../../../../../stores/UserStore";
import VoiceStateStore from "../../../../../stores/VoiceStateStore";
import { setIsChannelDetailsSearchActive } from "../../sidebar/details/stores/ChannelDetailsStore";
import { AnalyticEvents, AnalyticsSections, ChannelTypes } from "../../../../../Constants";
import { ParticipantTypes } from "../../../../calls/CallConstants";
import { CHANGELOG_URL } from "../../../../changelog/ChangelogConstants";
import { SearchEntrypointAnalyticsLocations } from "../../../../search/native/tracking/TrackingConstants";
import { AVATAR_SIZE_MAP, AvatarSizes, CutoutDirection, CutoutableAvatarImage } from "../../../../../design/void/native";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import MobileVisualRefreshExperiment from "../../../../themes/experiments/MobileVisualRefreshExperiment";
import { useStateFromStores, useStateFromStoresObject } from "../../../../../_bundle/Module589";
import { useInappropriateConversationSafetyToolsWarningForChannel } from "../../../../self_mod/inappropriate_conversation/hooks/useInappropriateConversationSafetyToolsWarningForChannel";
import { useIsCallActiveNullable } from "../../../../calls/mobile/useIsCallActive";
import useAppDMChatInputState from "../../../../app_dms/useAppDMChatInputState";
import getPrivateChannelCall from "../../../../calls/native/getPrivateChannelCall";
import { confirmStartCall } from "../../../../voice_calls/native/ConfirmStartCall";
import { navigateToChannelDetails } from "./ChannelHeader";
import { getChannelDetailsSearchContext } from "../../../../search/native/hooks/useSearchContext";
import Tracking from "../../../../search/native/tracking/Tracking";
import AppAnalyticsUtils from "../../../../app_analytics/AppAnalyticsUtils";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
import { PressableOpacity } from "../../../../../design/void/Pressables/native/Pressables";
import { intl, t } from "../../../../../intl/index.native";
import { MagnifyingGlassIcon } from "../../../../../design/components/Icon/native/redesign/generated/MagnifyingGlassIcon";
import { SafetyToolsButton } from "../../../../self_mod/inappropriate_conversation/native/SafetyToolsButton";
import isChangelogChannel from "../../../../changelog/utils/isChangelogChannel";
import Linking from "../../../../../lib/native/Linking";
import AnalyticsUtils from "../../../../../utils/AnalyticsUtils";
import { WindowLaunchIcon } from "../../../../../design/components/Icon/native/redesign/generated/WindowLaunchIcon";
import { SettingsIcon } from "../../../../../design/components/Icon/native/redesign/generated/SettingsIcon";
import { openChannelCallModal } from "../../../../../utils/native/PrivateChannelCallUtils";
import { VoiceNormalIcon } from "../../../../../design/components/Icon/native/redesign/generated/VoiceNormalIcon";
import { PhoneHangUpIcon } from "../../../../../design/components/Icon/native/redesign/generated/PhoneHangUpIcon";
import { PhoneCallIcon } from "../../../../../design/components/Icon/native/redesign/generated/PhoneCallIcon";
import { Text } from "../../../../../design/components/Text/native/Text";
import { VideoIcon } from "../../../../../design/components/Icon/native/redesign/generated/VideoIcon";
const width = AVATAR_SIZE_MAP[AvatarSizes.XSMALL];
const cutout = {
direction: CutoutDirection.RIGHT,
radius: width / 2 + 3,
inset: -6
};
const useStyles = createStyles((a0) => ({
privateChannelButtonsWrapper: {
flexDirection: "row",
gap: 12,
paddingEnd: 1
},
button: {
backgroundColor: a0 ? void 0 : Module712.colors.REDESIGN_BUTTON_TERTIARY_BACKGROUND,
borderRadius: Module712.modules.button.BORDER_RADIUS,
minHeight: Module712.space.PX_32,
minWidth: Module712.space.PX_32,
padding: Module712.space.PX_4,
justifyContent: "center",
flexDirection: "row",
alignItems: "center"
},
disabledButton: {
opacity: 0.6
},
overflowBadge: {
backgroundColor: Module712.colors.REDESIGN_BUTTON_TERTIARY_BACKGROUND,
borderRadius: Module712.radii.round,
width,
height: width,
justifyContent: "center",
alignItems: "center",
marginLeft: -6
}
}));
const r76 = Module19.memo(function PrivateChannelButtons(props) {
let r211;
let recipientId, inappropriateConversationSafetyToolsWarningForChannel, c17719_6, callParticipants, visibleParticipants, totalParticipantCount, c17719_10, application, callback, callback2, callback3;
const { channelId, screenIndex } = props;
recipientId = void 0;
inappropriateConversationSafetyToolsWarningForChannel = void 0;
c17719_6 = void 0;
callParticipants = void 0;
visibleParticipants = void 0;
totalParticipantCount = void 0;
c17719_10 = void 0;
application = void 0;
callback = void 0;
callback2 = void 0;
callback3 = void 0;
const styles = useStyles(MobileVisualRefreshExperiment("PrivateChannelButtons"));
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId));
recipientId = stateFromStores == null ? void 0 : stateFromStores.getRecipientId();
const stateFromStores2 = useStateFromStores([VoiceStateStore], () => stateFromStores != null && VoiceStateStore.isInChannel(stateFromStores.id), [stateFromStores]);
inappropriateConversationSafetyToolsWarningForChannel = useInappropriateConversationSafetyToolsWarningForChannel(channelId);
const r52 = inappropriateConversationSafetyToolsWarningForChannel != null && recipientId != null;
c17719_6 = r52;
const stateFromStores3 = useStateFromStores([RelationshipStore, UserStore], () => stateFromStores?.type === ChannelTypes.DM && recipientId != null && (RelationshipStore.isBlocked(recipientId) || UserStore.getUser(recipientId)?.isProvisional === true));
const isCallActiveNullable = useIsCallActiveNullable(stateFromStores?.id);
callParticipants = useStateFromStoresObject([ChannelRTCStore], () => ({
callParticipants: (stateFromStores == null ? void 0 : stateFromStores.isMultiUserDM()) === true ? ChannelRTCStore.getParticipants(stateFromStores.id) : NO_PARTICIPANTS,
participantsVersion: (stateFromStores == null ? void 0 : stateFromStores.isMultiUserDM()) === true ? ChannelRTCStore.getParticipantsVersion(stateFromStores.id) : -1
})).callParticipants;
const memo = useMemo(() => {
const r7 = callParticipants.filter((callParticipant) => callParticipant.type === ParticipantTypes.USER);
return {
visibleParticipants: r7.slice(0, 5),
totalParticipantCount: r7.length
};
}, [callParticipants]);
visibleParticipants = memo.visibleParticipants;
totalParticipantCount = memo.totalParticipantCount;
const r19 = stateFromStores == null ? void 0 : stateFromStores.isMultiUserDM();
const r23 = r19 && callParticipants.length > 0;
c17719_10 = r23;
const appDMChatInputState = useAppDMChatInputState({
context: {
type: "channel",
channel: stateFromStores
}
});
application = appDMChatInputState.application;
const isAppDM = appDMChatInputState.isAppDM;
callback = useCallback(function(r6 = false) {
if (stateFromStores != null && stateFromStores.isPrivate()) {
const privateChannelCall = getPrivateChannelCall(stateFromStores, r6);
if (privateChannelCall.inCall) {
privateChannelCall.onPress();
} else {
confirmStartCall(privateChannelCall.onPress);
}
}
}, [stateFromStores]);
callback2 = useCallback(() => {
callback(false);
}, [callback]);
const callback4 = useCallback(() => {
callback(true);
}, [callback]);
callback3 = useCallback(() => {
navigateToChannelDetails(channelId, screenIndex, "private-channel-search-button");
setIsChannelDetailsSearchActive(channelId, true, "action");
if (stateFromStores != null) {
Tracking.trackSearchOpened({
searchContext: getChannelDetailsSearchContext(channelId, stateFromStores.getGuildId(), stateFromStores.isThread()),
searchLocation: SearchEntrypointAnalyticsLocations.INDIVIDUAL_DM
});
}
}, [stateFromStores, channelId, screenIndex]);
const callback5 = useCallback(() => {
if (recipientId != null && stateFromStores != null && application != null) {
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.SETTINGS_PANE_VIEWED, {
settings_type: "user",
destination_pane: AnalyticsSections.SETTINGS_APP_DMS_MENU,
source_page: "app_dm_settings",
application_id: application.id
});
ActionSheetActionCreators.openLazy(import("../../../../app_dms/native/AppDMOptionsBottomSheet"), "AppDMOptionsBottomSheet", {
userId: recipientId,
channel: stateFromStores,
application
});
}
}, [recipientId, stateFromStores, application]);
const r106 = [r52, styles.button, callback3, channelId, recipientId, inappropriateConversationSafetyToolsWarningForChannel?.id, ,];
const type = inappropriateConversationSafetyToolsWarningForChannel?.type;
const r111 = () => c17719_6 ? <SafetyToolsButton channelId={channelId} recipientId={recipientId} warningId={inappropriateConversationSafetyToolsWarningForChannel.id} warningType={inappropriateConversationSafetyToolsWarningForChannel.type} /> : <PressableOpacity style={styles.button} onPress={callback3} accessibilityLabel={intl.string(t["5h0QOP"])} accessibilityRole="button">
<MagnifyingGlassIcon size="sm" />
</PressableOpacity>;
r106[6] = type;
const memo2 = useMemo(r111, r106);
if (isChangelogChannel(channelId)) {
r211 = <PressableOpacity style={styles.button} onPress={function onPress() {
Linking.openURL(CHANGELOG_URL);
AnalyticsUtils.track(AnalyticEvents.CHANGE_LOG_CTA_CLICKED, {
cta_type: "channel_header",
target: CHANGELOG_URL
});
}} accessibilityLabel={intl.string(t["+KSnWX"])}>
<WindowLaunchIcon size="sm" />
</PressableOpacity>;
} else if (isAppDM) {
r211 = application == null ? null : <View style={styles.privateChannelButtonsWrapper}>
<PressableOpacity style={styles.button} onPress={callback3} accessibilityLabel={intl.string(t["5h0QOP"])} accessibilityRole="button">
<MagnifyingGlassIcon size="sm" />
</PressableOpacity>
<PressableOpacity style={styles.button} onPress={callback5} accessibilityLabel={intl.string(t.oCqlGG)} accessibilityRole="button">
<SettingsIcon size="sm" />
</PressableOpacity>
</View>;
} else {
const accessibilityLabel = r23 ? intl.string(t["0D/6Rz"]) : stateFromStores2 ? intl.string(t["4ry6yi"]) : intl.string(t.focH1t);
const style = [styles.button, {
borderWidth: r23 ? 1 : void 0,
borderColor: r23 ? stateFromStores2 ? Module712.unsafe_rawColors.GREEN_360 : Module712.unsafe_rawColors.BRAND_400 : void 0
}, stateFromStores3 ? styles.disabledButton : null];
r211 = <View style={styles.privateChannelButtonsWrapper}>
<PressableOpacity accessibilityLabel={accessibilityLabel} accessibilityRole="button" style={style} onPress={() => {
if (c17719_10 && stateFromStores != null) {
openChannelCallModal(stateFromStores);
} else {
callback2();
}
}} disabled={stateFromStores3}>
{r23 ? <VoiceNormalIcon size="sm" color={stateFromStores2 ? Module712.unsafe_rawColors.GREEN_360 : Module712.unsafe_rawColors.BRAND_400} /> : stateFromStores2 ? <PhoneHangUpIcon size="sm" color={Module712.unsafe_rawColors.RED_400} /> : <PhoneCallIcon size="sm" color={isCallActiveNullable ? Module712.unsafe_rawColors.GREEN_360 : void 0} />}
{visibleParticipants.map((visibleParticipant, index) => <CutoutableAvatarImage key={visibleParticipant.id} style={{
marginLeft: index === 0 ? Module712.space.PX_4 : -6
}} user={visibleParticipant.user} guildId={void 0} size={AvatarSizes.XSMALL} cutout={index === visibleParticipants.length - 1 ? totalParticipantCount > 5 ? cutout : void 0 : cutout} />)}
{totalParticipantCount > 5 && <View style={styles.overflowBadge}>
<Text variant="text-xxs/semibold" color="button-outline-primary-text">
+
{totalParticipantCount - 5}
</Text>
</View>}
</PressableOpacity>
{r19 ? null : stateFromStores2 ? null : <PressableOpacity style={[styles.button, stateFromStores3 ? styles.disabledButton : null]} onPress={callback4} disabled={stateFromStores3} accessibilityLabel={intl.string(t.oCqlGG)} accessibilityRole="button">
<VideoIcon size="sm" />
</PressableOpacity>}
{memo2}
</View>;
}
return r211;
});
export default r76;
@@ -0,0 +1,94 @@
// Metro module 10141 (f10142).
import { memo, useCallback } from "react";
import ChannelStore from "../../../../../stores/ChannelStore";
import PresenceStore from "../../../../../stores/PresenceStore";
import RelationshipStore from "../../../../../stores/RelationshipStore";
import UserStore from "../../../../../stores/UserStore";
import { ChannelTypes, StatusTypes } from "../../../../../Constants";
import { AVATAR_SIZE_MAP, AvatarSizes } from "../../../../../design/void/native";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { useStateFromStores, useStateFromStoresObject } from "../../../../../_bundle/Module589";
import { navigateToChannelDetails } from "./ChannelHeader";
import { computeChannelName } from "../../../../channel/useChannelName";
import { intl, t } from "../../../../../intl/index.native";
import ActivityStatus from "../../../../activity_status/native/ActivityStatus";
import { useShouldChannelShowLoadingIndicator, ChannelHeaderLoadingIndicator } from "../../../../chat/native/ChatLoadingIndicator";
import { humanizeStatus } from "../../../../../utils/UserUtils";
import { renderMemberCountText, renderUserAvatar, renderGroupDMIcon, renderEmptyIcon, renderChannelTitle, renderTitleWrapper } from "./ChannelHeaderShared";
import { HermesBuiltin } from "../../../../../_hermes/prelude";
let c6756_13, useStyles;
const GroupDmMemberCount = function GroupDmMemberCount({ channel }) {
return renderMemberCountText(useStateFromStores([UserStore, PresenceStore], () => {
const recipients = channel.recipients;
const r6 = [,];
const r1 = HermesBuiltin.arraySpread(r6, recipients, 0);
let r14 = UserStore.getCurrentUser()?.id;
if (r14 == null) {
r14 = "0";
}
r6[r1] = r14;
return r6.reduce((acc, item) => {
const status = PresenceStore.getStatus(item);
return acc + (status !== StatusTypes.INVISIBLE ? status !== StatusTypes.OFFLINE ? status !== StatusTypes.UNKNOWN ? 1 : 0 : 0 : 0);
}, 0);
}), channel.recipients.length);
};
c6756_13 = AVATAR_SIZE_MAP[AvatarSizes.REFRESH_MEDIUM_32];
useStyles = createStyles({
activityStatusText: {
color: Module712.colors.TEXT_MUTED
}
});
const r53 = memo(function PrivateChannelHeader(props) {
let stateFromStores2;
const { channelId, screenIndex, pressable } = props;
stateFromStores2 = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId));
stateFromStores2 = useStateFromStores([UserStore], () => stateFromStores?.type === ChannelTypes.DM ? UserStore.getUser(stateFromStores.getRecipientId()) : void 0);
const stateFromStoresObject = useStateFromStoresObject([PresenceStore], () => ({
isMobileOnline: stateFromStores2 != null && PresenceStore.isMobileOnline(stateFromStores2.id),
isVROnline: stateFromStores2 != null && PresenceStore.isVROnline(stateFromStores2.id),
status: stateFromStores2 != null ? PresenceStore.getStatus(stateFromStores2.id) : StatusTypes.UNKNOWN
}));
const { isMobileOnline, isVROnline, status } = stateFromStoresObject;
const callback = useCallback(() => {
navigateToChannelDetails(channelId, screenIndex, "private-channel-header-title");
}, [channelId, screenIndex]);
const channelName = stateFromStores != null ? computeChannelName(stateFromStores, UserStore, RelationshipStore) : intl.string(t.ai6Lbr);
let subtitle = stateFromStores2 != null ? <ActivityStatus userId={stateFromStores2.id} guildId={stateFromStores?.guild_id} textStyle={styles.activityStatusText} /> : null;
const shouldChannelShowLoadingIndicator = useShouldChannelShowLoadingIndicator(channelId);
const r76 = stateFromStores != null && stateFromStores.isMultiUserDM();
if (shouldChannelShowLoadingIndicator) {
subtitle = <ChannelHeaderLoadingIndicator />;
} else if (r76) {
subtitle = <GroupDmMemberCount channel={stateFromStores} />;
}
const accessibleTitle = intl.formatToPlainString(t.UbNmGc, {
channelName
});
const r96 = stateFromStores2 == null ? null : stateFromStores2.isSystemUser() ? null : humanizeStatus(status, {
isMobile: isMobileOnline,
isVR: isVROnline
});
const r111 = intl.string(t.x87QCk);
const r117 = r96 != null ? `${accessibleTitle}, ${r96}, ${r111}` : `${accessibleTitle}, ${r111}`;
const r152 = <>
{stateFromStores2 != null ? renderUserAvatar(stateFromStores2, status, isMobileOnline, isVROnline) : (stateFromStores == null ? void 0 : stateFromStores.isGroupDM()) ? renderGroupDMIcon(stateFromStores) : renderEmptyIcon()}
{renderChannelTitle(channelName, {
accessibleTitle,
subtitle,
disableArrow: !pressable,
userId: stateFromStores2?.id,
guildId: stateFromStores?.guild_id
})}
</>;
if (pressable) {
return <>
{renderTitleWrapper(r152, callback, r117, subtitle != null ? 44 : c6756_13)}
</>;
}
return r152;
});
export default r53;
@@ -0,0 +1,127 @@
// Metro module 10425 (f10426).
import { useMemo } from "react";
import GatewayConnectionStore from "../../../gateway/GatewayConnectionStore";
import LurkingStore from "../../../lurker_mode/LurkingStore";
import ChannelStore from "../../../../stores/ChannelStore";
import MediaEngineStore from "../../../../stores/MediaEngineStore";
import RTCConnectionStore from "../../../../stores/RTCConnectionStore";
import { InputModes } from "../../../../Constants";
import { StaticChannelRoute } from "../../../channel/ChannelConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useCreateThreadViewProps from "../../../threads/native/useCreateThreadViewProps";
import useChannelRoleSubscriptionStatus from "../../../guild_role_subscriptions/useChannelRoleSubscriptionStatus";
import useKeyboardType from "../../../keyboard/native/useKeyboardType";
import { useStateFromStores } from "../../../../_bundle/defaultAreStatesEqual";
import { KeyboardTypes } from "../../../keyboard/native/KeyboardTypes";
import { isAndroid } from "../../../../utils/PlatformUtils";
import { resolveRefreshToken, useMobileVisualRefreshConfig } from "../../../themes/experiments/MobileVisualRefreshExperiment";
import { useToken } from "../../../../design/tokens/native/useToken";
import { useGradientBottom } from "../../../client_themes/native/ClientThemesOverrides";
let c6979_11 = {
LURKER: "lurker",
VOICE: "voice",
CHAT: "chat",
DIRECTORY: "directory",
EXPRESSION_PICKER: "expression",
MEDIA: "media",
APPS: "apps",
NONE: "none"
};
const useStyles = createStyles((a0) => ({
lurker: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER
},
chat: {
backgroundColor: a0
},
voice: {
backgroundColor: a0
},
expressionPickerBackground: {
backgroundColor: Module712.colors.MOBILE_KEYBOARD_GAP_BACKGROUND
}
}));
export default function useChannelSafeAreaBottomStyles(a0) {
const styles = useStyles(useToken(resolveRefreshToken(Module712.modules.mobile.CHANNEL_SAFE_AREA_BOTTOM_BACKGROUND, useMobileVisualRefreshConfig({
location: "useChannelSafeAreaBottomStyles"
}).chatInputFloating)));
const gradientBottom = useGradientBottom();
let c17949_1 = useCreateThreadViewProps(a0) != null;
const needSubscriptionToAccess = useChannelRoleSubscriptionStatus(a0).needSubscriptionToAccess;
let c17949_3 = useKeyboardType();
const stateFromStores = useStateFromStores([GatewayConnectionStore, ChannelStore, LurkingStore, MediaEngineStore, RTCConnectionStore], () => {
let r24, VOICE;
const channel = ChannelStore.getChannel(a0);
const r11 = channel == null ? void 0 : channel.getGuildId();
L47: {
if (a0 !== StaticChannelRoute.GUILD_HOME && (a0 !== StaticChannelRoute.ROLE_SUBSCRIPTIONS && !needSubscriptionToAccess)) {
if (GatewayConnectionStore.isConnected()) {
L44: {
if (MediaEngineStore.getMode() === InputModes.PUSH_TO_TALK && RTCConnectionStore.getChannelId() != null) {
VOICE = c6979_11.VOICE;
} else if (c17949_3 === KeyboardTypes.EXPRESSION && isAndroid()) {
VOICE = c6979_11.EXPRESSION_PICKER;
} else if (c17949_3 === KeyboardTypes.MEDIA && isAndroid()) {
VOICE = c6979_11.MEDIA;
} else if (c17949_3 === KeyboardTypes.APP_LAUNCHER && isAndroid()) {
VOICE = c6979_11.APPS;
} else if ((channel == null ? void 0 : channel.isDirectory()) === true) {
VOICE = c6979_11.DIRECTORY;
} else {
if (r11 != null && LurkingStore.isLurking(r11)) {
VOICE = c6979_11.LURKER;
break L44;
}
if ((channel == null ? void 0 : channel.isForumLikeChannel()) === true && !c17949_1) {
VOICE = c6979_11.CHAT;
break L44;
}
VOICE = a0 != null ? c6979_11.CHAT : c6979_11.NONE;
}
}
r24 = VOICE;
break L47;
}
if (a0 == null) {
r24 = c6979_11.NONE;
break L47;
}
r24 = c6979_11.CHAT;
} else {
r24 = c6979_11.NONE;
}
}
return r24;
});
return useMemo(() => {
let r14;
if (stateFromStores !== c6979_11.NONE && stateFromStores !== c6979_11.DIRECTORY) {
L14: {
if (stateFromStores !== c6979_11.EXPRESSION_PICKER && (stateFromStores !== c6979_11.MEDIA && stateFromStores !== c6979_11.APPS)) {
if (stateFromStores === c6979_11.CHAT) {
r14 = {
...styles.chat,
...gradientBottom
};
break L14;
}
if (stateFromStores === c6979_11.VOICE) {
r14 = {
...styles.voice,
...gradientBottom
};
break L14;
}
r14 = {
...styles[stateFromStores],
...gradientBottom
};
} else {
r14 = styles.expressionPickerBackground;
}
}
return r14;
}
}, [styles, gradientBottom, stateFromStores]);
};
@@ -0,0 +1,59 @@
// Metro module 10421 (f10422).
import useSafeAreaInsetsSharedValue_native from "../../../safe_area/useSafeAreaInsetsSharedValue.native";
import useSafeAreaBottomKeyboardInfoController from "./useSafeAreaBottomKeyboardInfoController";
import { useKeyboardTypeSharedValue, useKeyboardWillOpenSharedValue } from "../../../keyboard/native/useKeyboardType";
import useCustomKeyboardHeight from "../../../keyboard/native/useCustomKeyboardHeight";
import { useToken } from "../../../../design/tokens/native/useToken";
import Module712 from "../../../../_bundle/Module712";
import { useMobileVisualRefreshConfig } from "../../../themes/experiments/MobileVisualRefreshExperiment";
import { useDerivedValue } from "../../../reanimated/ReanimatedRexport";
import * as _KeyboardTypes from "../../../keyboard/native/KeyboardTypes";
const __initData = {
code: "function useChannelSafeAreaHeightSharedValueAndroidTsx1(){const{chatInputFloating,chatInputSpaceBottom,keyboardOpenOrOpening,keyboardWillOpenSharedValue,keyboardOpenedHeight,insets,keyboardTypeSharedValue,KeyboardTypes,customKeyboardHeight}=this.__closure;function resolveBottom(bottom){return chatInputFloating?Math.max(bottom,chatInputSpaceBottom):bottom;}if(keyboardOpenOrOpening.get()||keyboardWillOpenSharedValue.get()){const systemKeyboardHeight=keyboardOpenedHeight.get();if(systemKeyboardHeight<=0){return resolveBottom(insets.get().bottom);}return systemKeyboardHeight;}if(keyboardTypeSharedValue.get()===KeyboardTypes.SYSTEM){return resolveBottom(insets.get().bottom);}return customKeyboardHeight;}"
};
export default function useChannelSafeAreaHeightSharedValue() {
const safeAreaInsetsSharedValue_native = useSafeAreaInsetsSharedValue_native();
let c17943_0 = safeAreaInsetsSharedValue_native;
const safeAreaBottomKeyboardInfoController = useSafeAreaBottomKeyboardInfoController();
const { keyboardOpenOrOpening, keyboardOpenedHeight } = safeAreaBottomKeyboardInfoController;
const keyboardTypeSharedValue = useKeyboardTypeSharedValue();
const keyboardWillOpenSharedValue = useKeyboardWillOpenSharedValue();
const customKeyboardHeight = useCustomKeyboardHeight();
let c17943_5 = customKeyboardHeight;
const token = useToken(Module712.modules.mobile.CHAT_INPUT_FLOATING_OFFSET_MINIMUM);
const chatInputFloating = useMobileVisualRefreshConfig({
location: "ChatInput"
}).chatInputFloating;
const r44 = function() {
let r22;
if (!keyboardOpenOrOpening.get() && !keyboardWillOpenSharedValue.get()) {
if (keyboardTypeSharedValue.get() === _KeyboardTypes.KeyboardTypes.SYSTEM) {
const bottom = c17943_0.get().bottom;
r22 = chatInputFloating ? Math.max(bottom, token) : bottom;
} else {
r22 = c17943_5;
}
return r22;
}
let r32 = keyboardOpenedHeight.get();
if (r32 <= 0) {
const bottom2 = c17943_0.get().bottom;
r32 = chatInputFloating ? Math.max(bottom2, token) : bottom2;
}
return r32;
};
r44.__closure = {
chatInputFloating,
chatInputSpaceBottom: token,
keyboardOpenOrOpening,
keyboardWillOpenSharedValue,
keyboardOpenedHeight,
insets: safeAreaInsetsSharedValue_native,
keyboardTypeSharedValue,
KeyboardTypes: _KeyboardTypes.KeyboardTypes,
customKeyboardHeight
};
r44.__workletHash = 12051290156095;
r44.__initData = __initData;
return useDerivedValue(r44);
};
@@ -0,0 +1,169 @@
// Metro module 10424 (f10425).
import { useEffect } from "react";
import * as _MetaQuestUtils_android from "../../../device/MetaQuestUtils.android";
import * as _PlatformUtils from "../../../../utils/PlatformUtils";
import Module1593 from "../../../../_bundle/Module1593";
import { APP_ENTRY_KEYS } from "../../../window/native/AppEntryKey";
import { useAppEntryKey } from "../../../window/native/AppEntryKeyContext";
import { KeyboardController, KeyboardEvents, useKeyboardHandler } from "../../../../_bundle/Module1595";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import { useSharedValue } from "../../../reanimated/ReanimatedRexport";
import KeyboardStateDebugging from "../../../keyboard/KeyboardStateDebugging";
function $mk84621($env) {
return (a0) => {
let r1 = a0 !== $env[0];
if (r1) {
const r7 = $env.$parent;
r1 = (0, r7[1])(r7[2][3]).getImeInsets(false, a0) > 0;
}
return r1;
};
}
let env6978 = {};
const isMetaQuest = _MetaQuestUtils_android.isMetaQuest();
const c6978_4 = isMetaQuest;
const c6978_5 = {
code: "function useSafeAreaBottomKeyboardInfoControllerTsx1(e){const{runOnJS,KeyboardStateDebugging,IS_SYSTEM_KEYBOARD_EXTERNAL,keyboardOverlapsCurrentAppEntry,keyboardOpenedHeight}=this.__closure;runOnJS(KeyboardStateDebugging.keyboardControllerWorkletEvent)('onStart',e.height);if(IS_SYSTEM_KEYBOARD_EXTERNAL)return;if(e.height>0&&keyboardOverlapsCurrentAppEntry.get()){keyboardOpenedHeight.set(e.height);}}"
};
const c6978_6 = {
code: "function useSafeAreaBottomKeyboardInfoControllerTsx2(e){const{runOnJS,KeyboardStateDebugging,IS_SYSTEM_KEYBOARD_EXTERNAL,keyboardOverlapsCurrentAppEntry,keyboardOpenedHeight}=this.__closure;runOnJS(KeyboardStateDebugging.keyboardControllerWorkletEvent)('onEnd',e.height);if(IS_SYSTEM_KEYBOARD_EXTERNAL)return;if(e.height>0&&keyboardOverlapsCurrentAppEntry.get()){keyboardOpenedHeight.set(e.height);}}"
};
export default function useSafeAreaBottomKeyboardInfoController() {
const appEntryKey = useAppEntryKey();
let r23 = 0;
if (!c6978_4) {
let r28 = KeyboardController.state()?.height;
if (r28 == null) {
r28 = 0;
}
r23 = r28;
}
let r29 = r23 !== 0;
if (r29) {
let env17947;
const r30 = env17947 = {
$parent: env6978
};
env17947[0] = appEntryKey;
const isAndroid = _PlatformUtils.isAndroid();
let r5 = !isAndroid;
if (isAndroid) {
let r40 = Module1593.getImeInsets(false, appEntryKey) > 0;
if (!r40) {
const r46 = APP_ENTRY_KEYS.some($mk84621(r30));
r40 = r46 ? !r46 : null;
}
r5 = r40;
}
r29 = r5 === true;
}
const sharedValue = useSharedValue(r29 ? r23 : 0);
const sharedValue2 = useSharedValue(r29);
const sharedValue3 = useSharedValue(r29);
useEffect(() => {
let c26671_0, c26671_1, c26671_2, c26671_3, c26671_4;
const handleKeyboardShow2 = function handleKeyboardShow(a0) {
if (!(a0 <= 0)) {
let env30219;
const r6 = env30219 = {
$parent: env6978
};
env30219[0] = appEntryKey;
const isAndroid = _PlatformUtils.isAndroid();
let r3 = !isAndroid;
if (isAndroid) {
let r21 = Module1593.getImeInsets(false, appEntryKey) > 0;
if (!r21) {
const r27 = APP_ENTRY_KEYS.some($mk84621(r6));
r21 = r27 ? !r27 : null;
}
r3 = r21;
}
if (r3 != null) {
sharedValue3.set(r3);
}
if (r3 !== false) {
if (r3 === true) {
sharedValue2.set(true);
sharedValue.set(a0);
}
} else {
sharedValue2.set(false);
}
}
};
if (c6978_4) {
return void 0;
}
c26671_0 = false;
c26671_1 = KeyboardEvents.addListener("keyboardWillShow", (a0) => {
KeyboardStateDebugging.keyboardControllerKeyboardWillShow(a0.height);
c26671_0 = true;
handleKeyboardShow2(a0.height);
});
c26671_2 = KeyboardEvents.addListener("keyboardDidShow", (a0) => {
KeyboardStateDebugging.keyboardControllerKeyboardDidShow(a0.height);
c26671_0 = false;
handleKeyboardShow2(a0.height);
});
c26671_3 = KeyboardEvents.addListener("keyboardWillHide", () => {
KeyboardStateDebugging.keyboardControllerKeyboardWillHide();
if (sharedValue3.get() && !c26671_0) {
sharedValue2.set(false);
}
});
c26671_4 = KeyboardEvents.addListener("keyboardDidHide", () => {
KeyboardStateDebugging.keyboardControllerKeyboardDidHide();
if (sharedValue3.get()) {
c26671_0 = false;
sharedValue2.set(false);
}
});
return () => {
c26671_1.remove();
c26671_2.remove();
c26671_3.remove();
c26671_4.remove();
};
}, [appEntryKey, sharedValue2, sharedValue, sharedValue3]);
const onStart = function(a0) {
_ReanimatedRexport.runOnJS(KeyboardStateDebugging.keyboardControllerWorkletEvent)("onStart", a0.height);
if (!c6978_4 && a0.height > 0 && sharedValue3.get()) {
sharedValue.set(a0.height);
}
};
onStart.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
KeyboardStateDebugging,
IS_SYSTEM_KEYBOARD_EXTERNAL: c6978_4,
keyboardOverlapsCurrentAppEntry: sharedValue3,
keyboardOpenedHeight: sharedValue
};
onStart.__workletHash = 11726427166555;
onStart.__initData = c6978_5;
const l = function l(a0) {
_ReanimatedRexport.runOnJS(KeyboardStateDebugging.keyboardControllerWorkletEvent)("onEnd", a0.height);
if (!c6978_4 && a0.height > 0 && sharedValue3.get()) {
sharedValue.set(a0.height);
}
};
l.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
KeyboardStateDebugging,
IS_SYSTEM_KEYBOARD_EXTERNAL: c6978_4,
keyboardOverlapsCurrentAppEntry: sharedValue3,
keyboardOpenedHeight: sharedValue
};
l.__workletHash = 15110866363831;
l.__initData = c6978_6;
useKeyboardHandler({
onStart,
onEnd: l
}, []);
return {
keyboardOpenOrOpening: sharedValue2,
keyboardOpenedHeight: sharedValue,
keyboardOverlapsCurrentAppEntry: sharedValue3
};
};
export { isMetaQuest as IS_SYSTEM_KEYBOARD_EXTERNAL };
@@ -0,0 +1,123 @@
// Metro module 15576 (f15577).
import { useLayoutEffect } from "react";
import { View } from "react-native";
import { createNativeStackNavigator } from "../../../../_bundle/Module9109";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import PressableNavigatorButtonWrapper from "../shared_components/navigator/PressableNavigatorButtonWrapper";
import { HeaderIconButton, GenericHeaderTitle, getRenderModalCloseImage, getRenderModalBackImage, HeaderTextButton } from "../shared_components/HeaderShared";
import Module11690 from "../../../../_bundle/Module11690";
import { intl, t } from "../../../../intl/index.native";
import useThemedHeaderOptions from "../../../client_themes/native/useThemedHeaderOptions";
import { trackAppUIViewed } from "../../../tti_analytics/native/TTIAnalyticsUtils";
import { useAccessibilityNativeStackOptions } from "../../../../design/components/Navigator/native/Navigator.native";
import * as _FriendsScreen from "./screens/FriendsScreen";
import * as _NewMessageScreen from "./screens/NewMessageScreen";
import * as _NewGroupDMScreen from "./screens/NewGroupDMScreen";
import * as _AddFriendScreen from "./screens/AddFriendScreen";
import * as _AddFriendsScreen from "./screens/AddFriendsScreen";
import * as _UsernameSearchScreen from "./screens/UsernameSearchScreen";
import * as _SuggestedFriendsScreen from "./screens/SuggestedFriendsScreen";
import * as _FriendRequestsSettingsScreen from "./screens/FriendRequestsSettingsScreen";
import * as _FriendRequestsScreen from "./screens/FriendRequestsScreen";
import * as _SpamRequestsScreen from "./screens/SpamRequestsScreen";
import * as _IgnoredUserRequestsScreen from "./screens/IgnoredUserRequestsScreen";
import useColorThemeBackground from "../../../client_themes/native/useColorThemeBackground";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { ThemeContextProvider } from "../../../../_bundle/Module3901";
import { HermesBuiltin } from "../../../../_hermes/prelude";
let nativeStackNavigator, useStyles, FriendsNavigator;
const RequestsSettingsModalButton = function RequestsSettingsModalButton(props) {
return <PressableNavigatorButtonWrapper isModal>
<HeaderIconButton source={Module11690} onPress={props.onPress} accessibilityLabel={intl.string(t["3D5yo/"])} />
</PressableNavigatorButtonWrapper>;
};
FriendsNavigator = function FriendsNavigator() {
let accessibilityNativeStackOptions;
const styles = useStyles();
let c22206_1 = useThemedHeaderOptions();
useLayoutEffect(() => trackAppUIViewed(), []);
accessibilityNativeStackOptions = useAccessibilityNativeStackOptions();
return <nativeStackNavigator.Navigator screenOptions={({ navigation: navigation3, route }) => {
const presentation = route.params?.presentation;
const r15 = {};
HermesBuiltin.copyDataProperties(r15, c22206_1);
const presentation2 = route.params?.presentation;
const r19 = presentation === "card";
r15.contentStyle = presentation2 !== "card" ? r19 ? null : c22206_1.contentStyle : null;
r15.headerStyle = styles.header;
r15.headerShadowVisible = false;
r15.headerTitle = (a0) => {
const { children, ...rest } = a0;
return <GenericHeaderTitle title={a0.children} {...rest} />;
};
r15.headerTitleAlign = "center";
r15.headerLeft = navigation3.getState().routes[0].key === route.key ? route.params?.presentation !== "card" ? getRenderModalCloseImage(navigation3) : getRenderModalBackImage(navigation3) : getRenderModalBackImage(navigation3);
r15.fullScreenGestureEnabled = route.params?.presentation === "card" || r19;
HermesBuiltin.copyDataProperties(r15, accessibilityNativeStackOptions);
return r15;
}}>
<nativeStackNavigator.Screen name="root" options={({ navigation }) => ({
title: intl.string(t.TdEu5X),
headerRight: (a0) => <HeaderTextButton {...a0} label={intl.string(t.zIJnA6)} onPress={() => navigation.navigate("add-friends", {
sourcePage: "Friends Screen Header"
})} />
})} getComponent={() => _FriendsScreen.default} />
<nativeStackNavigator.Screen name="new-message" options={{
title: intl.string(t.jD1qzM)
}} getComponent={() => _NewMessageScreen.default} />
<nativeStackNavigator.Screen name="gdm" options={{
title: intl.string(t["3hF1W4"])
}} getComponent={() => _NewGroupDMScreen.default} />
<nativeStackNavigator.Screen name="add-friend" options={{
title: intl.string(t.w5uwoI)
}} getComponent={() => _AddFriendScreen.default} />
<nativeStackNavigator.Screen name="add-friends" options={{
title: intl.string(t.zIJnA6)
}} getComponent={() => _AddFriendsScreen.default} />
<nativeStackNavigator.Screen name="username-search" options={{
title: intl.string(t.QzVsOs)
}} getComponent={() => _UsernameSearchScreen.default} />
<nativeStackNavigator.Screen name="suggested-friends" options={{
title: intl.string(t["1uAmCw"])
}} getComponent={() => _SuggestedFriendsScreen.default} />
<nativeStackNavigator.Screen name="requests-settings" options={{
title: intl.string(t.XT4hVl)
}} getComponent={() => _FriendRequestsSettingsScreen.default} />
<nativeStackNavigator.Screen name="requests" options={({ navigation: navigation2 }) => ({
title: intl.string(t.fyA115),
headerRight: () => <RequestsSettingsModalButton onPress={() => navigation2.navigate("requests-settings")} />
})} getComponent={() => _FriendRequestsScreen.default} />
<nativeStackNavigator.Screen name="spam-requests" options={{
title: intl.string(t.oHVeHc)
}} getComponent={() => _SpamRequestsScreen.default} />
<nativeStackNavigator.Screen name="ignored-user-requests" options={{
title: intl.string(t.tFY5Zb)
}} getComponent={() => _IgnoredUserRequestsScreen.default} />
</nativeStackNavigator.Navigator>;
};
nativeStackNavigator = createNativeStackNavigator();
useStyles = createStyles({
container: {
flex: 1,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST
},
header: {
borderBottomWidth: 0,
backgroundColor: Module712.colors.MOBILE_ACTIONSHEET_BACKGROUND,
shadowColor: "transparent"
}
});
export default function ThemedFriendsNavigator() {
const colorThemeBackground = useColorThemeBackground();
const safeAreaInsets_native = useSafeAreaInsets_native();
const { left, right } = safeAreaInsets_native;
return <ThemeContextProvider gradient={colorThemeBackground}>
<View style={[useStyles().container, {
paddingLeft: left,
paddingRight: right
}]}>
<FriendsNavigator />
</View>
</ThemeContextProvider>;
};
@@ -0,0 +1,133 @@
// Metro module 15312 (f15313).
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import { AccessibilityAnnouncer } from "../../../../../_bundle/Module3902";
import * as _ReanimatedRexport from "../../../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useAnimatedStyle, useAnimatedReaction } from "../../../../reanimated/ReanimatedRexport";
import { Text } from "../../../../../design/components/Text/native/Text";
import { useFontScale } from "../../../../screen/native/useFontScale";
import * as _timing from "../../../../../design/animation/reanimated/timing/timing";
let useStyles, AnimatedComponent, __initData, __initData2, __initData3, __initData4, __initData5;
const announceActioned = function announceActioned(a0) {
AccessibilityAnnouncer.announce(a0);
};
useStyles = createStyles(() => ({
container: {
overflow: "hidden"
},
actionStatus: {
position: "absolute"
}
}));
AnimatedComponent = ReanimatedRexport.createAnimatedComponent(Text);
__initData = {
code: "function ActionStatusSubLabelTsx1(){const{hasSecondLine,actioned,lineHeight,fontScale,animate,withTiming,interpolate}=this.__closure;const currentlyHasSecondLine=hasSecondLine&&!actioned.get();const lineHeightValue=lineHeight*fontScale;const currentLineHeightValue=currentlyHasSecondLine?lineHeightValue*2:lineHeightValue;return{height:!animate||!actioned.get()?currentLineHeightValue:withTiming(interpolate(actioned.get()?1:0,[0,1],[currentlyHasSecondLine?lineHeightValue*2:lineHeightValue,lineHeightValue]))};}"
};
__initData2 = {
code: "function ActionStatusSubLabelTsx2(){const{actioned,lineHeight,fontScale,animate,withTiming,interpolate}=this.__closure;const translateYValue=actioned.get()?lineHeight*fontScale:0;return{transform:[{translateY:!animate?translateYValue:withTiming(interpolate(actioned.get()?1:0,[0,1],[0,translateYValue]))}]};}"
};
__initData3 = {
code: "function ActionStatusSubLabelTsx3(){const{actioned,lineHeight,fontScale,animate,withTiming,interpolate}=this.__closure;const translateYValue=actioned.get()?0:-lineHeight*fontScale;return{transform:[{translateY:!animate?translateYValue:withTiming(interpolate(actioned.get()?1:0,[0,1],[translateYValue,0]))}],opacity:!animate?actioned.get()?1:0:withTiming(actioned.get()?1:0)};}"
};
__initData4 = {
code: "function ActionStatusSubLabelTsx4(){const{actioned}=this.__closure;return actioned.get();}"
};
__initData5 = {
code: "function ActionStatusSubLabelTsx5(actioned,actionedPrev){const{actionStatusAccessibilityLabel,runOnJS,announceActioned}=this.__closure;const isActioned=actioned&&actionedPrev===false;if(!isActioned||actionStatusAccessibilityLabel==null){return;}runOnJS(announceActioned)(actionStatusAccessibilityLabel);}"
};
export function ActionStatusSubLabel(props) {
let lineHeight = props.lineHeight;
if (lineHeight === void 0) {
lineHeight = 16;
}
let c21862_0 = lineHeight;
const { textVariant = "text-xs/medium", actioned, label, secondaryLabel, actionStatus, actionStatusAccessibilityLabel, maxFontSizeMultiplier, animate } = props;
let hasSecondLine = secondaryLabel != null;
let c21862_4 = hasSecondLine;
const fontScale = useFontScale();
const styles = useStyles();
const L = function L() {
const r2 = c21862_4 && !actioned.get();
const r11 = c21862_0 * fontScale;
const r16 = r2 ? 2 * r11 : r11;
return {
height: animate ? actioned.get() ? _timing.withTiming(_ReanimatedRexport.interpolate(actioned.get() ? 1 : 0, [0, 1], [r2 ? 2 * r11 : r11, r11])) : r16 : r16
};
};
L.__closure = {
hasSecondLine,
actioned,
lineHeight,
fontScale,
animate,
withTiming: _timing.withTiming,
interpolate: _ReanimatedRexport.interpolate
};
L.__workletHash = 14210085997091;
L.__initData = __initData;
const animatedStyle = useAnimatedStyle(L);
const y = function y() {
const r11 = actioned.get() ? c21862_0 * fontScale : 0;
return {
transform: [{
translateY: animate ? _timing.withTiming(_ReanimatedRexport.interpolate(actioned.get() ? 1 : 0, [0, 1], [0, r11])) : r11
}]
};
};
y.__closure = {
actioned,
lineHeight,
fontScale,
animate,
withTiming: _timing.withTiming,
interpolate: _ReanimatedRexport.interpolate
};
y.__workletHash = 1040596522101;
y.__initData = __initData2;
const animatedStyle2 = useAnimatedStyle(y);
const V = function V() {
const r13 = actioned.get() ? 0 : -c21862_0 * fontScale;
return {
transform: [{
translateY: animate ? _timing.withTiming(_ReanimatedRexport.interpolate(actioned.get() ? 1 : 0, [0, 1], [r13, 0])) : r13
}],
opacity: animate ? _timing.withTiming(actioned.get() ? 1 : 0) : actioned.get() ? 1 : 0
};
};
V.__closure = {
actioned,
lineHeight,
fontScale,
animate,
withTiming: _timing.withTiming,
interpolate: _ReanimatedRexport.interpolate
};
V.__workletHash = 2183035188794;
V.__initData = __initData3;
const animatedStyle3 = useAnimatedStyle(V);
const Y = () => actioned.get();
Y.__closure = {
actioned
};
Y.__workletHash = 9609826744629;
Y.__initData = __initData4;
const v = function v(a0, a1) {
if ((a0 ? a1 === false : a0) && actionStatusAccessibilityLabel != null) {
_ReanimatedRexport.runOnJS(announceActioned)(actionStatusAccessibilityLabel);
}
};
v.__closure = {
actionStatusAccessibilityLabel,
runOnJS: _ReanimatedRexport.runOnJS,
announceActioned
};
v.__workletHash = 14141240445417;
v.__initData = __initData5;
useAnimatedReaction(Y, v);
const r93 = [<AnimatedComponent variant={textVariant} maxFontSizeMultiplier={maxFontSizeMultiplier} color="text-default" style={animatedStyle2} lineClamp={1}>{label}</AnimatedComponent>, , ,];
if (hasSecondLine) {
hasSecondLine = <AnimatedComponent variant={textVariant} maxFontSizeMultiplier={maxFontSizeMultiplier} style={animatedStyle2} color="text-default" lineClamp={1}>{secondaryLabel}</AnimatedComponent>;
}
r93[1] = hasSecondLine;
r93[2] = <AnimatedComponent variant={textVariant} maxFontSizeMultiplier={maxFontSizeMultiplier} color="text-default" style={[styles.actionStatus, animatedStyle3]} lineClamp={1}>{actionStatus}</AnimatedComponent>;
return <ReanimatedRexport.View style={[styles.container, animatedStyle]}>{r93}</ReanimatedRexport.View>;
}
@@ -0,0 +1,66 @@
// Metro module 15603 (f15604).
import { Image as Image2, View } from "react-native";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import Module11784 from "../../../../../_bundle/Module11784";
import { Text } from "../../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../../intl/index.native";
import { handleOpenLearnMoreLink } from "../../../../contact_sync/native/ContactSyncUtils";
import { Button } from "../../../../../design/components/Button/native/Button.native";
import { openContactSyncModal } from "../../../../contact_sync/native/ContactSyncModalActionCreators";
const useStyles = createStyles({
content: {
alignItems: "center",
marginTop: Module712.space.PX_24,
marginHorizontal: Module712.space.PX_16,
paddingBottom: Module712.space.PX_12,
backgroundColor: Module712.colors.CARD_BACKGROUND_DEFAULT,
borderRadius: Module712.radii.lg
},
headerImage: {
height: 135,
width: 216,
marginTop: Module712.space.PX_24,
marginBottom: Module712.space.PX_16
},
title: {
marginBottom: Module712.space.PX_8,
width: "100%",
textAlign: "center"
},
subtitle: {
marginBottom: Module712.space.PX_24,
paddingHorizontal: Module712.space.PX_48,
width: "100%",
alignContent: "center"
},
subtitleText: {
textAlign: "center"
},
trailing: {
width: "100%",
paddingBottom: Module712.space.PX_4,
paddingHorizontal: Module712.space.PX_12
}
});
export default function AddFriendsContactSyncEmptyState() {
const styles = useStyles();
return <View style={styles.content}>
<Image2 resizeMode="contain" style={styles.headerImage} source={Module11784} />
<Text style={styles.title} variant="heading-lg/bold" color="mobile-text-heading-primary">
{intl.string(t["/G+nci"])}
</Text>
<View style={styles.subtitle}>
<Text style={styles.subtitleText} variant="text-sm/medium">
{intl.format(t.OXdOPf, {
learnMoreHook: handleOpenLearnMoreLink
})}
</Text>
</View>
<View style={styles.trailing}>
<Button variant="primary" size="lg" text={intl.string(t.QUXSpo)} onPress={function onPress() {
openContactSyncModal({}, "Add Friends Contact Sync Empty State");
}} />
</View>
</View>;
};
@@ -0,0 +1,111 @@
// Metro module 15041 (f15042).
import ChannelStore from "../../../../../stores/ChannelStore";
import { AnalyticsSections } from "../../../../../Constants";
import { MessageSendLocation } from "../../../../messages/MessageConstants";
import PeopleUtils from "../../../../people/PeopleUtils";
import ChannelActionCreators from "../../../../../actions/ChannelActionCreators";
import { presentError } from "../../../../toast/native/ToastUtils";
import { intl, t } from "../../../../../intl/index.native";
import { trackWaveCtaClicked } from "../../../../channel/trackWaveCtaClicked";
import MessageActionCreators from "../../../../../actions/MessageActionCreators";
import RelationshipActionCreators from "../../../../../actions/RelationshipActionCreators";
export function dismissIncomingRequest(a0) {
PeopleUtils.cancelFriendRequest({
userId: a0.userId,
applicationId: a0.applicationId,
location: AnalyticsSections.FRIENDS_ADD_FRIENDS_MODAL
});
}
export function acceptIncomingRequest(a0) {
PeopleUtils.maybeConfirmFriendRequestAccept({
userId: a0.userId,
applicationId: a0.applicationId,
location: AnalyticsSections.FRIENDS_ADD_FRIENDS_MODAL
});
}
export async function sendWave(c27935_0, c27935_1, c27935_2) {
let c27935_6 = 0;
let c30833_1, c30833_2, c30833_0, c30833_3;
L17: {
try {
c30833_1 = void 0;
c30833_2 = void 0;
c30833_0 = c27935_0;
if (c27935_1 !== void 0) {
c30833_1 = c27935_1;
c30833_2 = c27935_2;
c30833_3 = void 0;
} else {
c30833_1 = true;
c30833_2 = c27935_2;
c30833_3 = void 0;
}
await void 0;
c30833_3 = ChannelStore.getDMFromUserId(c30833_0);
if (c30833_3 == null) {
c27935_6 = 1;
c30833_3 = await ChannelActionCreators.getDMChannel(c30833_0);
c27935_6 = 0;
}
c27935_6 = 2;
if (c30833_3 != null) {
trackWaveCtaClicked({
channelId: c30833_3,
source: c30833_2
});
await MessageActionCreators.sendStickers(c30833_3, ["749054660769218631"], "", {
location: MessageSendLocation.SEND_WAVE
});
if (c30833_1) {
ChannelActionCreators.openPrivateChannel({
recipientIds: c30833_0
});
}
}
c27935_6 = 0;
} catch ($e) {
let r8 = $e;
let r39 = c27935_6;
if (r39 !== 0) {
while (true) {
if (r39 === 1) {
try {
c27935_6 = 0;
presentError(intl.string(t.iufib1));
} catch ($e) {
r8 = $e;
r39 = c27935_6;
if (r39 === 0) {
break;
}
continue;
}
return void 0;
}
try {
c27935_6 = 0;
presentError(intl.string(t.iufib1));
break L17;
} catch ($e) {
r8 = $e;
r39 = c27935_6;
if (r39 === 0) {
break;
}
}
}
}
throw r8;
}
}
}
export function addContactSuggestion(a0) {
RelationshipActionCreators.addRelationship({
userId: a0.id,
context: {
location: AnalyticsSections.FRIENDS_ADD_FRIENDS_MODAL
},
type: void 0,
fromFriendSuggestion: true
});
}
@@ -0,0 +1,17 @@
// Metro module 15609 (f15610).
import RelationshipActionCreators from "../../../../../actions/RelationshipActionCreators";
import { AlertModal, AlertActionButton } from "../../../../../design/components/AlertModal/native/AlertModal.native";
import { intl, t } from "../../../../../intl/index.native";
import { AlertActions } from "../../../../../design/components/AlertModal/native/AlertModal.native";
const handleConfirm = async function handleConfirm() {
await RelationshipActionCreators.clearPendingRelationships();
};
export default function ClearAllIncomingRequestsAlertModal(props) {
const incomingRequestCount = props.incomingRequestCount;
return <AlertModal title={intl.string(t.z2pFjo)} content={intl.formatToPlainString(t["0nTvEw"], {
incomingRequestCount
})} actions={<AlertActions>
<AlertActionButton key="confirm" variant="destructive" onPress={handleConfirm} text={intl.string(t["cY+Oob"])} />
<AlertActionButton key="cancel" variant="secondary" text={intl.string(t["ETE/oC"])} />
</AlertActions>} />;
};
@@ -0,0 +1,195 @@
// Metro module 15313 (f15314).
import { useCallback } from "react";
import { View } from "react-native";
import * as _ReanimatedRexport from "../../../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { Easing, useSharedValue, useAnimatedStyle, useAnimatedReaction } from "../../../../reanimated/ReanimatedRexport";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { addContactSuggestion } from "./AddFriendsScreenUtils";
import * as _timing from "../../../../../design/animation/reanimated/timing/timing";
import * as _spring from "../../../../../design/animation/reanimated/spring/spring";
import { Icon } from "../../../../../design/void/native";
import Module15314 from "../../../../../_bundle/Module15314";
import { Button } from "../../../../../design/components/Button/native/Button.native";
import { intl, t } from "../../../../../intl/index.native";
const OPACITY_CONFIG = {
duration: 200,
easing: Easing.in(Easing.quad)
};
const OPACITY_OUT_CONFIG = {
duration: 250,
easing: Easing.in(Easing.quad)
};
const SCALE_CONFIG = {
duration: 250,
easing: Easing.in(Easing.quad)
};
const TRANSLATE_OUT_CONFIG = {
duration: 250,
easing: Easing.out(Easing.quad)
};
const SPRING_CONFIG = {
mass: 1,
stiffness: 172,
damping: 17.3
};
const useStyles = createStyles({
icon: {
position: "absolute",
top: 4,
zIndex: 2,
color: Module712.colors.INTERACTIVE_TEXT_DEFAULT,
opacity: 0
}
});
const __initData = {
code: "function ContactSuggestionActionsTsx1(){const{right,opacity,scale}=this.__closure;return{right:right.get(),opacity:opacity.get(),transform:[{scale:scale.get()}]};}"
};
const __initData2 = {
code: "function ContactSuggestionActionsTsx2(){const{buttonOpacity}=this.__closure;return{opacity:buttonOpacity.get()};}"
};
const __initData3 = {
code: "function ContactSuggestionActionsTsx3(){const{added}=this.__closure;return added.get();}"
};
const __initData4 = {
code: "function ContactSuggestionActionsTsx4(added){const{animate,runOnJS,finishAnimationCallback,scale,withTiming,SCALE_CONFIG,opacity,OPACITY_CONFIG,buttonOpacity,right,withSpring,SPRING_CONFIG,withDelay,OPACITY_OUT_CONFIG,TRANSLATE_OUT_CONFIG}=this.__closure;if(!animate){runOnJS(finishAnimationCallback)();return;}if(added){scale.set(withTiming(1,SCALE_CONFIG));opacity.set(withTiming(1,OPACITY_CONFIG));buttonOpacity.set(withTiming(0,OPACITY_CONFIG));right.set(withSpring(12,SPRING_CONFIG,'respect-motion-settings',function(finished){if(!finished)return;opacity.set(withDelay(1000,withTiming(0,OPACITY_OUT_CONFIG)));scale.set(withDelay(1000,withTiming(0.5,SCALE_CONFIG)));right.set(withDelay(1000,withTiming(-8,TRANSLATE_OUT_CONFIG,'respect-motion-settings',function(finished){if(finished)runOnJS(finishAnimationCallback)();})));}));}else{buttonOpacity.set(1);scale.set(0.5);opacity.set(0);right.set(30);}}"
};
const __initData5 = {
code: "function ContactSuggestionActionsTsx5(finished){const{opacity,withDelay,withTiming,OPACITY_OUT_CONFIG,scale,SCALE_CONFIG,right,TRANSLATE_OUT_CONFIG,runOnJS,finishAnimationCallback}=this.__closure;if(!finished)return;opacity.set(withDelay(1000,withTiming(0,OPACITY_OUT_CONFIG)));scale.set(withDelay(1000,withTiming(0.5,SCALE_CONFIG)));right.set(withDelay(1000,withTiming(-8,TRANSLATE_OUT_CONFIG,'respect-motion-settings',function(finished){if(finished)runOnJS(finishAnimationCallback)();})));}"
};
const __initData6 = {
code: "function ContactSuggestionActionsTsx6(finished){const{runOnJS,finishAnimationCallback}=this.__closure;if(finished)runOnJS(finishAnimationCallback)();}"
};
export function ContactSuggestionActions(props) {
const { user, added, onAddSuggestion, onFinishAnimation, size = "sm", animate } = props;
const styles = useStyles();
const sharedValue = useSharedValue(30);
const sharedValue2 = useSharedValue(0.5);
const sharedValue3 = useSharedValue(0);
const sharedValue4 = useSharedValue(1);
const callback = useCallback(() => {
if (onFinishAnimation != null) {
setTimeout(() => {
onFinishAnimation(user);
}, 1000);
}
}, [onFinishAnimation, user]);
const b = () => ({
right: sharedValue.get(),
opacity: sharedValue3.get(),
transform: [{
scale: sharedValue2.get()
}]
});
b.__closure = {
right: sharedValue,
opacity: sharedValue3,
scale: sharedValue2
};
b.__workletHash = 13774422449074;
b.__initData = __initData;
const animatedStyle = useAnimatedStyle(b);
const E = () => ({
opacity: sharedValue4.get()
});
E.__closure = {
buttonOpacity: sharedValue4
};
E.__workletHash = 4378005846847;
E.__initData = __initData2;
const animatedStyle2 = useAnimatedStyle(E);
const callback2 = useCallback(() => {
addContactSuggestion(user);
onAddSuggestion(user);
added.set(true);
if (!animate) {
sharedValue.set(12);
sharedValue3.set(1);
sharedValue2.set(1);
sharedValue4.set(0);
}
}, [onAddSuggestion, user, added, animate, sharedValue, sharedValue3, sharedValue2, sharedValue4]);
const k = () => added.get();
k.__closure = {
added
};
k.__workletHash = 15816115253403;
k.__initData = __initData3;
const D = function D(a0) {
if (animate) {
if (a0) {
sharedValue2.set(_timing.withTiming(1, SCALE_CONFIG));
sharedValue3.set(_timing.withTiming(1, OPACITY_CONFIG));
sharedValue4.set(_timing.withTiming(0, OPACITY_CONFIG));
const r76 = function n(a0) {
if (a0) {
sharedValue3.set(_ReanimatedRexport.withDelay(1000, _timing.withTiming(0, OPACITY_OUT_CONFIG)));
sharedValue2.set(_ReanimatedRexport.withDelay(1000, _timing.withTiming(0.5, SCALE_CONFIG)));
const r47 = function n(a0) {
if (a0) {
_ReanimatedRexport.runOnJS(callback)();
}
};
r47.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
finishAnimationCallback: callback
};
r47.__workletHash = 5242616772399;
r47.__initData = __initData6;
sharedValue.set(_ReanimatedRexport.withDelay(1000, _timing.withTiming(-8, TRANSLATE_OUT_CONFIG, "respect-motion-settings", r47)));
}
};
r76.__closure = {
opacity: sharedValue3,
withDelay: _ReanimatedRexport.withDelay,
withTiming: _timing.withTiming,
OPACITY_OUT_CONFIG,
scale: sharedValue2,
SCALE_CONFIG,
right: sharedValue,
TRANSLATE_OUT_CONFIG,
runOnJS: _ReanimatedRexport.runOnJS,
finishAnimationCallback: callback
};
r76.__workletHash = 9570116008915;
r76.__initData = __initData5;
sharedValue.set(_spring.withSpring(12, SPRING_CONFIG, "respect-motion-settings", r76));
} else {
sharedValue4.set(1);
sharedValue2.set(0.5);
sharedValue3.set(0);
sharedValue.set(30);
}
} else {
_ReanimatedRexport.runOnJS(callback)();
}
};
D.__closure = {
animate,
runOnJS: _ReanimatedRexport.runOnJS,
finishAnimationCallback: callback,
scale: sharedValue2,
withTiming: _timing.withTiming,
SCALE_CONFIG,
opacity: sharedValue3,
OPACITY_CONFIG,
buttonOpacity: sharedValue4,
right: sharedValue,
withSpring: _spring.withSpring,
SPRING_CONFIG,
withDelay: _ReanimatedRexport.withDelay,
OPACITY_OUT_CONFIG,
TRANSLATE_OUT_CONFIG
};
D.__workletHash = 6602847520399;
D.__initData = __initData4;
useAnimatedReaction(k, D);
return <View>
<ReanimatedRexport.View pointerEvents="none" style={[styles.icon, animatedStyle]}>
<Icon source={Module15314} color={styles.icon.color} />
</ReanimatedRexport.View>
<ReanimatedRexport.View style={animatedStyle2}>
<Button variant="secondary" size={size} grow={false} text={intl.string(t.OYkgVk)} onPress={callback2} />
</ReanimatedRexport.View>
</View>;
}
@@ -0,0 +1,65 @@
// Metro module 15602 (f15603).
import { useEffect, useMemo, useCallback } from "react";
import AccessibilityStore from "../../../../a11y/AccessibilityStore";
import { AnalyticEvents, InstantInviteSources, RelationshipTypes } from "../../../../../Constants";
import UserUtils from "../../../../../utils/UserUtils";
import { useSharedValue } from "../../../../reanimated/ReanimatedRexport";
import { intl, t } from "../../../../../intl/index.native";
import { useStateFromStores } from "../../../../../_bundle/defaultAreStatesEqual";
import { addContactSuggestion } from "./AddFriendsScreenUtils";
import { getSuggestedContactNameForSuggestion } from "../../../../friend_suggestions/FriendSuggestionUtils";
import UserRow from "../../shared_components/user_list/UserRow";
import { ActionStatusSubLabel } from "./ActionStatusSubLabel";
import { ContactSuggestionActions } from "./ContactSuggestionActions";
import AnalyticsUtils from "../../../../../utils/AnalyticsUtils";
let c11127_9 = {
ADD: "add"
};
export function ContactSuggestionRow(props) {
const { suggestedFriend, added, onAddSuggestion: onAddSuggestion2, ...props2 } = props;
let c22239_3 = props2;
const label = suggestedFriend.friendSuggestionName != null && suggestedFriend.friendSuggestionName.length > 0 ? suggestedFriend.friendSuggestionName : UserUtils.getName(suggestedFriend.user);
const sharedValue = useSharedValue(false);
useEffect(() => {
sharedValue.set(added);
}, [added, sharedValue]);
const memo = useMemo(() => added ? [] : [{
name: c11127_9.ADD,
label: intl.string(t["ed99+i"])
}], [added]);
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
const callback = useCallback((a0) => {
if (a0.nativeEvent.actionName === c11127_9.ADD) {
sharedValue.set(true);
onAddSuggestion2(suggestedFriend.user);
return addContactSuggestion(suggestedFriend.user);
}
}, [sharedValue, onAddSuggestion2, suggestedFriend.user]);
const r58 = suggestedFriend?.mutualFriendsCount != null && suggestedFriend?.mutualFriendsCount > 0;
const suggestedContactNameForSuggestion = getSuggestedContactNameForSuggestion(label, suggestedFriend);
const label2 = suggestedContactNameForSuggestion != null ? `${UserUtils.getUserTag(suggestedFriend.user)} · ${suggestedContactNameForSuggestion}` : UserUtils.getUserTag(suggestedFriend.user);
let secondaryLabel = void 0;
if (r58) {
const z7y34b = t.z7y34b;
let count = suggestedFriend?.mutualFriendsCount;
if (count == null) {
count = "";
}
secondaryLabel = intl.formatToPlainString(z7y34b, {
count
});
}
return <UserRow {...props2} user={suggestedFriend.user} type={RelationshipTypes.SUGGESTION} accessibilityActions={memo} onAccessibilityAction={callback} labelLineClamp={1} subLabelLineClamp={1} label={label} subLabel={<ActionStatusSubLabel actioned={sharedValue} label={label2} secondaryLabel={secondaryLabel} actionStatus={intl.string(t.Kzyxm9)} animate={!stateFromStores} />} trailing={<ContactSuggestionActions user={suggestedFriend.user} added={sharedValue} onAddSuggestion={(event) => {
const FRIEND_SUGGESTION_ADDED = AnalyticEvents.FRIEND_SUGGESTION_ADDED;
let location2 = c22239_3.location;
if (location2 == null) {
location2 = InstantInviteSources.ADD_FRIENDS_MODAL;
}
AnalyticsUtils.track(FRIEND_SUGGESTION_ADDED, {
suggested_user_id: event.id,
suggestion_source: suggestedFriend.source,
location: location2
});
onAddSuggestion2(event);
}} animate={!stateFromStores} />} />;
}
@@ -0,0 +1,125 @@
// Metro module 15600 (f15601).
import { useEffect, useMemo, useCallback } from "react";
import AccessibilityStore from "../../../../a11y/AccessibilityStore";
import ApplicationStore from "../../../../applications/ApplicationStore";
import { UserRowModes } from "../../shared_components/user_list/UserRowConstants";
import { RelationshipTypes } from "../../../../../Constants";
import { useSharedValue } from "../../../../reanimated/ReanimatedRexport";
import { useStateFromStores } from "../../../../../_bundle/defaultAreStatesEqual";
import { intl, t } from "../../../../../intl/index.native";
import UserUtils from "../../../../../utils/UserUtils";
import { acceptIncomingRequest, dismissIncomingRequest, sendWave } from "./AddFriendsScreenUtils";
import ApplicationIconAndName from "../../../../user_profile/native/ApplicationIconAndName";
import UserRow from "../../shared_components/user_list/UserRow";
import { ActionStatusSubLabel } from "./ActionStatusSubLabel";
import { IncomingRequestRowActions } from "./IncomingRequestRowActions";
import { HermesBuiltin } from "../../../../../_hermes/prelude";
let c11125_9, IncomingGameFriendRequestRow;
const IncomingRequestRow = function IncomingRequestRow(props) {
let userTag, stateFromStores;
const { user, applicationId, accepted, onAcceptIncomingRequest, onDeclineIncomingRequest, accessibilityLabel, acceptRequestAccessibilityLabel, ignoreRequestAccessibilityLabel, acceptedRequestLabel, acceptedRequestAccessibilityLabel, ...props2 } = props;
userTag = void 0;
stateFromStores = void 0;
const sharedValue = useSharedValue(false);
const stateFromStores2 = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
useEffect(() => {
sharedValue.set(accepted);
}, [accepted, sharedValue]);
const memo = useMemo(() => {
let r14;
const r3 = {
name: null,
label: null
};
if (accepted) {
r3.name = c11125_9.WAVE;
r3.label = intl.formatToPlainString(t.m0zYbV, {
username: UserUtils.getName(user)
});
r14 = [r3];
} else {
r3.name = c11125_9.ACCEPT;
r3.label = acceptRequestAccessibilityLabel;
r14 = [r3, {
name: c11125_9.DECLINE,
label: ignoreRequestAccessibilityLabel
}];
}
return r14;
}, [acceptRequestAccessibilityLabel, accepted, ignoreRequestAccessibilityLabel, user]);
const callback = useCallback((a0) => {
const actionName = a0.nativeEvent.actionName;
if (c11125_9.ACCEPT === actionName) {
sharedValue.set(true);
onAcceptIncomingRequest(user.id, applicationId);
return acceptIncomingRequest({
userId: user.id,
applicationId
});
}
if (c11125_9.DECLINE === actionName) {
onDeclineIncomingRequest(user.id, applicationId);
return dismissIncomingRequest({
userId: user.id,
applicationId
});
}
if (c11125_9.WAVE === actionName) {
return sendWave(user.id, true, "Incoming Friend Request");
}
}, [applicationId, onAcceptIncomingRequest, onDeclineIncomingRequest, sharedValue, user]);
userTag = UserUtils.useUserTag(user);
stateFromStores = useStateFromStores([ApplicationStore], () => ApplicationStore.getApplication(applicationId));
return <UserRow {...props2} user={user} type={RelationshipTypes.PENDING_INCOMING} mode={UserRowModes.ACTIONS} accessibilityActions={memo} accessibilityLabel={accessibilityLabel} onAccessibilityAction={callback} subLabel={<ActionStatusSubLabel actioned={sharedValue} label={useMemo(() => stateFromStores != null ? <ApplicationIconAndName key={stateFromStores.id} application={stateFromStores} textVariant="text-xs/medium" iconSize={12} /> : applicationId != null ? "" : userTag, [stateFromStores, applicationId, userTag])} actionStatus={acceptedRequestLabel} actionStatusAccessibilityLabel={acceptedRequestAccessibilityLabel} animate={!stateFromStores2} />} trailing={<IncomingRequestRowActions user={user} pressed={sharedValue} applicationId={applicationId} onAcceptIncomingRequest={onAcceptIncomingRequest} onDeclineIncomingRequest={onDeclineIncomingRequest} animate={!stateFromStores2} acceptRequestAccessibilityLabel={acceptRequestAccessibilityLabel} ignoreRequestAccessibilityLabel={ignoreRequestAccessibilityLabel} />} />;
};
IncomingGameFriendRequestRow = function IncomingGameFriendRequestRow(props) {
const { user: user2, application, ...props2 } = props;
const userTag2 = UserUtils.useUserTag(user2);
return <IncomingRequestRow user={user2} applicationId={application.id} accessibilityLabel={intl.formatToPlainString(t.u6lp4x, {
name: userTag2
})} acceptedRequestLabel={intl.format(t.gRgJGR, {
applicationNameHook: () => <ApplicationIconAndName key={application.id} application={application} textVariant="text-xs/medium" iconSize={12} />
})} acceptedRequestAccessibilityLabel={intl.formatToPlainString(t.Ke6fRJ, {
name: userTag2,
applicationName: application.name
})} acceptRequestAccessibilityLabel={intl.formatToPlainString(t.kMUpdH, {
name: userTag2,
applicationName: application.name
})} ignoreRequestAccessibilityLabel={intl.formatToPlainString(t.d8Cw5e, {
name: userTag2,
applicationName: application.name
})} {...props2} />;
};
c11125_9 = {
ACCEPT: "accept",
DECLINE: "decline",
WAVE: "wave"
};
export function IncomingFriendRequestRow(props) {
const { user: user2, ...props2 } = props;
const userTag2 = UserUtils.useUserTag(user2);
return <IncomingRequestRow user={user2} accessibilityLabel={intl.formatToPlainString(t.u6lp4x, {
name: userTag2
})} acceptedRequestLabel={intl.string(t["0E614Z"])} acceptedRequestAccessibilityLabel={intl.formatToPlainString(t.cRwkp7, {
name: userTag2
})} acceptRequestAccessibilityLabel={intl.formatToPlainString(t.MUfqsS, {
name: userTag2
})} ignoreRequestAccessibilityLabel={intl.formatToPlainString(t["0OF9IB"], {
name: userTag2
})} {...props2} />;
}
export function ConnectedIncomingGameFriendRequestRow(props) {
const { user: user2, applicationId: applicationId2 } = props;
const r13 = {};
let r14 = null;
const props2 = HermesBuiltin.copyDataProperties(r13, props, {
__proto__: null,
user: 0,
applicationId: 0
});
const stateFromStores2 = useStateFromStores([ApplicationStore], () => ApplicationStore.getApplication(applicationId2));
if (stateFromStores2 != null) {
r14 = <IncomingGameFriendRequestRow user={user2} application={stateFromStores2} {...props2} />;
}
return r14;
}
@@ -0,0 +1,178 @@
// Metro module 15601 (f15602).
import { useCallback } from "react";
import { View } from "react-native";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import * as _ReanimatedRexport from "../../../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useSharedValue, useAnimatedStyle, useAnimatedProps } from "../../../../reanimated/ReanimatedRexport";
import * as _timing from "../../../../../design/animation/reanimated/timing/timing";
import { acceptIncomingRequest, dismissIncomingRequest, sendWave } from "./AddFriendsScreenUtils";
import { Stack } from "../../../../../design/components/Stack/native/Stack.native";
import { IconButton } from "../../../../../design/components/Button/native/IconButton.native";
import Module13954 from "../../../../../_bundle/Module13954";
import Module10356 from "../../../../../_bundle/Module10356";
import { Button } from "../../../../../design/components/Button/native/Button.native";
import { intl, t } from "../../../../../intl/index.native";
import { Text } from "../../../../../design/components/Text/native/Text";
const useStyles = createStyles({
container: {
flexDirection: "row"
}
});
const __initData = {
code: "function IncomingRequestRowActionsTsx1(){const{animate,pressed,withTiming}=this.__closure;return{position:'absolute',right:0,flexDirection:'row',opacity:!animate?!pressed.get()?1:0:withTiming(!pressed.get()?1:0,{duration:150}),pointerEvents:!pressed.get()?'auto':'none'};}"
};
const __initData2 = {
code: "function IncomingRequestRowActionsTsx2(){const{buttonWidth,buttonOffsetX,pressed,animate,withTiming}=this.__closure;const width=buttonWidth.get();const offset=buttonOffsetX.get();const scaleX=!pressed.get()?0.5:1;const translateX=!pressed.get()?width-offset:0;return{transform:[{translateX:!animate?translateX:withTiming(translateX)},{scaleX:!animate?scaleX:withTiming(scaleX)}],opacity:!animate?!pressed.get()?0:1:withTiming(!pressed.get()?0:1),pointerEvents:!pressed.get()?'none':'auto'};}"
};
const __initData3 = {
code: "function IncomingRequestRowActionsTsx3(){const{waveWidth,waveHeight}=this.__closure;return{transform:[{translateX:waveWidth.get()/2},{translateY:waveHeight.get()/2}]};}"
};
const __initData4 = {
code: "function IncomingRequestRowActionsTsx4(){const{withDelay,withRepeat,withTiming,pressed,Easing,waveWidth,waveHeight}=this.__closure;return{transform:[{rotateZ:withDelay(450,withRepeat(withTiming(pressed.get()?'8deg':'-2deg',{duration:150,easing:Easing.inOut(Easing.quad)}),4,true))},{translateX:-waveWidth.get()/2},{translateY:-waveHeight.get()/2}]};}"
};
const __initData5 = {
code: "function IncomingRequestRowActionsTsx5(){const{pressed}=this.__closure;return{pointerEvents:!pressed.get()?'none':'none'};}"
};
export function IncomingRequestRowActions(props) {
const { user, applicationId, pressed, onAcceptIncomingRequest, onDeclineIncomingRequest, animate, acceptRequestAccessibilityLabel, ignoreRequestAccessibilityLabel } = props;
const styles = useStyles();
const sharedValue = useSharedValue(0);
const sharedValue2 = useSharedValue(-1);
const sharedValue3 = useSharedValue(-1);
const sharedValue4 = useSharedValue(-1);
const E = function E() {
return {
position: "absolute",
right: 0,
flexDirection: "row",
opacity: animate ? _timing.withTiming(pressed.get() ? 0 : 1, {
duration: 150
}) : pressed.get() ? 0 : 1,
pointerEvents: pressed.get() ? "none" : "auto"
};
};
E.__closure = {
animate,
pressed,
withTiming: _timing.withTiming
};
E.__workletHash = 1291516991185;
E.__initData = __initData;
const animatedStyle = useAnimatedStyle(E);
const q = function q() {
const r6 = sharedValue2.get();
const r11 = sharedValue.get();
const r0 = pressed.get() ? 1 : 0.5;
const r8 = pressed.get() ? 0 : r6 - r11;
return {
transform: [{
translateX: animate ? _timing.withTiming(r8) : r8
}, {
scaleX: animate ? _timing.withTiming(r0) : r0
}],
opacity: animate ? _timing.withTiming(pressed.get() ? 1 : 0) : pressed.get() ? 1 : 0,
pointerEvents: pressed.get() ? "auto" : "none"
};
};
q.__closure = {
buttonWidth: sharedValue2,
buttonOffsetX: sharedValue,
pressed,
animate,
withTiming: _timing.withTiming
};
q.__workletHash = 2207673076655;
q.__initData = __initData2;
const animatedStyle2 = useAnimatedStyle(q);
const x = () => ({
transform: [{
translateX: sharedValue3.get() / 2
}, {
translateY: sharedValue4.get() / 2
}]
});
x.__closure = {
waveWidth: sharedValue3,
waveHeight: sharedValue4
};
x.__workletHash = 4308223742756;
x.__initData = __initData3;
const animatedStyle3 = useAnimatedStyle(x);
const A = function A() {
return {
transform: [{
rotateZ: _ReanimatedRexport.withDelay(450, _ReanimatedRexport.withRepeat(_timing.withTiming(pressed.get() ? "8deg" : "-2deg", {
duration: 150,
easing: _ReanimatedRexport.Easing.inOut(_ReanimatedRexport.Easing.quad)
}), 4, true))
}, {
translateX: -sharedValue3.get() / 2
}, {
translateY: -sharedValue4.get() / 2
}]
};
};
A.__closure = {
withDelay: _ReanimatedRexport.withDelay,
withRepeat: _ReanimatedRexport.withRepeat,
withTiming: _timing.withTiming,
pressed,
Easing: _ReanimatedRexport.Easing,
waveWidth: sharedValue3,
waveHeight: sharedValue4
};
A.__workletHash = 6870822621980;
A.__initData = __initData4;
const animatedStyle4 = useAnimatedStyle(A);
const X = function X() {
pressed.get();
return {
pointerEvents: "none"
};
};
X.__closure = {
pressed
};
X.__workletHash = 5804402563280;
X.__initData = __initData5;
const animatedProps = useAnimatedProps(X);
const callback2 = useCallback(() => {
pressed.set(true);
acceptIncomingRequest({
userId: user.id,
applicationId
});
onAcceptIncomingRequest(user.id, applicationId);
}, [applicationId, onAcceptIncomingRequest, pressed, user]);
const callback = useCallback(() => {
onDeclineIncomingRequest(user.id, applicationId);
dismissIncomingRequest({
userId: user.id,
applicationId
});
}, [applicationId, onDeclineIncomingRequest, user]);
const callback3 = useCallback(() => {
sendWave(user.id, true, "Incoming Friend Request");
}, [user]);
const r139 = [<ReanimatedRexport.View onLayout={function onLayout(event) {
sharedValue.set(event.nativeEvent.layout.width);
}} style={animatedStyle}>
<Stack direction="horizontal" spacing={8}>
<IconButton size="sm" variant="tertiary" icon={Module13954} onPress={callback} accessibilityLabel={ignoreRequestAccessibilityLabel} maxFontSizeMultiplier={2} />
<IconButton size="sm" variant="active" icon={Module10356} onPress={callback2} accessibilityLabel={acceptRequestAccessibilityLabel} maxFontSizeMultiplier={2} />
</Stack>
</ReanimatedRexport.View>, ,];
r139[1] = <ReanimatedRexport.View style={animatedStyle2} onLayout={function onLayout(event) {
sharedValue2.set(event.nativeEvent.layout.width);
}} {...animatedProps}>
<Button size="sm" variant="secondary" text={intl.string(t.n8nU4W)} icon={<ReanimatedRexport.View style={animate ? animatedStyle3 : null} accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
<ReanimatedRexport.View style={animate ? animatedStyle4 : null} onLayout={function onLayout(event) {
sharedValue3.set(event.nativeEvent.layout.width);
sharedValue4.set(event.nativeEvent.layout.height);
}}>
<Text maxFontSizeMultiplier={2} variant="text-sm/normal">👋</Text>
</ReanimatedRexport.View>
</ReanimatedRexport.View>} onPress={callback3} />
</ReanimatedRexport.View>;
return <View style={styles.container}>{r139}</View>;
}
@@ -0,0 +1,32 @@
// Metro module 15599 (f15600).
import { View } from "react-native";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { TableRow } from "../../../../../design/components/TableRow/native/TableRow.native";
import { AvatarDuoPile } from "../../../../../design/components/Pile/native/AvatarDuoPile.native";
import { AvatarSizes, Avatar, AVATAR_SIZE_MAP } from "../../../../../design/void/native";
import { Text } from "../../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../../intl/index.native";
const useStyles = createStyles({
labelContainer: {
flexDirection: "row",
alignItems: "center"
},
showAllText: {
marginLeft: Module712.space.PX_12
}
});
export default function ShowAllRow(props) {
const { users, onPress, count } = props;
const styles = useStyles();
return <TableRow onPress={onPress} end height="100%" label={<View style={styles.labelContainer}>
<AvatarDuoPile size={AvatarSizes.XSMALL_20} aria-label="">
{users.slice(0, 2).map((item, index) => <Avatar key={index} source={item.getAvatarSource(null, false, AVATAR_SIZE_MAP[AvatarSizes.XSMALL])} size={AvatarSizes.XSMALL_20} />)}
</AvatarDuoPile>
<Text style={styles.showAllText} variant="text-md/semibold" color="text-brand">
{intl.format(t.NrzztX, {
count
})}
</Text>
</View>} trailing={<TableRow.Arrow />} />;
};
@@ -0,0 +1,41 @@
// Metro module 15043 (f15044).
import { useState, useMemo } from "react";
import FriendSuggestionStore from "../../../../friend_suggestions/FriendSuggestionStore";
import { SuggestedFriendSource } from "../screens/FriendsScreenConstants";
import { useStateFromStoresArray } from "../../../../../_bundle/defaultAreStatesEqual";
import Module12 from "../../../../../_bundle/Module12";
import UserUtils from "../../../../../utils/UserUtils";
export default function useSuggestedFriends(a0) {
const r4 = a0 == null ? {} : a0;
let c21621_2;
let isConnected = r4.isConnected;
const stateFromStoresArray = useStateFromStoresArray([FriendSuggestionStore], () => FriendSuggestionStore.getSuggestions());
const [state, setAdded] = useState([]);
if (isConnected == null) {
isConnected = true;
}
c21621_2 = isConnected;
const memo = useMemo(() => {
if (c21621_2) {
return Module12.unionBy(state.filter((item) => item.source === SuggestedFriendSource.USER_SUGGESTIONS), stateFromStoresArray.map((item) => {
let name = item.name;
if (name == null) {
name = void 0;
}
return {
user: item.user,
friendSuggestionName: name,
source: SuggestedFriendSource.USER_SUGGESTIONS,
contactNames: item.contactNames
};
}), (a0) => a0.user.id).sort((a, b) => UserUtils.getName(a.user).localeCompare(UserUtils.getName(b.user)));
}
return [];
}, [state, stateFromStoresArray, isConnected]);
return {
added: state,
setAdded,
friendSuggestions: memo,
numFriendSuggestions: isConnected ? memo.length : stateFromStoresArray.length
};
};
@@ -0,0 +1,36 @@
// Metro module 15610 (f15611).
import RelationshipStore from "../../../../../stores/RelationshipStore";
import { RelationshipTypes } from "../../../../../Constants";
const filterFromPending = function filterFromPending(item) {
return RelationshipStore.isSpam(item) || RelationshipStore.isIgnored(item);
};
export function getPendingRelationshipIds(a0) {
const pendingIncomingIds = [];
const pendingOutgoingIds = [];
const spamIds = [];
const ignoredUserIds = [];
for (const item of a0.keys()) {
const r14 = a0.get(item);
if (!(r14 !== RelationshipTypes.PENDING_INCOMING || filterFromPending(item))) {
pendingIncomingIds.push(item);
}
if (r14 === RelationshipTypes.PENDING_OUTGOING) {
pendingOutgoingIds.push(item);
}
if (r14 === RelationshipTypes.PENDING_INCOMING && RelationshipStore.isSpam(item)) {
spamIds.push(item);
}
if (r14 === RelationshipTypes.PENDING_INCOMING && RelationshipStore.isIgnored(item)) {
ignoredUserIds.push(item);
}
}
pendingIncomingIds.reverse();
pendingOutgoingIds.reverse();
spamIds.reverse();
return {
pendingIncomingIds,
pendingOutgoingIds,
spamIds,
ignoredUserIds
};
}
@@ -0,0 +1,263 @@
// Metro module 12993 (f12994).
import { forwardRef, useRef, useState, useCallback, useEffect } from "react";
import { Keyboard, View } from "react-native";
import { AnalyticEvents, PLACEHOLDER_TAG } from "../../../../../Constants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { intl, t } from "../../../../../intl/index.native";
import { Text } from "../../../../../design/components/Text/native/Text";
import { TextField } from "../../../../../design/components/TextField/native/TextField.native";
import FriendRequestMessageExperiment from "../../../../people/FriendRequestMessageExperiment";
import { validateDiscordTag, humanizeAbortCode, humanizeAbortCodeForA11y } from "../../../../../utils/FriendsUtils";
import RelationshipActionCreators, { RelationshipErrorUXConfig } from "../../../../../actions/RelationshipActionCreators";
import { presentAddedFriendToast } from "../../../../toast/native/ToastUtils";
import AnalyticsUtils from "../../../../../utils/AnalyticsUtils";
import { AccessibilityAnnouncer } from "../../../../../_bundle/Module3902";
import { TextArea } from "../../../../../design/components/TextInput/native/TextArea.native";
import { Button } from "../../../../../design/components/Button/native/Button.native";
let useStyles, c8969_13, c8969_14, Component;
const ErrorMessage = function ErrorMessage(props) {
const errorMessage = props.errorMessage;
const styles = useStyles();
return <Text variant="text-xs/medium" color="text-feedback-critical" style={[styles.inputAccessoryText, styles.errorStateText]}>{errorMessage}</Text>;
};
useStyles = createStyles({
container: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER,
alignItems: "center",
justifyContent: "center",
paddingHorizontal: 16
},
textInputContainer: {
alignSelf: "stretch"
},
placeholderText: {
color: Module712.colors.TEXT_MUTED
},
inputAccessoryText: {
fontSize: 12,
lineHeight: 16,
marginVertical: 8,
color: Module712.colors.TEXT_SUBTLE
},
redesignInputAccessoryText: {
marginBottom: Module712.space.PX_8
},
inputHeaderText: {
marginTop: 0
},
redesignGrow: {
flexGrow: 2,
minHeight: Module712.space.PX_24
},
errorStateText: {
color: Module712.unsafe_rawColors.RED_400,
marginVertical: 4
},
friendMessageContainer: {
alignSelf: "stretch",
marginTop: Module712.space.PX_16
},
messageLabel: {
marginBottom: Module712.space.PX_4
},
messageFooterText: {
marginTop: Module712.space.PX_4
}
});
c8969_13 = {
SUCCESS: 0,
0: "SUCCESS",
ERROR: 1,
1: "ERROR",
LOADING: 2,
2: "LOADING",
NONE: 3,
3: "NONE"
};
c8969_14 = {
DISCORD_TAG: "DISCORD_TAG",
MESSAGE: "MESSAGE"
};
Component = forwardRef(({ textState, onChangeText, onSelectionChange: onSelectionChange2, onKeyPress: onKeyPress2, onSubmitEditing, onFocus, validationState, autoFocus, headerText = intl.string(t.YegTF2).toUpperCase(), headerTextStyle }, a1) => {
const styles = useStyles();
const errorMessage = validationState.status === c8969_13.ERROR ? validationState.field === c8969_14.DISCORD_TAG ? validationState.message : void 0 : void 0;
return <View style={styles.textInputContainer}>
<Text style={[styles.redesignInputAccessoryText, styles.inputHeaderText, headerTextStyle]} variant="text-sm/semibold" color="text-muted">{headerText}</Text>
<TextField ref={a1} value={textState.validatedText} accessibilityLabel={intl.string(t.qRaqel)} accessibilityHint={validationState.status === c8969_13.ERROR ? validationState.a11yMessage : void 0} placeholder={intl.string(t.qRaqel)} placeholderTextColor={styles.placeholderText.color} onChange={onChangeText} onSelectionChange={onSelectionChange2} onKeyPress={onKeyPress2} onSubmitEditing={onSubmitEditing} autoCapitalize="none" returnKeyType="send" keyboardType="twitter" autoCorrect={false} blurOnSubmit maxLength={37} autoFocus={autoFocus} onFocus={onFocus} status={errorMessage != null ? "error" : void 0} />
{errorMessage != null ? <ErrorMessage errorMessage={errorMessage} /> : null}
</View>;
});
const r100 = forwardRef(({ style, onFocus, autoFocusInput, headerText, headerTextStyle, sourcePage }, a1) => {
let ref, ref2, state, setState, state2, setState2, state3, setState3;
ref = void 0;
ref2 = void 0;
state = void 0;
setState = void 0;
state2 = void 0;
setState2 = void 0;
state3 = void 0;
setState3 = void 0;
const handleSubmitEditing = function handleSubmitEditing() {
let discordTag = state.validatedText.trim();
const r12 = state3.trim();
if (discordTag.length <= 0) {
setState2({
status: c8969_13.ERROR,
field: c8969_14.DISCORD_TAG,
message: intl.string(t.mxnceg)
});
} else {
const r20 = discordTag.includes("#");
const r21 = r20 ? !r20 : discordTag.startsWith("@");
let r23 = discordTag;
if (r21) {
discordTag = discordTag.substring(1);
r23 = discordTag;
}
const message = validateDiscordTag(r23);
const discordTag2 = r23;
if (message != null) {
setState2({
status: c8969_13.ERROR,
field: c8969_14.DISCORD_TAG,
message
});
} else {
setState2({
status: c8969_13.LOADING
});
RelationshipActionCreators.sendRequest({
discordTag: discordTag2,
context: {
location: "Search - Add Friend Search"
},
errorUxConfig: RelationshipErrorUXConfig.SHOW_ONLY_IF_ACTION_NEEDED,
note: r12.length > 0 ? r12 : void 0
}).then(() => {
setState({
validatedText: "",
hint: intl.string(t["6p7Mhh"])
});
setState3("");
setState2({
status: c8969_13.SUCCESS,
message: intl.format(t.Rtl1Ep, {
discordTag
})
});
presentAddedFriendToast();
Keyboard.dismiss();
}, (a0) => {
let r16;
if ((a0 == null ? void 0 : a0.body?.note) != null) {
r16 = {
status: c8969_13.ERROR,
field: c8969_14.MESSAGE,
message: intl.string(t.ckHwck),
a11yMessage: intl.string(t.ckHwck)
};
} else {
let r23 = a0 == null ? void 0 : a0.body?.code;
if (r23 == null) {
r23 = -1;
}
r16 = {
status: c8969_13.ERROR,
field: c8969_14.DISCORD_TAG,
message: humanizeAbortCode(r23, discordTag),
a11yMessage: null
};
let r34 = a0 == null ? void 0 : a0.body?.code;
if (r34 == null) {
r34 = -1;
}
r16.a11yMessage = humanizeAbortCodeForA11y(r34, discordTag);
}
setState2(r16);
});
}
}
};
const styles = useStyles();
ref = useRef(0);
ref2 = useRef("");
[state, setState] = useState(() => ({
validatedText: "",
hint: intl.string(t["6p7Mhh"])
}));
[state2, setState2] = useState({
status: c8969_13.NONE
});
[state3, setState3] = useState("");
let enabled = FriendRequestMessageExperiment.useConfig({
location: "AddFriendbyId"
}).enabled;
const callback2 = useCallback((a0) => {
let r25;
if (a0.length <= 0) {
r25 = {
validatedText: "",
hint: intl.string(t["6p7Mhh"])
};
} else {
const [, r11] = a0.split("#");
r25 = {
validatedText: a0,
hint: r11 != null ? a0 + PLACEHOLDER_TAG.slice(r11 != null ? r11.length + 1 : 0) : ""
};
}
setState(r25);
if (state2.status === c8969_13.ERROR && state2.field === c8969_14.DISCORD_TAG) {
setState2({
status: c8969_13.NONE
});
}
}, [state2]);
const callback = useCallback((a0) => {
setState3(a0.replace(/\n/g, ""));
if (state2.status === c8969_13.ERROR && state2.field === c8969_14.MESSAGE) {
setState2({
status: c8969_13.NONE
});
}
}, [state2]);
useEffect(() => {
AnalyticsUtils.track(AnalyticEvents.FRIEND_ADD_VIEWED, {
friend_add_type: "Id",
source_page: sourcePage
});
}, [sourcePage]);
useEffect(() => {
if (state2.status === c8969_13.ERROR && state2.a11yMessage != null) {
AccessibilityAnnouncer.announce(state2.a11yMessage);
}
}, [state2]);
const length = state.validatedText.trim().length;
const r83 = [<Component textState={state} onChangeText={callback2} onSelectionChange={function onSelectionChange(event) {
const start = event.nativeEvent.selection.start;
if (start !== ref.current) {
ref.current = start;
}
}} onKeyPress={function onKeyPress(event) {
ref2.current = event.nativeEvent.key;
}} onSubmitEditing={handleSubmitEditing} onFocus={onFocus} validationState={state2} autoFocus={autoFocusInput} headerText={headerText} headerTextStyle={headerTextStyle} ref={a1} />, ,];
if (enabled) {
enabled = <View style={styles.friendMessageContainer}>
<Text style={[styles.messageLabel, styles.inputHeaderText, headerTextStyle]} variant="text-sm/semibold" color="text-muted">
{intl.string(t.Yi6Mpu)}
</Text>
<TextArea returnKeyType="done" submitBehavior="submit" value={state3} maxLength={120} onSubmitEditing={handleSubmitEditing} onChange={callback} status={state2.field === c8969_14.MESSAGE ? state2.status === c8969_13.ERROR ? "error" : void 0 : void 0} />
{state2.status === c8969_13.ERROR && state2.field === c8969_14.MESSAGE ? <ErrorMessage errorMessage={state2.message} /> : <Text style={styles.messageFooterText} variant="text-xs/medium" color="text-muted">
{intl.string(t.UtfQNw)}
</Text>}
</View>;
}
r83[1] = enabled;
return <>
<View style={[styles.container, style]}>{r83}</View>
<View style={styles.redesignGrow} />
<Button size="lg" text={intl.string(t["PMsq/b"])} disabled={length <= 0} onPress={handleSubmitEditing} loading={state2.status === c8969_13.LOADING} grow={false} />
</>;
});
export default r100;
@@ -0,0 +1,95 @@
// Metro module 15597 (f15598).
import { useState, useCallback, useLayoutEffect } from "react";
import { ScrollView, View } from "react-native";
import UserStore from "../../../../../stores/UserStore";
import { AnalyticEvents } from "../../../../../Constants";
import { ContactPermissions } from "../../../../contact_sync/native/ContactSyncConstants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { useContactSyncAccount, isContactSyncEnabled, checkContactPermissions } from "../../../../contact_sync/native/ContactSyncUtils";
import UserUtils from "../../../../../utils/UserUtils";
import AnalyticsUtils from "../../../../../utils/AnalyticsUtils";
import { intl, t } from "../../../../../intl/index.native";
import { showShareActionSheet } from "../../../../action_sheet/native/showShareActionSheet";
import { getRenderHeaderTextButton } from "../../shared_components/HeaderShared";
import { isAndroid } from "../../../../../utils/PlatformUtils";
import ThemedGradient from "../../../../client_themes/native/ThemedGradient";
import { Text } from "../../../../../design/components/Text/native/Text";
import AddFriendById from "./AddFriendById";
import ContactSyncUpsellCTA from "../../../../contact_sync/native/components/ContactSyncUpsellCTA";
const useStyles = createStyles({
headerText: {
marginTop: 32,
marginHorizontal: 16,
textAlign: "center"
},
subheaderText: {
marginVertical: 8,
marginHorizontal: 16,
textAlign: "center"
},
input: {
marginTop: 16,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER
},
otherOptionsContainer: {
marginTop: 16,
paddingHorizontal: 16
},
rowContainer: {
marginTop: 8
},
background: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER
}
});
export default function AddFriendScreen(props) {
const navigation = props.navigation;
const sourcePage = props.route.params.sourcePage;
const styles = useStyles();
const contactSyncAccount = useContactSyncAccount();
const [state, setState] = useState(!isContactSyncEnabled(contactSyncAccount));
const callback = useCallback(() => {
const currentUser = UserStore.getCurrentUser();
const username = currentUser != null ? UserUtils.getUserTag(currentUser) : void 0;
AnalyticsUtils.track(AnalyticEvents.FRIEND_ADD_VIEWED, {
friend_add_type: "Invite",
source_page: "Add Friend Modal"
});
showShareActionSheet({
message: intl.formatToPlainString(t["6E9a1J"], {
url: `${location.protocol}${window.GLOBAL_ENV.WEBAPP_ENDPOINT}`,
username
})
}, "Add Friend Modal");
}, []);
useLayoutEffect(() => {
navigation.setOptions({
headerRight: (a0) => getRenderHeaderTextButton(intl.string(t.RDE0Sc), callback)({
...a0
})
});
checkContactPermissions().then((result) => {
const NOT_DETERMINED = ContactPermissions.NOT_DETERMINED;
const r11 = isAndroid() && result === ContactPermissions.UNAUTHORIZED;
setState(result === NOT_DETERMINED || r11 || !isContactSyncEnabled(contactSyncAccount));
});
}, [callback, navigation, contactSyncAccount]);
return <>
{[<ThemedGradient absolute />, <ScrollView keyboardShouldPersistTaps="handled" style={styles.background}>
<Text style={styles.headerText} accessibilityRole="header" variant="heading-xl/extrabold" color="mobile-text-heading-primary">
{intl.string(t.GWMTSE)}
</Text>
<Text style={styles.subheaderText} variant="text-sm/medium" color="text-default">
{intl.string(t["Rn/sLl"])}
</Text>
<AddFriendById style={styles.input} autoFocusInput={false} sourcePage={sourcePage} />
<View style={styles.otherOptionsContainer}>
<Text accessibilityRole="header" variant="eyebrow" color="text-default">
{intl.string(t.dukg0Z)}
</Text>
{state ? <ContactSyncUpsellCTA style={styles.rowContainer} location="Add Friend Modal" /> : null}
</View>
</ScrollView>]}
</>;
};
@@ -0,0 +1,405 @@
// Metro module 15598 (f15599).
import { useState, useCallback, useMemo, useEffect } from "react";
import { ScrollView, View } from "react-native";
import GameRelationshipStore from "../../../../game_relationships/GameRelationshipStore";
import RelationshipStore from "../../../../../stores/RelationshipStore";
import UserStore from "../../../../../stores/UserStore";
import { Sections } from "./FriendsScreenConstants";
import { AnalyticEvents, AnalyticsSections, InstantInviteSources, RelationshipTypes } from "../../../../../Constants";
import { ContactPermissions } from "../../../../contact_sync/native/ContactSyncConstants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { openContactSyncModal } from "../../../../contact_sync/native/ContactSyncModalActionCreators";
import InstantInviteActionCreators from "../../../../../actions/InstantInviteActionCreators";
import { presentError } from "../../../../toast/native/ToastUtils";
import { intl, t } from "../../../../../intl/index.native";
import getInviteURL from "../../../../instant_invite/getInviteURL";
import * as _ContactSyncUtils from "../../../../contact_sync/native/ContactSyncUtils";
import { useContactSyncAccount, isContactSyncAvailable, checkContactPermissions } from "../../../../contact_sync/native/ContactSyncUtils";
import { isAndroid } from "../../../../../utils/PlatformUtils";
import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../../../app_analytics/AnalyticsLocation";
import useMountEffect from "../../../../../hooks/useMountEffect";
import AnalyticsUtils from "../../../../../utils/AnalyticsUtils";
import showUserProfileActionSheet from "../../../../user_profile/native/showUserProfileActionSheet";
import { useStateFromStoresArray, useStateFromStores } from "../../../../../_bundle/defaultAreStatesEqual";
import Module12 from "../../../../../_bundle/Module12";
import UserUtils from "../../../../../utils/UserUtils";
import useSuggestedFriends from "../components/useSuggestedFriends";
import useGetOrFetchApplications from "../../../../applications/useGetOrFetchApplications";
import ThemedGradient from "../../../../client_themes/native/ThemedGradient";
import InstantInviteShareApps from "../../../../instant_invite/native/components/InstantInviteShareApps";
import { ActivityIndicator } from "../../../../../design/components/ActivityIndicator/native/ActivityIndicator.native";
import { UsersFastList } from "../../shared_components/user_list/UsersFastList";
import { TableRow } from "../../../../../design/components/TableRow/native/TableRow.native";
import { FriendsIcon } from "../../../../../design/components/Icon/native/redesign/generated/FriendsIcon";
import { AtIcon } from "../../../../../design/components/Icon/native/redesign/generated/AtIcon";
import ShowAllRow from "../components/ShowAllRow";
import { IncomingFriendRequestRow, ConnectedIncomingGameFriendRequestRow } from "../components/IncomingRequestRow";
import { ContactSuggestionRow } from "../components/ContactSuggestionRow";
import AddFriendsContactSyncEmptyState from "../components/AddFriendsContactSyncEmptyState";
let c11123_19, useStyles, handleShare, areHydratedGameFriendRequestRowStatesEqual;
const handleFindFriends = function handleFindFriends() {
openContactSyncModal({}, AnalyticsSections.FRIENDS_ADD_FRIENDS_MODAL);
};
handleShare = async function handleShare(c28099_0) {
let c28099_4 = 0;
let c30906_0, c30906_1;
try {
c30906_0 = c28099_0;
c30906_1 = void 0;
c28099_4 = 1;
c30906_1 = (await InstantInviteActionCreators.createFriendInvite(null, InstantInviteSources.ADD_FRIENDS_MODAL)).code;
c28099_4 = 0;
(0, c30906_0)({
channel: null,
code: c30906_1,
message: intl.formatToPlainString(t.PJf9P9, {
link: getInviteURL(c30906_1)
}),
location: InstantInviteSources.ADD_FRIENDS_MODAL
});
} catch ($e) {
let r8 = $e;
if (c28099_4 !== 0) {
while (true) {
try {
c28099_4 = 0;
presentError(intl.string(t.R0RpRX));
} catch ($e) {
r8 = $e;
if (c28099_4 === 0) {
break;
}
continue;
}
return void 0;
}
}
throw r8;
}
};
areHydratedGameFriendRequestRowStatesEqual = function areHydratedGameFriendRequestRowStatesEqual(a0, a1) {
return a0 === a1 || a0.length === a1.length && a0.every((item, index) => {
const r7 = a1[index];
return item.user === r7.user && item.applicationId === r7.applicationId;
});
};
c11123_19 = {
FIND_FRIENDS: 0,
0: "FIND_FRIENDS",
INCOMING_FRIEND_REQUESTS: 1,
1: "INCOMING_FRIEND_REQUESTS",
INCOMING_GAME_FRIEND_REQUESTS: 2,
2: "INCOMING_GAME_FRIEND_REQUESTS",
CONTACT_SUGGESTIONS: 3,
3: "CONTACT_SUGGESTIONS"
};
useStyles = createStyles({
container: {
flex: 1
},
inviteAppsContainerNonSticky: {
backgroundColor: Module712.colors.MOBILE_ACTIONSHEET_BACKGROUND,
paddingVertical: Module712.space.PX_16
},
inviteAppsContentContainer: {
paddingTop: 0,
paddingBottom: 0,
minWidth: "100%"
},
emptyContainer: {
backgroundColor: Module712.colors.MOBILE_ACTIONSHEET_BACKGROUND
},
emptyActionContainer: {
marginHorizontal: Module712.space.PX_16,
paddingTop: Module712.space.PX_8
},
loading: {
backgroundColor: Module712.colors.MOBILE_ACTIONSHEET_BACKGROUND,
justifyContent: "center",
flex: 1
}
});
export default function AddFriendsScreen(props) {
let callback2, callback3, callback4, stateFromStoresArray, stateFromStores, added, setAdded, friendSuggestions, c22232_20, c22232_21, state5, memo;
const navigation = props.navigation;
const sourcePage = props.route.params.sourcePage;
callback2 = void 0;
callback3 = void 0;
callback4 = void 0;
stateFromStoresArray = void 0;
stateFromStores = void 0;
added = void 0;
setAdded = void 0;
friendSuggestions = void 0;
c22232_20 = void 0;
c22232_21 = void 0;
state5 = void 0;
memo = void 0;
const styles = useStyles();
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.ADD_FRIENDS).analyticsLocations;
const [state, setState] = useState([]);
const [state2, setState2] = useState([]);
const [state3, setState3] = useState([]);
const [state4, setState4] = useState([]);
const callback = useCallback((userId, a1) => {
const applicationId = a1;
if (a1 != null) {
setState4((prevState4) => [...prevState4, {
userId,
applicationId
}]);
} else {
setState2((prevState2) => [...prevState2, userId]);
}
}, []);
callback2 = useCallback((userId2, a1) => {
const applicationId2 = a1;
if (a1 != null) {
setState3((prevState3) => [...prevState3, {
userId: userId2,
applicationId: applicationId2
}]);
} else {
setState((prevState) => [...prevState, userId2]);
}
}, []);
useMountEffect(() => {
AnalyticsUtils.track(AnalyticEvents.FRIEND_ADD_VIEWED, {
friend_add_type: AnalyticsSections.FRIENDS_ADD_FRIENDS_MODAL,
source_page: sourcePage
});
});
callback3 = useCallback(() => {
navigation.navigate("username-search");
}, [navigation]);
callback4 = useCallback((a0) => {
showUserProfileActionSheet({
userId: a0.id,
localUser: a0,
sourceAnalyticsLocations: analyticsLocations,
location: "Add Friends Modal User Profile"
});
}, [analyticsLocations]);
stateFromStoresArray = useStateFromStoresArray([RelationshipStore, UserStore], () => {
const r5 = [];
for (const item of RelationshipStore.getMutableRelationships().keys()) {
if (RelationshipStore.isUnfilteredPendingIncoming(item)) {
const user3 = UserStore.getUser(item);
if (!(user3 == null || state.includes(item))) {
r5.push(user3);
}
}
}
const r49 = [];
let c28102_0 = r49;
state2.forEach((item) => {
const user3 = UserStore.getUser(item);
if (user3 != null) {
c28102_0.push(user3);
}
});
return Module12.unionBy(r49, r5, (a0) => a0.id).sort((a, b) => UserUtils.getName(a).localeCompare(UserUtils.getName(b)));
});
stateFromStores = useStateFromStores([GameRelationshipStore, RelationshipStore, UserStore], () => {
let c28103_1;
const gameRelationshipsByType = GameRelationshipStore.getGameRelationshipsByType(RelationshipTypes.PENDING_INCOMING);
const r6 = [];
let c28103_0 = r6;
gameRelationshipsByType.forEach(({ id, applicationId: applicationId4 }) => {
const user3 = UserStore.getUser(id);
if (!(RelationshipStore.isSpam(id) || RelationshipStore.isBlockedOrIgnored(id) || user3 == null || state3.some((item) => item.userId === id && item.applicationId === applicationId4))) {
c28103_0.push({
user: user3,
applicationId: applicationId4
});
}
});
const r12 = [];
c28103_1 = r12;
state4.forEach(({ userId: userId3, applicationId: applicationId5 }) => {
const user3 = UserStore.getUser(userId3);
if (user3 != null) {
c28103_1.push({
user: user3,
applicationId: applicationId5
});
}
});
return Module12.unionBy(r12, r6, (a0) => a0.user.id).sort((a, b) => UserUtils.getName(a.user).localeCompare(UserUtils.getName(b.user)));
}, [state4, state3], areHydratedGameFriendRequestRowStatesEqual);
const suggestedFriends = useSuggestedFriends();
added = suggestedFriends.added;
setAdded = suggestedFriends.setAdded;
friendSuggestions = suggestedFriends.friendSuggestions;
const r5 = friendSuggestions.length > 0 && stateFromStoresArray.length > 3;
c22232_20 = r5;
const r6 = friendSuggestions.length > 0 && stateFromStores.length > 3;
let navigation2, setState5;
let setState6;
c22232_21 = r6;
useGetOrFetchApplications(useMemo(() => {
const r6 = c22232_21 ? Math.min(stateFromStores.length, 3) : stateFromStores.length;
const r13 = [];
let r0 = 0;
while (r0 < r6) {
const r17 = stateFromStores[r0];
const r1 = r0;
if (r17 != null) {
r13.push(r17.applicationId);
}
r0 = r1 + 1;
}
return r13;
}, [stateFromStores, r6]));
navigation2 = navigation;
setState5 = void 0;
let state6;
[state6, setState5] = useState(false);
useEffect(() => navigation2.addListener("transitionEnd", () => {
setState5(true);
}), [navigation]);
setState6 = void 0;
const isContactSyncEnabled = _ContactSyncUtils.isContactSyncEnabled(useContactSyncAccount());
let state7;
[state7, setState6] = useState(false);
useEffect(() => {
if (isContactSyncAvailable()) {
checkContactPermissions().then((result) => {
const NOT_DETERMINED = ContactPermissions.NOT_DETERMINED;
const r11 = isAndroid() && result === ContactPermissions.UNAUTHORIZED;
setState6(result === NOT_DETERMINED || r11);
});
}
}, []);
state5 = !!isContactSyncAvailable() && (isContactSyncEnabled ? state7 : !isContactSyncEnabled);
const r150 = stateFromStoresArray.length === 0 && stateFromStores.length === 0 && friendSuggestions.length === 0;
memo = useMemo(() => {
const r8 = [state5 ? 2 : 1, , , ,];
let r5 = 4;
r8[1] = c22232_20 ? 4 : stateFromStoresArray.length;
if (!c22232_21) {
r5 = stateFromStores.length;
}
r8[2] = r5;
r8[3] = friendSuggestions.length;
return r8;
}, [stateFromStoresArray.length, friendSuggestions.length, stateFromStores.length, state5, r5, r6]);
const callback5 = useCallback((a0) => {
if (c11123_19.FIND_FRIENDS === a0) {
return void 0;
}
if (c11123_19.INCOMING_FRIEND_REQUESTS === a0) {
return {
type: "section",
props: {
title: intl.string(t["93cLE3"])
}
};
}
if (c11123_19.INCOMING_GAME_FRIEND_REQUESTS === a0) {
return {
type: "section",
props: {
title: intl.string(t["0uVuaU"])
}
};
}
if (c11123_19.CONTACT_SUGGESTIONS === a0) {
return {
type: "section",
props: {
title: intl.string(t["1uAmCw"])
}
};
}
}, []);
const r173 = [<ThemedGradient absolute />, ,];
r173[1] = <View style={styles.container}>
<View style={styles.inviteAppsContainerNonSticky}>
<InstantInviteShareApps onItemPressed={handleShare} contentContainerStyle={styles.inviteAppsContentContainer} />
</View>
{!state6 && !r150 ? <View style={styles.loading}>
<ActivityIndicator />
</View> : r150 ? <ScrollView style={styles.emptyContainer}>
<View style={styles.emptyActionContainer}>
<TableRow label={intl.string(t.QzVsOs)} labelLineClamp={1} icon={<TableRow.Icon IconComponent={AtIcon} />} arrow onPress={callback3} start end />
</View>
{state5 ? <AddFriendsContactSyncEmptyState /> : null}
</ScrollView> : <UsersFastList sections={memo} getItemProps={function getItemProps(a0, a1) {
let user, user2, applicationId3, suggestedFriend;
const start = a1 === 0;
const end = a1 === memo[a0] - 1;
if (c11123_19.FIND_FRIENDS === a0) {
return start && state5 ? {
type: "custom",
itemType: "showContactSyncCTA",
key: "showContactSyncCTA",
component: () => <TableRow start height="100%" label={intl.string(t.j2POVo)} labelLineClamp={1} icon={<TableRow.Icon IconComponent={FriendsIcon} />} trailing={<TableRow.Arrow />} onPress={handleFindFriends} />
} : {
type: "custom",
itemType: "addByUsername",
key: "addByUsername",
component: () => <TableRow start={!state5} end height="100%" label={intl.string(t.QzVsOs)} labelLineClamp={1} icon={<TableRow.Icon IconComponent={AtIcon} />} arrow onPress={callback3} />
};
}
if (c11123_19.INCOMING_FRIEND_REQUESTS === a0) {
if (end && c22232_20) {
return {
type: "custom",
itemType: "viewAll",
key: "friendRequestsViewAll",
component: () => <ShowAllRow onPress={() => {
AnalyticsUtils.track(AnalyticEvents.FRIEND_FINDER_SECTION_EXPANDED, {
section_id: Sections.PENDING,
truncated_count: 3,
expanded_count: stateFromStoresArray.length,
location: "AddFriends"
});
navigation.navigate("requests");
}} users={stateFromStoresArray.slice(3)} count={stateFromStoresArray.length} />
};
}
user = stateFromStoresArray[a1];
return {
type: "custom",
itemType: "incomingRequest",
key: user.id,
component: () => <IncomingFriendRequestRow accepted={state2.includes(user.id)} user={user} start={start} end={end} onPress={callback4} onDeclineIncomingRequest={callback2} onAcceptIncomingRequest={callback} />
};
}
if (c11123_19.INCOMING_GAME_FRIEND_REQUESTS === a0) {
if (end && c22232_21) {
return {
type: "custom",
itemType: "viewAll",
key: "gameFriendRequestsViewAll",
component: () => <ShowAllRow onPress={() => {
navigation.navigate("requests");
}} users={stateFromStores.slice(3).map((item) => item.user)} count={stateFromStores.length} />
};
}
const r37 = stateFromStores[a1];
user2 = r37.user;
applicationId3 = r37.applicationId;
return {
type: "custom",
itemType: "incomingRequest",
key: `${user2.id}-${applicationId3}`,
component: () => <ConnectedIncomingGameFriendRequestRow accepted={state4.find((item) => item.userId === user2.id && item.applicationId === applicationId3) != null} applicationId={applicationId3} user={user2} start={start} end={end} onPress={callback4} onDeclineIncomingRequest={callback2} onAcceptIncomingRequest={callback} />
};
}
if (c11123_19.CONTACT_SUGGESTIONS === a0) {
suggestedFriend = friendSuggestions[a1];
return {
type: "custom",
itemType: suggestedFriend?.mutualFriendsCount != null ? suggestedFriend?.mutualFriendsCount > 0 ? "contactSuggestionMutualCount" : "contactSuggestionNoMutualCount" : "contactSuggestionNoMutualCount",
key: suggestedFriend.user.id,
component: () => <ContactSuggestionRow added={added.includes(suggestedFriend)} suggestedFriend={suggestedFriend} start={start} end={end} onPress={callback4} location={InstantInviteSources.ADD_FRIENDS_MODAL} onAddSuggestion={() => setAdded((prevAdded) => [...prevAdded, suggestedFriend])} />
};
}
}} getSectionProps={callback5} insetEnd={12} disableStickySections />}
</View>;
return <AnalyticsLocationProvider value={analyticsLocations}>{r173}</AnalyticsLocationProvider>;
};
@@ -0,0 +1,274 @@
// Metro module 15608 (f15609).
import { useEffect, useMemo, useState, useCallback, lazy } from "react";
import { View } from "react-native";
import NotificationCenterItemsStore from "../../../../notification_center/NotificationCenterItemsStore";
import RelationshipStore from "../../../../../stores/RelationshipStore";
import UserStore from "../../../../../stores/UserStore";
import { UserRowModes } from "../../shared_components/user_list/UserRowConstants";
import { AnalyticEvents, AnalyticsSections, RelationshipTypes } from "../../../../../Constants";
import { MINIMUM_PENDING_INCOMING_COUNT_FOR_CLEAR_ALL } from "../../../../people/Constants";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { openAlert } from "../../../../../design/components/AlertModal/native/useAlertStore.native";
import { useStateFromStoresArray, useStateFromStores } from "../../../../../_bundle/defaultAreStatesEqual";
import { NotificationCenterLocalItems } from "../../../../notification_center/NotificationCenterItemsTypes";
import { NotificationCenterAckedBeforeId } from "../../../../user_settings/UserSettings";
import { markNotificationCenterLocalItemsAcked, bulkMarkNotificationCenterItemsAcked } from "../../../../notification_center/NotificationCenterItemsActions";
import { isRemoteAcked } from "../../../../notification_center/NotificationCenterUtils";
import SnowflakeUtils from "../../../../../utils/SnowflakeUtils";
import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../../../app_analytics/AnalyticsLocation";
import AnalyticsUtils from "../../../../../utils/AnalyticsUtils";
import { useGameRelationshipsByType } from "../../../../game_relationships/GameRelationshipStoreHooks";
import useGetOrFetchApplications from "../../../../applications/useGetOrFetchApplications";
import { getPendingRelationshipIds } from "../hooks/getPendingRelationshipIds";
import isUndefinedOrNull from "../../../../../_bundle/isUndefinedOrNull";
import showUserProfileActionSheet from "../../../../user_profile/native/showUserProfileActionSheet";
import { intl, t } from "../../../../../intl/index.native";
import { useNavigation } from "../../../../../design/components/Navigator/native/useNavigation.native";
import { TableRowGroup } from "../../../../../design/components/TableRow/native/TableRowGroup.native";
import { TableRow } from "../../../../../design/components/TableRow/native/TableRow.native";
import { Text } from "../../../../../design/components/Text/native/Text";
import { useSegmentedControlState } from "../../../../../design/components/SegmentedControl/native/SegmentedControlState.native";
import ThemedGradient from "../../../../client_themes/native/ThemedGradient";
import { SegmentedControl } from "../../../../../design/components/SegmentedControl/native/SegmentedControl.native";
import { PressableOpacity } from "../../../../../design/void/Pressables/native/Pressables";
import NoResults from "../../shared_components/user_list/NoResults";
import { WumpusCouchSpotIllustration } from "../../../../../design/assets/native";
import { UsersFastList } from "../../shared_components/user_list/UsersFastList";
let c11133_16, useStyles;
const compareUserItems = function compareUserItems(a0, a1) {
return a0.user.id === a1.user.id ? SnowflakeUtils.compare(a0.applicationId, a1.applicationId) : SnowflakeUtils.compare(a0.user.id, a1.user.id);
};
c11133_16 = {
Incoming: 0,
0: "Incoming",
Outgoing: 1,
1: "Outgoing"
};
useStyles = createStyles({
container: {
flex: 1
},
noResultsContainer: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER,
flex: 1
},
clearAllContainer: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER,
paddingHorizontal: Module712.space.PX_16,
paddingBottom: Module712.space.PX_16,
justifyContent: "flex-end",
flexDirection: "row"
},
clearAll: {
backgroundColor: Module712.colors.INPUT_BACKGROUND_DEFAULT,
borderColor: Module712.colors.INPUT_BACKGROUND_DEFAULT,
paddingHorizontal: Module712.space.PX_16,
minWidth: 2 * Module712.space.PX_64,
borderRadius: Module712.radii.round,
alignItems: "center",
paddingVertical: 5,
borderWidth: 3
},
tabs: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER,
paddingHorizontal: Module712.space.PX_16,
paddingBottom: Module712.space.PX_16,
paddingTop: Module712.space.PX_8
}
});
export default function FriendRequestsScreen() {
let r227;
let c22243_1, c22243_2, gameRelationshipsByType, gameRelationshipsByType2, pendingIncomingIds, pendingOutgoingIds, spamIds, ignoredUserIds, incoming, outgoing, spam, ignoredUsers, incomingData, outgoingData, callback, navigation;
let setting;
const styles = useStyles();
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.FRIEND_REQUESTS).analyticsLocations;
setting = void 0;
const stateFromStoresArray = useStateFromStoresArray([NotificationCenterItemsStore], () => NotificationCenterItemsStore.localItems.filter((localItem) => localItem.type === NotificationCenterLocalItems.INCOMING_FRIEND_REQUESTS || localItem.type === NotificationCenterLocalItems.INCOMING_GAME_FRIEND_REQUESTS));
setting = NotificationCenterAckedBeforeId.useSetting();
useEffect(() => {
if (stateFromStoresArray.length > 0) {
markNotificationCenterLocalItemsAcked(stateFromStoresArray.map((item) => item.local_id).filter(Boolean));
bulkMarkNotificationCenterItemsAcked(stateFromStoresArray.filter((item) => !isRemoteAcked(item, setting)));
}
}, [stateFromStoresArray, setting]);
useEffect(() => {
AnalyticsUtils.track(AnalyticEvents.FRIEND_ADD_VIEWED, {
friend_add_type: AnalyticsSections.FRIENDS_REQUESTS_MODAL
});
}, []);
const [r68, r69] = useStateFromStoresArray([RelationshipStore], () => [RelationshipStore.getMutableRelationships(), RelationshipStore.getVersion()]);
c22243_1 = r68;
c22243_2 = r69;
gameRelationshipsByType = useGameRelationshipsByType(RelationshipTypes.PENDING_INCOMING);
gameRelationshipsByType2 = useGameRelationshipsByType(RelationshipTypes.PENDING_OUTGOING);
useGetOrFetchApplications(useMemo(() => {
const set = new Set();
let c28106_0 = set;
gameRelationshipsByType.forEach((item) => {
c28106_0.add(item.applicationId);
});
gameRelationshipsByType2.forEach((item) => {
c28106_0.add(item.applicationId);
});
return Array.from(set);
}, [gameRelationshipsByType, gameRelationshipsByType2]));
const memo = useMemo(() => getPendingRelationshipIds(c22243_1, c22243_2), [r68, r69]);
pendingIncomingIds = memo.pendingIncomingIds;
pendingOutgoingIds = memo.pendingOutgoingIds;
spamIds = memo.spamIds;
ignoredUserIds = memo.ignoredUserIds;
const stateFromStores = useStateFromStores([UserStore], () => {
const r12 = pendingIncomingIds.map((pendingIncomingId) => ({
user: UserStore.getUser(pendingIncomingId),
isGameRelationship: false
})).filter((item) => item.user != null);
const r23 = gameRelationshipsByType.map((item) => ({
user: UserStore.getUser(item.id),
isGameRelationship: true,
applicationId: item.applicationId
})).filter((item) => item.user != null);
const r29 = pendingOutgoingIds.map((pendingOutgoingId) => ({
user: UserStore.getUser(pendingOutgoingId),
isGameRelationship: false
})).filter((item) => item.user != null);
const r35 = gameRelationshipsByType2.map((item) => ({
user: UserStore.getUser(item.id),
isGameRelationship: true,
applicationId: item.applicationId
})).filter((item) => item.user != null);
return {
incoming: [...r12, ...r23].sort(compareUserItems),
outgoing: [...r29, ...r35].sort(compareUserItems),
spam: spamIds.map((spamId) => ({
user: UserStore.getUser(spamId)
})).filter((item) => item.user != null),
ignoredUsers: ignoredUserIds.map((ignoredUserId) => ({
user: UserStore.getUser(ignoredUserId)
})).filter((item) => item.user != null)
};
}, [ignoredUserIds, gameRelationshipsByType, gameRelationshipsByType2, pendingIncomingIds, pendingOutgoingIds, spamIds], isUndefinedOrNull);
incoming = stateFromStores.incoming;
outgoing = stateFromStores.outgoing;
spam = stateFromStores.spam;
ignoredUsers = stateFromStores.ignoredUsers;
const memo2 = useMemo(() => ({
incomingData: {
items: incoming,
relationship: RelationshipTypes.PENDING_INCOMING
},
incomingSection: [incoming.length, spam.length + ignoredUsers.length > 0 ? 1 : 0],
outgoingData: {
items: outgoing,
relationship: RelationshipTypes.PENDING_OUTGOING
},
outgoingSection: [outgoing.length]
}), [ignoredUsers, incoming, outgoing, spam]);
incomingData = memo2.incomingData;
const incomingSection = memo2.incomingSection;
outgoingData = memo2.outgoingData;
let outgoingSection = memo2.outgoingSection;
const [state, setState] = useState(() => incoming.length === 0 && outgoing.length > 0 ? c11133_16.Outgoing : c11133_16.Incoming);
callback = useCallback((a0) => {
showUserProfileActionSheet({
userId: a0.id,
localUser: a0,
sourceAnalyticsLocations: analyticsLocations
});
}, [analyticsLocations]);
const callback2 = useCallback((a0) => {
if (a0 === 1) {
return {
type: "section",
props: {
title: intl.string(t["NHpP/k"])
}
};
}
}, []);
navigation = useNavigation();
const callback3 = useCallback((a0, a1) => {
if (a0 === 1) {
return {
type: "custom",
component: () => <TableRowGroup hasIcons={false}>
{spam.length > 0 ? <TableRow onPress={() => {
navigation.navigate("friends", {
screen: "spam-requests"
});
}} label={intl.string(t.fUQoqD)} trailing={<Text variant="text-sm/medium" color="text-muted">{spam.length}</Text>} arrow /> : null}
{ignoredUsers.length > 0 ? <TableRow onPress={() => {
navigation.navigate("friends", {
screen: "ignored-user-requests"
});
}} label={intl.string(t.en1Gkz)} trailing={<Text variant="text-sm/medium" color="text-muted">{ignoredUsers.length}</Text>} arrow /> : null}
</TableRowGroup>,
key: "spamRequests",
itemType: "spamRequests"
};
}
const r9 = state === c11133_16.Incoming ? incomingData : outgoingData;
const items = r9.items;
return {
type: "user",
props: {
type: r9.relationship,
user: items[a1].user,
onPress: callback,
mode: UserRowModes.ACTIONS,
start: a1 === 0,
end: a1 === items.length - 1,
applicationId: items[a1].applicationId,
isGameRelationship: items[a1].isGameRelationship
}
};
}, [state, incomingData, outgoingData, callback, spam.length, ignoredUsers.length, navigation]);
const r3 = state === c11133_16.Outgoing && outgoing.length === 0 || state === c11133_16.Incoming && incoming.length === 0 && spam.length === 0 && ignoredUserIds.length === 0;
const r143 = state === c11133_16.Incoming && incoming.length >= MINIMUM_PENDING_INCOMING_COUNT_FOR_CLEAR_ALL;
const segmentedControlState = useSegmentedControlState({
pageWidth: 0,
defaultIndex: state,
onSetActiveIndex: (a0) => {
setState(a0 === 0 ? c11133_16.Incoming : c11133_16.Outgoing);
},
items: [{
id: c11133_16.Incoming.toString(),
label: intl.string(t.bekioP),
page: null
}, {
id: c11133_16.Outgoing.toString(),
label: intl.string(t.tWqcIF),
page: null
}]
});
const r189 = [<ThemedGradient absolute />, ,];
const r201 = [<View style={styles.tabs}>
<SegmentedControl state={segmentedControlState} />
</View>, r143 ? <View style={styles.clearAllContainer}>
<PressableOpacity style={styles.clearAll} onPress={() => {
const length = incoming.length;
openAlert("clear-all-incoming-requests", jsx(lazy(() => import("../components/ClearAllIncomingRequestsAlertModal")), {
incomingRequestCount: length
}));
}}>
<Text variant="text-sm/semibold" color="text-brand">
{intl.string(t.O8k7O4)}
</Text>
</PressableOpacity>
</View> : null, ,];
if (r3) {
r227 = <View style={styles.noResultsContainer}>
<NoResults title={state === c11133_16.Incoming ? intl.string(t["7uvAKe"]) : intl.string(t["yvzX/Z"])} illustration={WumpusCouchSpotIllustration} disableBackgroundOverlay />
</View>;
} else {
if (state === c11133_16.Incoming) {
outgoingSection = incomingSection;
}
r227 = <UsersFastList sections={outgoingSection} getItemProps={callback3} getSectionProps={callback2} />;
}
r201[2] = r227;
r189[1] = <View style={styles.container}>{r201}</View>;
return <AnalyticsLocationProvider value={analyticsLocations}>{r189}</AnalyticsLocationProvider>;
};
@@ -0,0 +1,22 @@
// Metro module 15606 (f15607).
import { ScrollView } from "react-native";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import ThemedGradient from "../../../../client_themes/native/ThemedGradient";
import UserSettingsFriendRequests from "../../../../user_settings/content_and_social/native/UserSettingsFriendRequests";
const useStyles = createStyles({
container: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER,
flex: 1,
paddingTop: Module712.space.PX_16,
paddingHorizontal: Module712.space.PX_16
}
});
export default function FriendRequestsSettingsScreen() {
return <>
<ThemedGradient absolute />
<ScrollView style={useStyles().container}>
<UserSettingsFriendRequests />
</ScrollView>
</>;
};
@@ -0,0 +1,143 @@
// Metro module 15578 (f15579).
import { useCallback, useEffect, useMemo } from "react";
import { View } from "react-native";
import GameRelationshipStore from "../../../../game_relationships/GameRelationshipStore";
import RelationshipStore from "../../../../../stores/RelationshipStore";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { useNavigation } from "../../../../../design/components/Navigator/native/useNavigation.native";
import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../../../app_analytics/AnalyticsLocation";
import useSafeAreaInsets_native from "../../../../safe_area/useSafeAreaInsets.native";
import { useStateFromStoresObject } from "../../../../../_bundle/Module589";
import { getIncomingFriendRequestCount, getOutgoingFriendRequestCount } from "../../../../people/hooks/useFriendRequestCounts";
import { dismissGlobalKeyboard } from "../../../../../utils/native/KeyboardManagerUtils";
import showUserProfileActionSheet from "../../../../user_profile/native/showUserProfileActionSheet";
import trackFriendListViewed from "../../../../app_analytics/track/friends_list_viewed/trackFriendListViewed";
import trackFriendListClicked from "../../../../app_analytics/track/friends_list_viewed/trackFriendListClicked";
import Module15314 from "../../../../../_bundle/Module15314";
import { SendMessageIcon } from "../../../../../design/components/Icon/native/redesign/generated/SendMessageIcon";
import { intl, t } from "../../../../../intl/index.native";
import { TableRow } from "../../../../../design/components/TableRow/native/TableRow.native";
import NoResults from "../../shared_components/user_list/NoResults";
import { WumpusCouchSpotIllustration } from "../../../../../design/assets/native";
import { Button } from "../../../../../design/components/Button/native/Button.native";
import SearchableUserList from "../../shared_components/user_list/SearchableUserList";
import { TTIFirstContentfulPaint } from "../../../../tti_analytics/native/TTIFirstContentfulPaint";
const useStyles = createStyles({
container: {
paddingTop: Module712.space.PX_8,
flex: 1
},
requestsButtonContainer: {
marginHorizontal: Module712.space.PX_16,
borderRadius: Module712.radii.lg,
overflow: "hidden"
},
emptyContainer: {
justifyContent: "center",
flexGrow: 1
},
buttonContainer: {
flexDirection: "row",
marginBottom: Module712.space.PX_16,
width: "100%"
}
});
export default function FriendsScreen() {
let incoming, outgoing, spam, pendingIgnored;
const navigation = useNavigation();
const styles = useStyles();
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.FRIENDS_LIST).analyticsLocations;
const bottom = useSafeAreaInsets_native().bottom;
const stateFromStoresObject = useStateFromStoresObject([RelationshipStore, GameRelationshipStore], () => ({
incoming: getIncomingFriendRequestCount([RelationshipStore, GameRelationshipStore]),
outgoing: getOutgoingFriendRequestCount([RelationshipStore, GameRelationshipStore]),
spam: RelationshipStore.getSpamCount(),
pendingIgnored: RelationshipStore.getPendingIgnoredCount()
}));
incoming = stateFromStoresObject.incoming;
outgoing = stateFromStoresObject.outgoing;
spam = stateFromStoresObject.spam;
pendingIgnored = stateFromStoresObject.pendingIgnored;
const callback = useCallback((a0) => {
dismissGlobalKeyboard();
showUserProfileActionSheet({
userId: a0.id,
localUser: a0,
sourceAnalyticsLocations: analyticsLocations
});
}, [analyticsLocations]);
const callback2 = useCallback((a0) => {
navigation.navigate("friends", {
screen: "new-message",
params: {
defaultSelectedUserId: a0.id,
sourcePage: "Friends Screen"
}
});
}, [navigation]);
useEffect(() => {
trackFriendListViewed({
tab_opened: null
});
trackFriendListClicked({
tab_opened: null
});
}, []);
return <AnalyticsLocationProvider value={analyticsLocations}>
<SearchableUserList onSelectUser={callback} handleMessage={callback2} actions={useMemo(() => {
const incoming2 = incoming + spam + pendingIgnored;
const r1 = incoming2 > 0 || outgoing > 0;
const r16 = [];
if (r1) {
r16.push({
icon: Module15314,
IconComponent: SendMessageIcon,
iconVariant: "default",
label: intl.string(t.fyA115),
subLabel: intl.formatToPlainString(t["1IEawz"], {
incoming: incoming2,
outgoing
}),
onPress: () => navigation.navigate("friends", {
screen: "requests"
})
});
}
return r16;
}, [incoming, navigation, outgoing, spam, pendingIgnored])} withAffinitySuggestions={false} withGameFriends defaultNoResultsFound={useMemo(() => <View style={styles.container}>
{incoming + outgoing + spam > 0 ? <View style={styles.requestsButtonContainer}>
<TableRow start end icon={<TableRow.Icon source={Module15314} />} trailing={<TableRow.Arrow />} label={intl.string(t.fyA115)} subLabel={incoming + outgoing > 0 ? intl.formatToPlainString(t["1IEawz"], {
incoming,
outgoing
}) : intl.formatToPlainString(t.e6BtLq, {
spam
})} onPress={() => {
if (incoming + outgoing > 0) {
navigation.navigate("friends", {
screen: "requests"
});
} else {
navigation.navigate("friends", {
screen: "spam-requests"
});
}
}} />
</View> : null}
<NoResults title={intl.string(t["oi+B4p"])} fullHeight containerStyle={styles.emptyContainer} illustration={WumpusCouchSpotIllustration}>
<View style={[styles.buttonContainer, {
paddingBottom: bottom
}]}>
<Button text={intl.string(t.zIJnA6)} size="lg" onPress={() => navigation.navigate("friends", {
screen: "add-friends",
params: {
sourcePage: "Friends Screen"
}
})} grow />
</View>
</NoResults>
</View>, [bottom, incoming, navigation, outgoing, styles, spam])} hideSearchOnDefaultNoResults disableThemedGradient />
<TTIFirstContentfulPaint label="friends" />
</AnalyticsLocationProvider>;
};
@@ -0,0 +1,23 @@
// Metro module 11790 (f11791).
const r12 = {
USER_SUGGESTIONS: 1,
1: "USER_SUGGESTIONS",
FF_PEOPLE_YOU_MAY_KNOW: 2,
2: "FF_PEOPLE_YOU_MAY_KNOW"
};
const r15 = {
SYNC_CONTACTS: 0,
0: "SYNC_CONTACTS",
FRIEND_SUGGESTIONS: 1,
1: "FRIEND_SUGGESTIONS",
PENDING: 2,
2: "PENDING",
ONLINE: 3,
3: "ONLINE",
OFFLINE: 4,
4: "OFFLINE",
SPAM: 5,
5: "SPAM"
};
export { r12 as SuggestedFriendSource };
export { r15 as Sections };
@@ -0,0 +1,44 @@
// Metro module 15612 (f15613).
import { useCallback } from "react";
import RelationshipStore from "../../../../../stores/RelationshipStore";
import UserStore from "../../../../../stores/UserStore";
import { UserRowModes } from "../../shared_components/user_list/UserRowConstants";
import { RelationshipTypes } from "../../../../../Constants";
import useAnalyticsLocations from "../../../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../../../app_analytics/AnalyticsLocation";
import { useStateFromStoresArray, useStateFromStores } from "../../../../../_bundle/Module589";
import { getPendingRelationshipIds } from "../hooks/getPendingRelationshipIds";
import showUserProfileActionSheet from "../../../../user_profile/native/showUserProfileActionSheet";
import { UsersFastList } from "../../shared_components/user_list/UsersFastList";
export default function IgnoredUserRequestsScreen(props) {
let stateFromStores, callback;
const navigation = props.navigation;
stateFromStores = void 0;
callback = void 0;
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.FRIEND_REQUESTS).analyticsLocations;
const stateFromStoresArray = useStateFromStoresArray([RelationshipStore], () => getPendingRelationshipIds(RelationshipStore.getMutableRelationships()).ignoredUserIds);
stateFromStores = useStateFromStores([UserStore], () => stateFromStoresArray.map((item) => UserStore.getUser(item)).filter((item) => item != null), [stateFromStoresArray]);
callback = useCallback((a0) => {
showUserProfileActionSheet({
userId: a0.id,
localUser: a0,
sourceAnalyticsLocations: analyticsLocations
});
}, [analyticsLocations]);
const callback2 = useCallback(() => {}, []);
const callback3 = useCallback((a0) => ({
type: "user",
props: {
type: RelationshipTypes.PENDING_INCOMING,
user: stateFromStores[a0],
onPress: callback,
mode: UserRowModes.ACTIONS,
start: a0 === 0,
end: a0 === stateFromStores.length - 1
}
}), [callback, stateFromStores]);
if (stateFromStores.length !== 0) {
return <UsersFastList getItemProps={callback3} getSectionProps={callback2} sections={[stateFromStores.length]} />;
}
navigation.goBack();
};
@@ -0,0 +1,398 @@
// Metro module 15596 (f15597).
import _slicedToArray from "../../../../../_bundle/_slicedToArray";
import _asyncToGenerator from "../../../../../_bundle/_asyncToGenerator";
import { useState, useMemo, useEffect, useCallback, useLayoutEffect } from "react";
import { ActivityIndicator, View } from "react-native";
import ChannelStore from "../../../../../stores/ChannelStore";
import PrivateChannelRecipientsInviteStore from "../../../../../stores/PrivateChannelRecipientsInviteStore";
import RTCConnectionStore from "../../../../../stores/RTCConnectionStore";
import UserStore from "../../../../../stores/UserStore";
import { UserRowModes } from "../../shared_components/user_list/UserRowConstants";
import { NEW_GROUP_DM_POPOUT_ID, AnalyticEvents, AnalyticsSections, InstantInviteSources } from "../../../../../Constants";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import ChannelActionCreators from "../../../../../actions/ChannelActionCreators";
import { showGuardCallAlert } from "../../../../../utils/native/PrivateChannelCallUtils";
import CallActionCreators from "../../../../../actions/CallActionCreators";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
import { useStateFromStores } from "../../../../../_bundle/Module589";
import getGroupDMRecipientLimit from "../../../../group_dm/getGroupDMRecipientLimit";
import AnalyticsUtils from "../../../../../utils/AnalyticsUtils";
import ToastActionCreators from "../../../../toast/native/ToastActionCreators";
import { intl, t } from "../../../../../intl/index.native";
import { GenericHeaderTitle, getRenderHeaderTextButton } from "../../shared_components/HeaderShared";
import useIsUsingClientTheme from "../../../../client_themes/native/useIsUsingClientTheme";
import InstantInviteShareApps from "../../../../instant_invite/native/components/InstantInviteShareApps";
import InstantInviteActionCreators from "../../../../../actions/InstantInviteActionCreators";
import getInviteURL from "../../../../instant_invite/getInviteURL";
import { TextInput } from "../../../../../design/void/native";
import SearchableUserList from "../../shared_components/user_list/SearchableUserList";
import { HermesBuiltin } from "../../../../../_hermes/prelude";
function $mk116987($env) {
return function*() {
let r50;
let env31772 = {
$parent: $env
};
env31772[1] = 0;
env31772[2] = 0;
const r33 = env31772.$parent;
env31772[0] = r33;
const r11 = r33[1];
if (r11.length === 1) {
r50 = yield (0, handleOneRecipientInDM)(r11, r33[2]);
} else {
r50 = yield ChannelActionCreators.addRecipients(r33[0].id, r11, void 0, r33[2]);
}
const r58 = env31772[0];
r58[3] = r50;
const r59 = r58.$parent;
yield (0, r59[0])(r59[2][14]).monkeyPatchCall();
const r80 = env31772[0];
const r81 = r80.$parent;
(0, r81[1])(r81[2][15]).call(r80[3], false, true);
(0, r81[1])(r81[2][16])(r80[3]);
};
}
let useStyles;
let env11121 = {};
const handleOneRecipientInDM = async function handleOneRecipientInDM(c28094_0, onBeforeTransition) {
let c30902_0 = c28094_0;
let c30902_1 = await ChannelActionCreators.openPrivateChannel({
recipientIds: [],
location: "New Group DM",
onBeforeTransition
});
const r20 = await ChannelActionCreators.addRecipients(c30902_1, c30902_0, void 0);
c30902_1 = r20;
return r20;
};
env11121[22] = function _handleInviteUsers() {
const r8 = async function(c28095_0, c28095_1, c28095_2) {
let r129, r130;
let env30903;
const r11 = env11121;
let c28095_4 = r11;
const r36 = env30903 = {
$parent: r11
};
let c28095_3 = r36;
env30903[1] = void 0;
env30903[2] = void 0;
env30903[0] = c28095_0;
let r37 = c28095_1;
if (r37 === void 0) {
r37 = Array.from(PrivateChannelRecipientsInviteStore.getSelectedUsers());
}
env30903[1] = r37;
env30903[2] = c28095_2;
env30903[3] = void 0;
await void 0;
L19: {
if (env30903[0] != null) {
if (RTCConnectionStore.getChannelId() !== env30903[0].id) {
env30903[3] = env30903[0].isDM() && env30903[1].length === 1 ? await (0, handleOneRecipientInDM)(env30903[1], env30903[2]) : await ChannelActionCreators.addRecipients(env30903[0].id, env30903[1], void 0, env30903[2]);
break L19;
}
}
if (env30903[0] != null) {
if (RTCConnectionStore.getChannelId() === env30903[0].id) {
const isDM = env30903[0].isDM();
if (isDM) {
showGuardCallAlert((0, _asyncToGenerator)($mk116987(c28095_3)));
break L19;
}
if (!env30903[0].isGroupDM()) {
break L19;
}
env30903[3] = await ChannelActionCreators.addRecipients(env30903[0].id, env30903[1], void 0, env30903[2]);
CallActionCreators.ring(env30903[3], env30903[1], "gdm_invite");
} else {
r129 = c28095_3;
r130 = c28095_4;
env30903[3] = await ChannelActionCreators.openPrivateChannel({
recipientIds: env30903[1],
location: "New Group DM",
onBeforeTransition: env30903[2]
});
}
} else {
r129 = c28095_3;
r130 = c28095_4;
env30903[3] = await ChannelActionCreators.openPrivateChannel({
recipientIds: env30903[1],
location: "New Group DM",
onBeforeTransition: env30903[2]
});
}
}
ActionSheetActionCreators.hideActionSheet(NEW_GROUP_DM_POPOUT_ID);
return env30903[3];
};
env11121[22] = r8;
return r8.apply(this, arguments);
};
useStyles = createStyles({
button: {
color: Module712.colors.INTERACTIVE_TEXT_ACTIVE
},
container: {
height: "100%",
display: "flex"
},
instantInviteView: {
flexShrink: 1,
backgroundColor: Module712.colors.MOBILE_ACTIONSHEET_BACKGROUND
},
nameInputContainer: {
paddingHorizontal: 16,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
nameInput: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER,
marginBottom: 8,
height: 40,
width: "100%"
}
});
export default function NewGroupDMScreen(props) {
let env22228 = {
$parent: env11121
};
const navigation = props.navigation;
env22228[0] = navigation;
const params = props.route.params;
env22228[1] = params.channelId;
const locationPage = params.locationPage;
env22228[2] = locationPage;
let allowNameEdit = params.allowNameEdit;
if (allowNameEdit === void 0) {
allowNameEdit = false;
}
env22228[3] = void 0;
env22228[4] = void 0;
env22228[5] = void 0;
env22228[6] = void 0;
env22228[7] = void 0;
env22228[8] = void 0;
env22228[9] = void 0;
env22228[10] = void 0;
env22228[11] = void 0;
env22228[12] = void 0;
env22228[13] = void 0;
env22228[14] = void 0;
env22228[15] = void 0;
env22228[16] = void 0;
const styles = useStyles();
env22228[3] = styles;
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(env22228[1]));
env22228[4] = stateFromStores;
const stateFromStores2 = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
env22228[5] = stateFromStores2;
const r48 = _slicedToArray(useState([]), 2);
const selectedUserIds = r48[0];
env22228[6] = selectedUserIds;
env22228[7] = r48[1];
const r52 = _slicedToArray(useState(false), 2);
const r25 = r52[0];
env22228[8] = r25;
env22228[9] = r52[1];
const r56 = _slicedToArray(useState(""), 2);
const value = r56[0];
env22228[10] = value;
const onChangeText = r56[1];
const memo = useMemo(() => {
let r4 = env22228[4]?.recipients;
if (r4 == null) {
r4 = [];
}
return r4;
}, [stateFromStores]);
env22228[11] = memo;
const length = selectedUserIds.length;
let length2 = memo.length;
if (length2 == null) {
length2 = 0;
}
const r19 = length + (length2 + 1);
env22228[12] = r19;
const r4 = r19 > getGroupDMRecipientLimit(stateFromStores);
env22228[13] = r4;
useEffect(() => {
AnalyticsUtils.track(AnalyticEvents.OPEN_POPOUT, {
type: AnalyticsSections.DM_INVITE,
location: {
page: env22228[2]
}
});
}, [locationPage]);
const callback = useCallback(async () => {
let c28096_0, c28096_1, c28096_2;
let c28096_3 = 0;
const r15 = env22228;
L17: {
try {
let env30904;
c28096_1 = r15;
const r37 = env30904 = {
$parent: r15
};
c28096_0 = r37;
env30904[0] = void 0;
(0, env22228[9])(true);
c28096_3 = 1;
env30904[0] = await (function handleInviteUsers() {
return env11121[22].apply(this, arguments);
})(env22228[4], [...env22228[6], ...env22228[11]], () => {
const r3 = env22228[0];
let r4 = r3.getParent();
if (r4 == null) {
r4 = r3;
}
return r4.goBack();
});
c28096_3 = 0;
if (env22228[4] == null && env30904[0] != null && env22228[10] !== "") {
await ChannelActionCreators.setName(env30904[0], env22228[10]);
break L17;
}
} catch ($e) {
const r35 = $e;
let r7 = r35;
c28096_2 = r35;
if (c28096_3 !== 0) {
while (true) {
try {
c28096_3 = 0;
ToastActionCreators.open({
key: "GROUP_DM_ADD_ERROR",
content: intl.string(t["N/9OFy"])
});
(0, env22228[9])(false);
} catch (r110) {
r7 = r110;
c28096_2 = r110;
if (c28096_3 === 0) {
break;
}
continue;
}
return void 0;
}
}
throw r7;
}
return void 0;
}
}, [stateFromStores, navigation, memo, selectedUserIds, value]);
env22228[14] = callback;
useLayoutEffect(() => {
const r10 = env22228[4];
const title = (r10 == null ? void 0 : r10.isGroupDM()) ? intl.string(t["LR+Ptf"]) : intl.string(t["3hF1W4"]);
if (r10 != null) {
r10.isGroupDM();
}
const subtitle = intl.formatToPlainString(t.YUhnoy, {
numMembers: env22228[12],
maxMemberLimit: getGroupDMRecipientLimit(r10)
});
env22228[0].setOptions({
title: `${title} (${subtitle})`,
headerTitle: (a0) => {
if (a0 == null) {
HermesBuiltin.throwTypeError("Cannot destructure 'undefined' or 'null'.");
throw new Error("unreachable");
}
return <GenericHeaderTitle {...HermesBuiltin.copyDataProperties({}, a0, void 0)} title={title} subtitle={subtitle} color={env22228[13] ? "text-feedback-critical" : "mobile-text-heading-primary"} />;
},
headerRight: (a0) => {
let r39;
if (env22228[8]) {
r39 = (0, jsx)(ActivityIndicator, {
color: env22228[3].button.color,
size: "small"
});
} else {
const r11 = env22228[4];
r39 = (r11 == null ? void 0 : r11.isGroupDM()) ? getRenderHeaderTextButton(intl.string(t.OYkgVk), async () => await (0, env22228[14])())({
...a0,
disabled: env22228[13] || (r11 == null ? void 0 : r11.isGroupDM()) && env22228[6].length <= 0
}) : getRenderHeaderTextButton(intl.string(t.CumH4u), async () => await (0, env22228[14])())({
...a0,
disabled: env22228[13]
});
}
return r39;
}
});
}, [stateFromStores, r25, navigation, r19, r4, memo, selectedUserIds, callback, styles]);
const callback2 = useCallback((c28098_0) => {
(0, env22228[7])((a0) => {
const indexOf = a0.indexOf;
const r9 = indexOf.call(a0, c28098_0.id);
const r10 = [...a0];
if (r9 === -1) {
r10.push(c28098_0.id);
} else {
r10.splice(r9, 1);
}
return r10;
});
}, []);
const r85 = _slicedToArray(useState(false), 2);
env22228[15] = r85[0];
env22228[16] = r85[1];
const isUsingClientTheme = useIsUsingClientTheme();
let r96 = (stateFromStores == null ? void 0 : stateFromStores.isGroupDM()) && stateFromStores2 != null && r19 < getGroupDMRecipientLimit(stateFromStores);
if (r96) {
let c22229_0 = async (c30905_0) => {
let c30905_2;
let c31775_0, c31775_1;
L15: {
c30905_2 = void 0;
c31775_0 = c30905_0;
c31775_1 = void 0;
if (env22228[15]) {
break L15;
}
(0, env22228[16])(true);
c31775_1 = await InstantInviteActionCreators.mobileCreateInvite(env22228[4], InstantInviteSources.GROUP_DM);
if (c31775_1 != null) {
c31775_0({
channel: env22228[4],
code: c31775_1,
message: intl.formatToPlainString(t["+zWvOQ"], {
username: env22228[5].username,
link: getInviteURL(c31775_1)
}),
location: InstantInviteSources.GROUP_DM
});
}
(0, env22228[16])(false);
return void 0;
}
};
r96 = <View style={styles.instantInviteView}>
<InstantInviteShareApps onItemPressed={function() {
return c22229_0.apply(this, arguments);
}} />
</View>;
}
return <View style={styles.container}>
{r96}
{allowNameEdit ? <View style={styles.nameInputContainer}>
<TextInput style={styles.nameInput} value={value} onChangeText={onChangeText} placeholder={intl.string(t.KSVhrX)} />
</View> : null}
{(0, jsx)(SearchableUserList, {
rowMode: UserRowModes.TOGGLE,
onSelectUser: callback2,
disabledUserIds: memo,
selectedUserIds,
withAffinitySuggestions: true,
withAlphabeticalSections: false,
disableGradient: true,
disableStickySections: isUsingClientTheme
})}
</View>;
};
@@ -0,0 +1,489 @@
// Metro module 15584 (f15585).
import _slicedToArray from "../../../../../_bundle/_slicedToArray";
import { useMemo, useRef, useEffect, useCallback, useState, useLayoutEffect } from "react";
import { View } from "react-native";
import { PrivateChannelRecord } from "../../../../../records/ChannelRecord";
import ChannelStore from "../../../../../stores/ChannelStore";
import RelationshipStore from "../../../../../stores/RelationshipStore";
import PrivateChannelSortStore from "../../../../../stores/views/PrivateChannelSortStore";
import { UserRowModes } from "../../shared_components/user_list/UserRowConstants";
import { ME, AnalyticEvents, ChannelTypes, Routes, AnalyticsSections } from "../../../../../Constants";
import { jsx } from "react/jsx-runtime";
import ReanimatedRexport, { useAnimatedStyle } from "../../../../reanimated/ReanimatedRexport";
import { Text } from "../../../../../design/components/Text/native/Text";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { isAndroid } from "../../../../../utils/PlatformUtils";
import ChannelActionCreators from "../../../../../actions/ChannelActionCreators";
import { FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID } from "../../../../channel/FakePlaceholderPrivateChannel";
import Dispatcher from "../../../../../Dispatcher";
import { useStateFromStores } from "../../../../../_bundle/Module589";
import AnalyticsUtils from "../../../../../utils/AnalyticsUtils";
import useOnMessageSend from "../../../../messages/useOnMessageSend";
import getGroupDMRecipientLimit from "../../../../group_dm/getGroupDMRecipientLimit";
import * as _timing from "../../../../../design/animation/reanimated/timing/timing";
import { GenericHeaderTitle } from "../../shared_components/HeaderShared";
import { intl, t } from "../../../../../intl/index.native";
import ChatView from "../../../../chat/native/ChatView";
import { PortalKeyboardRenderer } from "../../../../keyboard/native/PortalKeyboardRenderer";
import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../../../app_analytics/AnalyticsLocation";
import useSafeAreaInsetsKeyboardAware_native from "../../../../safe_area/useSafeAreaInsetsKeyboardAware.native";
import useMountEffect from "../../../../../hooks/useMountEffect";
import ChannelActions from "../../channel/ChannelActions";
import { transitionTo } from "../../../../routing/router_utils";
import { showMaxGroupMembers } from "../../../../toast/native/ToastUtils";
import Module10223 from "../../../../../_bundle/Module10223";
import { GroupPlusIcon } from "../../../../../design/components/Icon/native/redesign/generated/GroupPlusIcon";
import Module4128 from "../../../../../_bundle/Module4128";
import { UserPlusIcon } from "../../../../../design/components/Icon/native/redesign/generated/UserPlusIcon";
import NoResults from "../../shared_components/user_list/NoResults";
import { Button } from "../../../../../design/components/Button/native/Button.native";
import NewMessageUserList from "../../shared_components/user_list/NewMessageUserList";
let findLocalMatchingPrivateChannelId, Header, ChatPreview, Component, useStyles, c11109_24;
let env11109 = {};
const isPrivateChannelMatch = function isPrivateChannelMatch(a0, { recipients }) {
if (recipients.length !== a0.length) {
return false;
}
for (const item of recipients) {
if (a0.includes(item)) {
continue;
}
return false;
}
return true;
};
findLocalMatchingPrivateChannelId = function findLocalMatchingPrivateChannelId(a0) {
if (a0.length === 1) {
let r45 = ChannelStore.getDMFromUserId(a0[0]);
if (r45 == null) {
r45 = null;
}
return r45;
}
const r27 = _slicedToArray(PrivateChannelSortStore.getSortedChannels(), 2);
for (const item of [r27[0], r27[1]]) {
const r37 = item.find((item) => {
const channel = ChannelStore.getChannel(item.channelId);
const r2 = channel == null || !channel.isPrivate();
return r2 ? !r2 : isPrivateChannelMatch(a0, channel);
});
if (r37 == null) {
continue;
}
return r37.channelId;
}
return null;
};
env11109[23] = function _findMatchingPrivateChannelId() {
const r8 = async (c28086_0) => {
let r26, dMChannel;
let c28086_4 = 0;
L15: {
L14: {
try {
r26 = findLocalMatchingPrivateChannelId(c28086_0);
if (r26 != null) {
break L15;
}
if (c28086_0.length > 1) {
break L14;
}
c28086_4 = 1;
dMChannel = await ChannelActionCreators.getDMChannel(c28086_0[0]);
c28086_4 = 0;
} catch ($e) {
let r7 = $e;
if (c28086_4 !== 0) {
while (true) {
try {
c28086_4 = 0;
} catch ($e) {
r7 = $e;
if (c28086_4 === 0) {
break;
}
continue;
}
return null;
}
}
throw r7;
}
return dMChannel;
}
return null;
}
return r26;
};
env11109[23] = r8;
return r8.apply(this, arguments);
};
Header = function Header(props) {
const { title, numInGroup } = props;
const styles = useStyles();
const memo = useMemo(() => getGroupDMRecipientLimit() - (numInGroup + 1), [numInGroup]);
const r24 = function() {
const r4 = numInGroup >= 5;
return {
opacity: _timing.withTiming(r4 ? 1 : 0),
maxHeight: _timing.withTiming(r4 ? 20 : 0)
};
};
r24.__closure = {
numInGroup,
NUM_IN_GROUP_THRESHOLD: 5,
withTiming: _timing.withTiming
};
r24.__workletHash = 12426216833792;
r24.__initData = c11109_24;
const animatedStyle = useAnimatedStyle(r24);
const r2 = memo === 0;
return <View style={styles.header}>
<GenericHeaderTitle title={title} />
<Component style={animatedStyle} variant="text-xs/medium" color={r2 ? "text-feedback-critical" : "text-muted"}>
{r2 ? intl.string(t.yiQW1O) : intl.formatToPlainString(t.HrSDPF, {
number: `${memo}`
})}
</Component>
</View>;
};
ChatPreview = function ChatPreview(props) {
let channelId2, navigateToChannel;
const { channelId, navigateToChannel: navigateToChannel2, tagListInputRef } = props;
const styles = useStyles();
const ref = useRef(null);
useEffect(() => {
if (channelId != null) {
ChannelActionCreators.preload(ME, channelId);
}
}, [channelId]);
channelId2 = channelId;
navigateToChannel = navigateToChannel2;
useOnMessageSend(useCallback(() => {
AnalyticsUtils.track(AnalyticEvents.MESSAGE_COMPOSER_TRANSITIONED, {
channel_id: channelId2
});
navigateToChannel(channelId2);
}, [channelId, navigateToChannel]));
return <View style={styles.background}>
<View style={styles.container}>
<ChatView guildId={ME} channelId={channelId} chatInputRef={ref} HACK_fixModalInteraction alwaysRespectKeyboard screenIndex="new-message" secondaryTextFieldRef={tagListInputRef} />
<PortalKeyboardRenderer portal={isAndroid()} />
</View>
</View>;
};
Component = ReanimatedRexport.createAnimatedComponent(Text);
useStyles = createStyles({
container: {
flex: 1
},
background: {
flex: 1,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
header: {
flexDirection: "column",
alignItems: isAndroid() ? "flex-start" : "center"
},
emptyContainer: {
flexGrow: 1,
justifyContent: "center"
},
emptyKeyboardView: {
flexGrow: 1
},
addFriendsButtonContainer: {
marginBottom: Module712.space.PX_16,
flexDirection: "row",
justifyContent: "center",
width: "100%"
}
});
c11109_24 = {
code: "function NewMessageScreenTsx1(){const{numInGroup,NUM_IN_GROUP_THRESHOLD,withTiming}=this.__closure;const show=numInGroup>=NUM_IN_GROUP_THRESHOLD;return{opacity:withTiming(show?1:0),maxHeight:withTiming(show?20:0)};}"
};
export default function NewMessageScreen(props) {
let env22213 = {
$parent: env11109
};
const navigation = props.navigation;
env22213[0] = navigation;
const params = props.route.params;
const defaultSelectedUserId = params.defaultSelectedUserId;
env22213[1] = params.sourcePage;
env22213[2] = void 0;
env22213[3] = void 0;
env22213[4] = void 0;
env22213[5] = void 0;
env22213[6] = void 0;
env22213[7] = void 0;
env22213[8] = void 0;
env22213[9] = void 0;
env22213[10] = void 0;
env22213[11] = void 0;
const styles = useStyles();
env22213[2] = styles;
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.NEW_MESSAGE_COMPOSER).analyticsLocations;
const insets = useSafeAreaInsetsKeyboardAware_native({
includeKeyboardHeight: true
}).insets;
env22213[3] = insets;
useMountEffect(() => {
AnalyticsUtils.track(AnalyticEvents.MESSAGE_COMPOSER_OPENED, {
source_page: env22213[1]
});
});
const r45 = defaultSelectedUserId != null ? [defaultSelectedUserId] : [];
let stateFromStores;
let c22215_0;
const r48 = _slicedToArray(useState(r45), 2);
const r13 = r48[0];
env22213[4] = r13;
env22213[5] = r48[1];
const r52 = _slicedToArray(useState(false), 2);
const r53 = r52[0];
env22213[6] = r52[1];
const r57 = _slicedToArray(useState(false), 2);
const forceSearchResults = r57[0];
env22213[7] = r57[1];
const state = r13;
stateFromStores = void 0;
let [channelId3, setState] = useState(null);
const state2 = channelId3;
useEffect(() => {
let handleChannelDelete2;
const handleChannelCreate2 = function handleChannelCreate({ channel }) {
if (channel.id !== FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID && channel.isPrivate() && isPrivateChannelMatch(state, channel)) {
setState(findLocalMatchingPrivateChannelId(state));
}
};
handleChannelDelete2 = function handleChannelDelete(c30896_0) {
setState((prevState) => prevState !== FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID ? prevState !== c30896_0.channel.id ? prevState : null : prevState);
};
Dispatcher.subscribe("CHANNEL_CREATE", handleChannelCreate2);
Dispatcher.subscribe("CHANNEL_DELETE", handleChannelDelete2);
return () => {
Dispatcher.unsubscribe("CHANNEL_CREATE", handleChannelCreate2);
Dispatcher.unsubscribe("CHANNEL_DELETE", handleChannelDelete2);
};
}, [state]);
stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(state2));
useEffect(() => {
let _doAction2 = function _doAction() {
const r9 = async () => {
let c31770_1;
let env32073;
c31770_1 = void 0;
const r11 = env32073 = {
$parent: env11109
};
let c31770_0 = r11;
env32073[0] = void 0;
env32073[0] = await (function findMatchingPrivateChannelId() {
return env11109[23].apply(this, arguments);
})(state);
setState(env32073[0] == null ? FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID : env32073[0]);
};
_doAction2 = r9;
return r9.apply(this, arguments);
};
if (state.length !== 0) {
if (!((stateFromStores == null ? void 0 : stateFromStores.isPrivate()) && isPrivateChannelMatch(state, stateFromStores))) {
(function doAction() {
return _doAction2.apply(this, arguments);
})();
}
} else {
setState(null);
}
}, [state, stateFromStores]);
useEffect(() => {
if (!(state2 != null && state2 !== FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID) && findLocalMatchingPrivateChannelId(state) == null) {
Dispatcher.dispatch({
type: "CHANNEL_CREATE",
channel: new PrivateChannelRecord({
id: FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID,
type: state.length === 1 ? ChannelTypes.DM : ChannelTypes.GROUP_DM,
name: "",
guild_id: null,
recipients: state
})
});
return () => {
Dispatcher.dispatch({
type: "CHANNEL_DELETE",
channel: {
id: FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID,
guild_id: void 0,
parent_id: void 0
}
});
};
}
}, [state, state2]);
useEffect(() => {
if (stateFromStores != null && stateFromStores.id === FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID) {
Dispatcher.dispatch({
type: "LOAD_MESSAGES_SUCCESS",
channelId: stateFromStores.id,
messages: [],
isBefore: false,
isAfter: false,
hasMoreBefore: false,
hasMoreAfter: false,
limit: 0,
jump: void 0,
isStale: false
});
}
}, [stateFromStores]);
env22213[8] = state2;
const ref = useRef(null);
useLayoutEffect(() => {
env22213[0].setOptions({
headerTitle: (a0) => (0, jsx)(Header, {
numInGroup: env22213[4].length,
title: a0.children
}),
headerRight: () => {
const channelId3 = env22213[8];
return channelId3 !== null ? channelId3 !== FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID ? (0, jsx)(ChannelActions, {
channelId: channelId3,
screenIndex: "new-message"
}) : null : null;
}
});
}, [navigation, state.length, state2]);
const callback = useCallback((a0) => {
env22213[0].goBack();
transitionTo(Routes.CHANNEL(ME, a0));
}, [navigation]);
env22213[9] = callback;
c22215_0 = void 0;
c22215_0 = async (c30897_0) => {
let c30897_2;
let c31771_0;
L21: {
L20: {
L17: {
c30897_2 = void 0;
c31771_0 = void 0;
if (c30897_0 instanceof PrivateChannelRecord) {
AnalyticsUtils.track(AnalyticEvents.MESSAGE_COMPOSER_SEARCH_RESULT_CLICKED);
(0, env22213[9])(c30897_0.id);
break L21;
}
if (RelationshipStore.isFriend(c30897_0.id)) {
const r46 = env22213[4];
const r48 = r46.indexOf(c30897_0.id);
const r49 = [...r46];
if (r48 === -1) {
if (r46.length >= getGroupDMRecipientLimit() - 1) {
showMaxGroupMembers();
AnalyticsUtils.track(AnalyticEvents.MESSAGE_COMPOSER_MAX_USERS_ADDED);
break L20;
}
r49.push(c30897_0.id);
} else {
r49.splice(r48, 1);
}
(0, env22213[5])(r49);
(0, env22213[7])(false);
break L17;
}
c31771_0 = await ChannelActionCreators.getOrEnsurePrivateChannel(c30897_0.id);
AnalyticsUtils.track(AnalyticEvents.MESSAGE_COMPOSER_SEARCH_RESULT_CLICKED);
(0, env22213[9])(c31771_0);
return void 0;
}
return void 0;
}
return void 0;
}
};
const callback2 = useCallback(function(a0) {
return c22215_0.apply(this, arguments);
}, [state, callback]);
const callback3 = useCallback(() => {
(0, env22213[7])((a0) => !a0);
}, []);
const callback4 = useCallback((a0) => {
(0, env22213[7])(false);
(0, env22213[6])(a0.length > 0);
}, []);
const memo = useMemo(() => env22213[4].join(":"), [state]);
let overrideResults = void 0;
if (!r53) {
overrideResults = void 0;
if (!forceSearchResults) {
const r115 = state.length > 0;
overrideResults = void 0;
if (r115) {
if (state2 == null) {
channelId3 = FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID;
}
overrideResults = <ChatPreview key={memo} channelId={channelId3} navigateToChannel={callback} tagListInputRef={ref} />;
}
}
}
const withGuildMembers = state.length === 0;
env22213[10] = withGuildMembers;
const stateFromStores2 = useStateFromStores([RelationshipStore], () => RelationshipStore.getRelationshipCount() > 0);
env22213[11] = stateFromStores2;
return <AnalyticsLocationProvider value={analyticsLocations}>
<NewMessageUserList actions={useMemo(() => {
const r1 = [];
if (env22213[10]) {
if (env22213[11]) {
r1.push({
icon: Module10223,
IconComponent: GroupPlusIcon,
label: intl.string(t["3hF1W4"]),
iconVariant: "default",
onPress: () => env22213[0].navigate("gdm", {
allowNameEdit: false,
locationPage: AnalyticsSections.NEW_MESSAGE_COMPOSER
})
});
}
r1.push({
icon: Module4128,
IconComponent: UserPlusIcon,
label: intl.string(t["9nbDJx"]),
iconVariant: "default",
onPress: () => {
env22213[0].navigate("add-friends", {
sourcePage: "New Message Composer"
});
}
});
}
return r1;
}, [navigation, stateFromStores2, withGuildMembers])} noResultActions={useMemo(() => [{
icon: Module4128,
IconComponent: UserPlusIcon,
label: intl.string(t["9nbDJx"]),
iconVariant: "default",
onPress: () => {
env22213[0].navigate("add-friends", {
sourcePage: "New Message Composer"
});
}
}], [navigation])} rowMode={UserRowModes.NONE} tagListInputRef={ref} onSelectUser={callback2} onQueryChanged={callback4} selectedUserIds={state} withAffinitySuggestions overrideResults={overrideResults} withGuildMembers={withGuildMembers} withGDMNames forceSearchResults={forceSearchResults} onForceSearchResults={callback3} defaultNoResultsFound={useMemo(() => {
const r7 = env22213[2];
return <View style={[r7.emptyKeyboardView, {
paddingBottom: env22213[3].bottom
}]}>
<NoResults title={intl.string(t["1ESycm"])} subtitle={intl.string(t["5IlFpu"])} containerStyle={r7.emptyContainer} fullHeight>
<View style={r7.addFriendsButtonContainer}>
<Button text={intl.string(t.zIJnA6)} size="lg" onPress={() => env22213[0].navigate("add-friends", {
sourcePage: "New Message Composer No Results"
})} grow />
</View>
</NoResults>
</View>;
}, [navigation, styles, insets.bottom])} autoFocusSearch />
</AnalyticsLocationProvider>;
};
@@ -0,0 +1,49 @@
// Metro module 15611 (f15612).
import { useCallback } from "react";
import RelationshipStore from "../../../../../stores/RelationshipStore";
import UserStore from "../../../../../stores/UserStore";
import { UserRowModes } from "../../shared_components/user_list/UserRowConstants";
import { RelationshipTypes } from "../../../../../Constants";
import useAnalyticsLocations from "../../../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../../../app_analytics/AnalyticsLocation";
import { useStateFromStoresArray } from "../../../../../_bundle/Module589";
import { getPendingRelationshipIds } from "../hooks/getPendingRelationshipIds";
import useTrackImpression from "../../../../app_analytics/useTrackImpression";
import { ImpressionNames } from "../../../../../_bundle/Module503";
import showUserProfileActionSheet from "../../../../user_profile/native/showUserProfileActionSheet";
import { UsersFastList } from "../../shared_components/user_list/UsersFastList";
export default function SpamRequestsScreen(props) {
let stateFromStoresArray2, callback;
const navigation = props.navigation;
stateFromStoresArray2 = void 0;
callback = void 0;
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.FRIEND_REQUESTS).analyticsLocations;
const stateFromStoresArray = useStateFromStoresArray([RelationshipStore], () => getPendingRelationshipIds(RelationshipStore.getMutableRelationships()).spamIds);
useTrackImpression({
name: ImpressionNames.FRIEND_REQUESTS_SPAM_INBOX
});
stateFromStoresArray2 = useStateFromStoresArray([UserStore], () => stateFromStoresArray.map((item) => UserStore.getUser(item)).filter((item) => item != null), [stateFromStoresArray]);
callback = useCallback((a0) => {
showUserProfileActionSheet({
userId: a0.id,
localUser: a0,
sourceAnalyticsLocations: analyticsLocations
});
}, [analyticsLocations]);
const callback2 = useCallback(() => {}, []);
const callback3 = useCallback((a0, a1) => ({
type: "user",
props: {
type: RelationshipTypes.PENDING_INCOMING,
user: stateFromStoresArray2[a1],
onPress: callback,
mode: UserRowModes.ACTIONS,
start: a1 === 0,
end: a1 === stateFromStoresArray2.length - 1
}
}), [callback, stateFromStoresArray2]);
if (stateFromStoresArray2.length !== 0) {
return <UsersFastList getItemProps={callback3} getSectionProps={callback2} sections={[stateFromStoresArray2.length]} />;
}
navigation.goBack();
};
@@ -0,0 +1,66 @@
// Metro module 15605 (f15606).
import { useEffect, useCallback } from "react";
import { View } from "react-native";
import { AnalyticEvents, AnalyticsSections } from "../../../../../Constants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../../../app_analytics/AnalyticsLocation";
import AnalyticsUtils from "../../../../../utils/AnalyticsUtils";
import useSuggestedFriends from "../components/useSuggestedFriends";
import showUserProfileActionSheet from "../../../../user_profile/native/showUserProfileActionSheet";
import { ContactSuggestionRow } from "../components/ContactSuggestionRow";
import ThemedGradient from "../../../../client_themes/native/ThemedGradient";
import { UsersFastList } from "../../shared_components/user_list/UsersFastList";
import NoResults from "../../shared_components/user_list/NoResults";
import { intl, t } from "../../../../../intl/index.native";
const useStyles = createStyles({
emptyContainer: {
flex: 1,
paddingTop: Module712.space.PX_32
},
container: {
flex: 1
}
});
export default function SuggestedFriendsScreen() {
let added, setAdded, friendSuggestions, callback;
const styles = useStyles();
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.SUGGESTED_FRIENDS).analyticsLocations;
useEffect(() => {
AnalyticsUtils.track(AnalyticEvents.FRIEND_ADD_VIEWED, {
friend_add_type: AnalyticsSections.FRIENDS_SUGGESTED_FRIENDS_MODAL
});
}, []);
const suggestedFriends = useSuggestedFriends();
added = suggestedFriends.added;
setAdded = suggestedFriends.setAdded;
friendSuggestions = suggestedFriends.friendSuggestions;
callback = useCallback((a0) => {
showUserProfileActionSheet({
userId: a0.id,
localUser: a0,
sourceAnalyticsLocations: analyticsLocations
});
}, [analyticsLocations]);
const callback3 = useCallback((a0, a1) => {
const suggestedFriend = friendSuggestions[a1];
const r10 = suggestedFriend?.mutualFriendsCount != null && suggestedFriend?.mutualFriendsCount > 0;
const end = a1 === friendSuggestions.length - 1;
return {
type: "custom",
itemType: r10 ? "contactSuggestionMutualCount" : "contactSuggestionNoMutualCount",
key: suggestedFriend.user.id,
component: () => <ContactSuggestionRow added={added.includes(suggestedFriend)} suggestedFriend={suggestedFriend} start={a1 === 0} end={end} onPress={callback} onAddSuggestion={() => setAdded((prevAdded) => [...prevAdded, suggestedFriend])} location={AnalyticsSections.FRIENDS_SUGGESTED_FRIENDS_MODAL} />
};
}, [added, friendSuggestions, callback, setAdded]);
const callback2 = useCallback(() => {}, []);
return <AnalyticsLocationProvider value={analyticsLocations}>
<ThemedGradient absolute />
<View style={styles.container}>
{friendSuggestions.length !== 0 ? <UsersFastList sections={[friendSuggestions.length]} getItemProps={callback3} getSectionProps={callback2} insetStart={8} /> : <View style={styles.emptyContainer}>
<NoResults title={intl.string(t.pxFW8V)} disableBackgroundOverlay />
</View>}
</View>
</AnalyticsLocationProvider>;
};
@@ -0,0 +1,73 @@
// Metro module 15604 (f15605).
import { useEffect, useRef } from "react";
import { ScrollView, View } from "react-native";
import { AnalyticEvents, AnalyticsSections } from "../../../../../Constants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import AnalyticsUtils from "../../../../../utils/AnalyticsUtils";
import useSafeAreaInsetsKeyboardAware_native from "../../../../safe_area/useSafeAreaInsetsKeyboardAware.native";
import { getIsScreenReaderEnabled } from "../../../../a11y/native/useIsScreenReaderEnabled.native";
import { useClientThemesOverride } from "../../../../client_themes/native/ClientThemesOverrides";
import { isIOS } from "../../../../../utils/PlatformUtils";
import KeyboardAwareView from "../../../../keyboard/native/KeyboardAwareView";
import ThemedGradient from "../../../../client_themes/native/ThemedGradient";
import AddFriendById from "./AddFriendById";
import { intl, t } from "../../../../../intl/index.native";
const useStyles = createStyles({
background: {
flex: 1,
backgroundColor: Module712.colors.MOBILE_ACTIONSHEET_BACKGROUND
},
content: {
flex: 1,
backgroundColor: Module712.colors.MOBILE_ACTIONSHEET_BACKGROUND
},
iosPaddingThemeAdjust: {
paddingTop: Module712.space.PX_40
},
container: {
flexGrow: 1,
backgroundColor: Module712.colors.MOBILE_ACTIONSHEET_BACKGROUND,
paddingHorizontal: Module712.space.PX_16
},
inputContainer: {
marginTop: Module712.space.PX_16,
backgroundColor: "transparent",
paddingHorizontal: 0
},
headerText: {
textTransform: "none"
}
});
export default function UsernameSearchScreen(props) {
let ref;
const navigation = props.navigation;
ref = void 0;
const styles = useStyles();
useEffect(() => {
AnalyticsUtils.track(AnalyticEvents.FRIEND_ADD_VIEWED, {
friend_add_type: AnalyticsSections.FRIENDS_ADD_BY_USERNAME_MODAL
});
}, []);
const insets = useSafeAreaInsetsKeyboardAware_native().insets;
ref = useRef(null);
useEffect(() => navigation.addListener("transitionEnd", (a0) => {
if (!(a0.data.closing || getIsScreenReaderEnabled())) {
const current = ref.current;
if (current != null) {
current.focus();
}
}
}), [navigation]);
const clientThemesOverride = useClientThemesOverride();
return <View style={styles.background}>
<KeyboardAwareView style={[styles.content, clientThemesOverride]}>
<ThemedGradient absolute />
<ScrollView alwaysBounceVertical={false} keyboardShouldPersistTaps="handled" contentContainerStyle={[styles.container, isIOS() ? clientThemesOverride != null ? insets.top > 0 ? styles.iosPaddingThemeAdjust : null : null : null, {
paddingBottom: insets.bottom + Module712.space.PX_16
}]}>
<AddFriendById style={styles.inputContainer} autoFocusInput={false} headerText={intl.string(t.YEOwDM)} headerTextStyle={styles.headerText} ref={ref} />
</ScrollView>
</KeyboardAwareView>
</View>;
};
@@ -0,0 +1,13 @@
// Metro module 13612 (f13613).
import { coerceChannelRoute, coerceGuildsRoute } from "../helpers/NavigationRouteUtils.native";
export default function getChannelDetailsFromRoute(a0, r7 = false) {
const r11 = coerceChannelRoute(a0);
if (r11 != null) {
return [r11.params.guildId, r11.params.channelId];
}
if (r7) {
const r16 = coerceGuildsRoute(a0);
return r16 != null ? [r16.params?.guildId, r16.params?.channelId] : [void 0, void 0];
}
return [void 0, void 0];
};
@@ -0,0 +1,173 @@
// Metro module 4042 (f4043).
import AuthenticationStore from "../../../stores/AuthenticationStore";
import DefaultRouteStore from "../../../stores/DefaultRouteStore";
import SelectedChannelStore from "../../../stores/SelectedChannelStore";
import { ME, Routes } from "../../../Constants";
import Logger from "../../debug/Logger";
import { getChatLayout } from "../../chat/native/useChatLayout";
import { getHistory } from "../../routing/router_utils";
import { matchPath } from "../../routing/matchPathCompat";
import { RouteParam } from "../../routing/RouteUtils";
import { MobileHomeDrawerExperiment } from "../../home_drawer/native/HomeDrawerExperiment";
let c2319_8, computeInitialNavigationStateWithoutLogging;
const getInitialGuildState = function getInitialGuildState(a0, a1, a2, drawerOpen = false) {
let r32;
let channelId = a1 == null ? SelectedChannelStore.getChannelId(a0) : a1;
if (channelId == null) {
channelId = void 0;
}
const isChatLockedOpen = getChatLayout().isChatLockedOpen;
if (a2 && (channelId != null && (!isChatLockedOpen && !drawerOpen))) {
const routes = [{
name: "tabs",
state: {
routes: [{
name: "guilds",
params: {
guildId: a0,
channelId
}
}],
index: 0
}
}, {
name: "channel",
params: {
guildId: a0,
channelId
}
}];
r32 = [true, {
index: 0,
routes: [{
name: "main",
state: {
routes,
index: routes.length - 1
}
}]
}];
} else {
const r34 = !!isChatLockedOpen && channelId != null;
const routes2 = [{
name: "tabs",
state: {
routes: [{
name: "guilds",
params: {
guildId: a0,
channelId,
drawerOpen
}
}],
index: 0
}
}];
r32 = [r34, {
index: 0,
routes: [{
name: "main",
state: {
routes: routes2,
index: routes2.length - 1
}
}]
}];
}
return r32;
};
computeInitialNavigationStateWithoutLogging = function computeInitialNavigationStateWithoutLogging() {
let r54, r55;
if (AuthenticationStore.getToken() != null) {
const location2 = getHistory().location;
const r46 = matchPath(location2.pathname, {
path: Routes.CHANNEL(RouteParam.guildId(), RouteParam.channelId({
optional: true
}), ":messageId?")
});
const r53 = MobileHomeDrawerExperiment.getConfig({
location: "app-start"
}).landOnHome && r46 == null;
if (r46 == null) {
r55 = matchPath(DefaultRouteStore.lastNonVoiceRoute, {
path: Routes.CHANNEL(RouteParam.guildId(), RouteParam.channelId({
optional: true
}), ":messageId?")
});
r54 = false;
} else {
r54 = location2.openChannel;
if (r54 == null) {
r54 = false;
}
r55 = r46;
}
let r74 = r55?.params;
if (r74 == null) {
r74 = {};
}
const { channelId, guildId } = r74;
if (guildId == null) {
const r93 = [{
page: "private-channels"
}, ,];
let r94 = r53;
if (r94 === void 0) {
r94 = false;
}
r93[1] = getInitialGuildState(ME, void 0, false, r94)[1];
return r93;
}
if (!r54) {
r54 = guildId !== ME;
}
const [r82, r83] = getInitialGuildState(guildId, channelId, r54, r53);
const page = r82 ? "other" : guildId === ME ? "private-channels" : "guild-channels";
return page === "private-channels" ? [{
page
}, r83] : [{
page,
guildId
}, r83];
}
return [{
page: "other"
}, {
routes: [{
name: "auth"
}],
index: 0
}];
};
c2319_8 = new Logger("getInitialNavigationState");
export default function getInitialNavigationState(a0) {
const r8 = computeInitialNavigationStateWithoutLogging()[1];
let c13803_0 = r8;
if (a0 != null) {
a0.forEach((item) => c13803_0.routes.push(item));
}
return r8;
};
export function wrapRouteForRootNavigator(a0) {
return [{
name: "main",
state: {
routes: a0,
index: a0.length - 1
}
}];
}
export function getInitialAuthState() {
return {
routes: [{
name: "auth"
}],
index: 0
};
}
export { getInitialGuildState };
export function computeInitialNavigationState() {
const r5 = computeInitialNavigationStateWithoutLogging();
c2319_8.log("Initial State:", r5);
return r5;
}
@@ -0,0 +1,62 @@
// Metro module 15700 (f15701).
import { useLayoutEffect } from "react";
import { View } from "react-native";
import { createNativeStackNavigator } from "../../../../_bundle/Module9109";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useAccessibilityNativeStackOptions } from "../../../../design/components/Navigator/native/Navigator.native";
import { trackAppUIViewed } from "../../../tti_analytics/native/TTIAnalyticsUtils";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { GenericHeaderTitle, getRenderModalCloseImage } from "../shared_components/HeaderShared";
import { intl, t } from "../../../../intl/index.native";
import getNavigationModalPresentation from "../utils/getNavigationModalPresentation";
import * as _MessageRequestsScreenWithTabs from "./screens/MessageRequestsScreenWithTabs";
import * as _MessageRequestsSpamScreen from "./screens/MessageRequestsSpamScreen";
import * as _MessageRequestsPreviewScreen from "./screens/MessageRequestsPreviewScreen";
const nativeStackNavigator = createNativeStackNavigator();
const useStyles = createStyles({
container: {
flex: 1,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST
},
header: {
borderBottomWidth: 0,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
shadowColor: "transparent"
}
});
export default function MessageRequestsNavigator() {
const styles = useStyles();
const accessibilityNativeStackOptions = useAccessibilityNativeStackOptions();
useLayoutEffect(() => trackAppUIViewed(), []);
const safeAreaInsets_native = useSafeAreaInsets_native();
return <View style={[styles.container, {
paddingLeft: safeAreaInsets_native.left,
paddingRight: safeAreaInsets_native.right
}]}>
<nativeStackNavigator.Navigator screenOptions={(a0) => ({
headerStyle: styles.header,
headerShadowVisible: false,
headerTitle: (a0) => {
const { children, ...rest } = a0;
return <GenericHeaderTitle title={a0.children} {...rest} />;
},
headerTitleAlign: "center",
headerLeft: getRenderModalCloseImage(a0.navigation),
...accessibilityNativeStackOptions
})}>
<nativeStackNavigator.Screen name="root" options={{
title: intl.string(t.e7GWjQ),
...getNavigationModalPresentation()
}} getComponent={() => _MessageRequestsScreenWithTabs.default} />
<nativeStackNavigator.Screen name="spam" options={{
title: intl.string(t.ulKXHp),
...getNavigationModalPresentation()
}} getComponent={() => _MessageRequestsSpamScreen.default} />
<nativeStackNavigator.Screen name="preview" options={{
title: intl.string(t.iilwGH),
...getNavigationModalPresentation()
}} getComponent={() => _MessageRequestsPreviewScreen.default} />
</nativeStackNavigator.Navigator>
</View>;
};
@@ -0,0 +1,23 @@
// Metro module 15721 (f15722).
import { useRef, useEffect } from "react";
import ReadStateStore from "../../../../../stores/ReadStateStore";
import { ME } from "../../../../../Constants";
import { useIsMessageRequestRestrictedViewer } from "../../../../message_request/hooks/useIsMessageRequestRestrictedViewer";
import MessageManager from "../../../../messages/MessageManager";
import { ChannelContainer } from "../../../../../components_native/ChannelContainer";
import RestrictedMessageRequestPreview from "../../../../message_request/native/RestrictedMessageRequestPreview";
import ChatView from "../../../../chat/native/ChatView";
export default function MessageRequestsScreen(props) {
const channelId = props.route.params.channelId;
const ref = useRef(null);
const isMessageRequestRestrictedViewer = useIsMessageRequestRestrictedViewer("MessageRequestsPreviewScreen");
useEffect(() => {
MessageManager.fetchMessages({
channelId,
messageId: ReadStateStore.lastMessageId(channelId)
});
}, [channelId]);
return <ChannelContainer guildId={ME} channelId={channelId}>
{isMessageRequestRestrictedViewer ? <RestrictedMessageRequestPreview channelId={channelId} /> : <ChatView guildId={ME} channelId={channelId} chatInputRef={ref} HACK_fixModalInteraction screenIndex="message-request" />}
</ChannelContainer>;
};
@@ -0,0 +1,62 @@
// Metro module 15701 (f15702).
import { memo, useState, useCallback } from "react";
import { View } from "react-native";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { useSegmentedControlState } from "../../../../../design/components/SegmentedControl/native/SegmentedControlState.native";
import { intl, t } from "../../../../../intl/index.native";
import MessageRequestList from "../../../../message_request/native/MessageRequestList";
import SpamMessageList from "../../../../message_request/native/spam/SpamMessageList";
import { SegmentedControl } from "../../../../../design/components/SegmentedControl/native/SegmentedControl.native";
import { SegmentedControlPages } from "../../../../../design/components/SegmentedControl/native/SegmentedControlPages.native";
import { TTIFirstContentfulPaint } from "../../../../tti_analytics/native/TTIFirstContentfulPaint";
let c11214_8 = {
REQUEST: "REQUEST",
SPAM: "SPAM"
};
const useStyles = createStyles({
container: {
flex: 1,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER
},
messageRequestContent: {
flex: 1
},
tabContainer: {
minHeight: 32,
paddingHorizontal: Module712.space.PX_16
}
});
const r45 = memo(function({ navigation }) {
const styles = useStyles();
const [pageWidth, setState] = useState(0);
const callback2 = useCallback((a0) => navigation.push("preview", {
channelId: a0
}), [navigation]);
const callback = useCallback((a0) => {
setState(a0.nativeEvent.layout.width);
}, []);
const segmentedControlState = useSegmentedControlState({
items: [{
label: intl.string(t["7RFcXZ"]),
id: c11214_8.REQUEST,
page: <MessageRequestList goToMessageRequestPreview={callback2} />
}, {
label: intl.string(t.ulKXHp),
id: c11214_8.SPAM,
page: <SpamMessageList goToMessageRequestPreview={callback2} />
}],
pageWidth,
defaultIndex: 0
});
return <View style={styles.container}>
<View style={styles.tabContainer} onLayout={callback}>
<SegmentedControl state={segmentedControlState} />
</View>
<View style={styles.messageRequestContent}>
<SegmentedControlPages state={segmentedControlState} />
</View>
<TTIFirstContentfulPaint label="message_requests" />
</View>;
});
export default r45;
@@ -0,0 +1,9 @@
// Metro module 15720 (f15721).
import { useCallback } from "react";
import SpamMessageList from "../../../../message_request/native/spam/SpamMessageList";
export default function MessageRequestsScreen(props) {
const navigation = props.navigation;
return <SpamMessageList goToMessageRequestPreview={useCallback((a0) => navigation.push("preview", {
channelId: a0
}), [navigation])} />;
};
@@ -0,0 +1,121 @@
// Metro module 16337 (f16338).
import GuildSettingsStore from "../../../guild_settings/GuildSettingsStore";
import AuthenticationStore from "../../../../stores/AuthenticationStore";
import CreateInviteModalStore from "../../../../stores/CreateInviteModalStore";
import NotificationSettingsModalStore from "../../../../stores/NotificationSettingsModalStore";
import UserRequiredActionStore from "../../../../stores/UserRequiredActionStore";
import { UserRequiredActions, AppContext } from "../../../../Constants";
import { getRootNavigationRef } from "../../RootNavigationRef.native";
import { popModal, isModalOpen } from "../../helpers/NavigationRouteUtils.native";
import getDeprecatedModalData from "../../../../utils/getDeprecatedModalData";
import VerificationUtils from "../../../verification/VerificationUtils";
import { isEligibleForSafetyFlowsExperiment } from "../../../safety_flows/SafetyFlowsExperiment";
import * as _VerificationModal from "../../../verification/native/components/VerificationModal";
import * as _NewTermsModal from "../../../user_required_action/native/NewTermsModal";
import AutomaticLifecycleManager from "../../../../lib/AutomaticLifecycleManager";
import * as _GuildSettingsModal from "../../../guild_settings/native/GuildSettingsModal";
import * as _NotificationSettingsModal_native from "../../../notification_settings/native/NotificationSettingsModal.native";
import * as _InviteSettingsModal from "../../../guild_invite/native/InviteSettingsModal";
let APP, handlePoppedModal, pushFirstOpenModal, createPushModalHandler, c11752_14, c11752_15, c11752_16, c11752_17;
const handlePushedModal = function handlePushedModal(a0) {
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null) {
rootNavigationRef.navigate({
name: "modal",
key: a0.key,
params: {
modal: a0
}
});
}
};
handlePoppedModal = function handlePoppedModal() {
popModal();
};
pushFirstOpenModal = function pushFirstOpenModal(a0, requiredAction) {
for (const item of a0) {
const r9 = item == null;
let r28 = void 0;
if (!r9) {
const isOpen2 = item.isOpen;
r28 = isOpen2 == null ? void 0 : isOpen2.call(item, APP, requiredAction);
}
if (r28 != null && !r28) {
continue;
}
handlePushedModal(getDeprecatedModalData(item.getComponent(), {
key: item.key
}, typeof item.store?.getProps === "function" ? item.store.getProps() : {}));
return void 0;
}
};
createPushModalHandler = function createPushModalHandler(...c22987_0) {
return () => {
pushFirstOpenModal(c22987_0);
};
};
APP = AppContext.APP;
c11752_14 = "EMAIL_VERIFICATION_MODAL_OPEN";
c11752_15 = {
key: "EMAIL_VERIFICATION_MODAL_OPEN",
store: UserRequiredActionStore,
closable: false,
center: true,
isOpen: (a0, a1) => VerificationUtils.isFullScreenVerification(a1 == null ? UserRequiredActionStore.getAction() : a1) && AuthenticationStore.getToken() != null && !isEligibleForSafetyFlowsExperiment({
location: "modal-manager-verification"
}),
getComponent: () => _VerificationModal.default
};
c11752_16 = "USER_REQUIRED_ACTION_UPDATE";
c11752_17 = {
key: "USER_REQUIRED_ACTION_UPDATE",
store: UserRequiredActionStore,
center: true,
isOpen: (a0, a1) => (a1 == null ? UserRequiredActionStore.getAction() : a1) === UserRequiredActions.AGREEMENTS,
getComponent: () => _NewTermsModal.default
};
class DeprecatedModalManager extends AutomaticLifecycleManager {
actions = {
CONNECTION_OPEN_SUPPLEMENTAL: createPushModalHandler(c11752_17, c11752_15),
EMAIL_VERIFICATION_MODAL_OPEN: createPushModalHandler(c11752_15),
USER_REQUIRED_ACTION_UPDATE: (a0) => {
if (a0.requiredAction == null) {
if (isModalOpen(c11752_16)) {
popModal(c11752_16);
}
if (isModalOpen(c11752_14)) {
popModal(c11752_14);
}
} else {
pushFirstOpenModal([c11752_17, c11752_15], a0.requiredAction);
}
},
GUILD_SETTINGS_OPEN: createPushModalHandler({
key: "GUILD_SETTINGS_OPEN",
store: GuildSettingsStore,
closable: false,
getComponent: () => _GuildSettingsModal.default
}),
NOTIFICATION_SETTINGS_MODAL_OPEN: createPushModalHandler({
key: "NOTIFICATION_SETTINGS_MODAL_OPEN",
store: NotificationSettingsModalStore,
closable: false,
getComponent: () => _NotificationSettingsModal_native.default
}),
CREATE_INVITE_MODAL_OPEN: createPushModalHandler({
key: "CREATE_INVITE_MODAL_OPEN",
store: CreateInviteModalStore,
closable: false,
getComponent: () => _InviteSettingsModal.default
}),
GUILD_SETTINGS_CLOSE: handlePoppedModal,
NOTIFICATION_SETTINGS_MODAL_CLOSE: handlePoppedModal,
PREMIUM_PAYMENT_MODAL_CLOSE: handlePoppedModal,
EMAIL_VERIFICATION_MODAL_CLOSE: handlePoppedModal,
CREATE_INVITE_MODAL_CLOSE: handlePoppedModal,
QUICKSWITCHER_HIDE: handlePoppedModal,
IFE_EXPERIMENT_SEARCH_MODAL_CLOSE: handlePoppedModal
};
}
const deprecatedModalManager = new DeprecatedModalManager();
export default deprecatedModalManager;
@@ -0,0 +1,25 @@
// Metro module 4398 (f4399).
class ModalDispatchQueue {
constructor() {
return {
__proto__: new.target.prototype,
queue: []
};
}
enqueue(a0) {
this.queue.push(a0);
}
flush() {
while (this.queue.length > 0) {
const r8 = this.queue.shift();
if (r8 != null) {
r8();
}
}
}
}
const r17 = {
__proto__: ModalDispatchQueue.prototype,
queue: []
};
export default r17;
@@ -0,0 +1,57 @@
// Metro module 15698 (f15699).
import { useCallback, useRef, useEffect, useLayoutEffect } from "react";
import { StyleSheet, View } from "react-native";
import { NOOP } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import ModalActionCreators from "../../../../actions/ModalActionCreators";
import useTrackImpression from "../../../app_analytics/useTrackImpression";
import { ImpressionTypes } from "../../../../_bundle/Module503";
import { trackAppUIViewed } from "../../../tti_analytics/native/TTIAnalyticsUtils";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { shouldExcludeSafeAreaForModalKey } from "../../../safe_area/shouldExcludeSafeAreaForModalKey.native";
import { isIOS } from "../../../../utils/PlatformUtils";
import { PortalKeyboardRenderer } from "../../../keyboard/native/PortalKeyboardRenderer";
const _excluded = ["impressionName", "impressionProperties"];
const useStyles = createStyles({
containerWithPadding: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST
}
});
export default function Modal(props) {
let ref;
const Modal2 = props.route.params.Modal2;
ref = void 0;
const styles = useStyles();
let props2 = Modal2.props;
if (props2 == null) {
props2 = {};
}
const { impressionName, impressionProperties, ...rest } = props2;
const callback = useCallback(() => {
ModalActionCreators.pop();
}, []);
useTrackImpression({
type: ImpressionTypes.MODAL,
name: impressionName,
properties: impressionProperties
});
ref = useRef(Modal2.callbacks?.onExited);
useEffect(() => {
ref.current = Modal2.callbacks?.onExited;
});
useEffect(() => () => {
const current = ref.current;
return current == null ? void 0 : current.call(ref);
}, []);
useLayoutEffect(() => trackAppUIViewed("ModalScreen"), []);
const safeAreaInsets_native = useSafeAreaInsets_native();
const { left, right } = safeAreaInsets_native;
return <View style={[StyleSheet.absoluteFillObject, shouldExcludeSafeAreaForModalKey(Modal2.key) ? void 0 : [styles.containerWithPadding, {
paddingLeft: left,
paddingRight: right
}]]} onAccessibilityEscape={Modal2.closable ? ModalActionCreators.pop : NOOP}>
<Modal2.Modal2 {...rest} style={void 0} transitionState={null} onClose={callback} />
{isIOS() && <PortalKeyboardRenderer portal={false} />}
</View>;
};
@@ -0,0 +1,10 @@
// Metro module 10926 (f10927).
import { coerceGuildsRoute } from "../helpers/NavigationRouteUtils.native";
import getNavigatorCurrentRoute from "../navigator/getNavigatorCurrentRoute";
import { transitionToChannel } from "../../routing/transitionToChannel";
export default function navigateToLastChannel() {
const r14 = coerceGuildsRoute(getNavigatorCurrentRoute());
if (r14 != null && r14.params?.channelId != null) {
transitionToChannel(r14.params?.channelId);
}
};
@@ -0,0 +1,72 @@
// Metro module 14923 (f14924).
import { View } from "react-native";
import * as _MainTabsV2Constants from "../shared_components/MainTabsV2Constants";
import { ThemeTypes } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useTheme from "../../../../hooks/useTheme";
import { useMobileVisualRefreshConfig } from "../../../themes/experiments/MobileVisualRefreshExperiment";
import ReanimatedRexport, { useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import * as _native from "../../../../design/void/native";
import * as _PanelsConfig from "../../../panels/native/PanelsConfig";
import { useGradientTop } from "../../../client_themes/native/ClientThemesOverrides";
import { SafeAreaPaddingView } from "../../../../components_native/common/SafeAreaView";
const { HEADER_CORNER_RADIUS, MIDNIGHT_BORDER_WIDTH } = _MainTabsV2Constants;
const useStyles = createStyles({
container: {
position: "absolute",
zIndex: 1,
top: 0,
width: "100%",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
midnightContainer: {
borderLeftColor: Module712.colors.APP_FRAME_BORDER,
borderLeftWidth: MIDNIGHT_BORDER_WIDTH
},
splitDivider: {
borderLeftColor: Module712.colors.APP_FRAME_BORDER,
borderLeftWidth: Module712.modules.mobile.CHANNEL_DRAWER_DIVIDER_WIDTH
},
additionalHeight: {
height: HEADER_CORNER_RADIUS
}
});
const __initData = {
code: "function ChannelScreenAnimatedFrameTsx1(){const{translateX,maxWidth,isChatLockedOpen,withTiming,STANDARD_EASING,SIDE_PANEL_CLOSE_DURATION_MS,SIDE_PANEL_OPEN_DURATION_MS}=this.__closure;const hide=translateX.get()===maxWidth||isChatLockedOpen;return{opacity:withTiming(hide?0:1,{easing:STANDARD_EASING,duration:hide?SIDE_PANEL_CLOSE_DURATION_MS:SIDE_PANEL_OPEN_DURATION_MS})};}"
};
export default function ChannelScreenAnimatedFrame(props) {
const { translateX, maxWidth, isChatLockedOpen } = props;
const styles = useStyles();
const theme = useTheme();
const MIDNIGHT = ThemeTypes.MIDNIGHT;
const chatInputFloating = useMobileVisualRefreshConfig({
location: "ChannelScreenAnimatedFrame"
}).chatInputFloating;
const E = function E() {
const r7 = translateX.get() === maxWidth || isChatLockedOpen;
return {
opacity: _timing.withTiming(r7 ? 0 : 1, {
easing: _native.STANDARD_EASING,
duration: r7 ? _PanelsConfig.SIDE_PANEL_CLOSE_DURATION_MS : _PanelsConfig.SIDE_PANEL_OPEN_DURATION_MS
})
};
};
E.__closure = {
translateX,
maxWidth,
isChatLockedOpen,
withTiming: _timing.withTiming,
STANDARD_EASING: _native.STANDARD_EASING,
SIDE_PANEL_CLOSE_DURATION_MS: _PanelsConfig.SIDE_PANEL_CLOSE_DURATION_MS,
SIDE_PANEL_OPEN_DURATION_MS: _PanelsConfig.SIDE_PANEL_OPEN_DURATION_MS
};
E.__workletHash = 9063010717249;
E.__initData = __initData;
const animatedStyle = useAnimatedStyle(E);
return <ReanimatedRexport.View pointerEvents="none" style={[styles.container, styles.splitDivider, theme === MIDNIGHT ? chatInputFloating ? void 0 : styles.midnightContainer : void 0, useGradientTop(), animatedStyle]}>
<SafeAreaPaddingView top />
<View style={styles.additionalHeight} />
</ReanimatedRexport.View>;
};
@@ -0,0 +1,461 @@
// Metro module 15399 (f15400).
import { memo, useEffect, useRef, useCallback, useContext, useState, useMemo } from "react";
import { NativeModules, StyleSheet, View } from "react-native";
import { MIDNIGHT_BORDER_WIDTH } from "../shared_components/MainTabsV2Constants";
import { AnalyticsObjectTypes, AnalyticsObjects, AnalyticsSections } from "../../../../Constants";
import { ThemeTypes } from "../../../../_bundle/Module505";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import HideCoveredChannelsExperiment from "../HideCoveredChannelsExperiment";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import { useAnimatedReaction, useDerivedValue, useSharedValue } from "../../../reanimated/ReanimatedRexport";
import { useUnmountEffect } from "../../../../hooks/useMountEffect";
import useTheme from "../../../../hooks/useTheme";
import { useMobileVisualRefreshConfig } from "../../../themes/experiments/MobileVisualRefreshExperiment";
import { useOrientation, OrientationType } from "../../../device/native/DeviceOrientation";
import { useMainTabsChannelScreenStyles } from "./useMainTabsChannelScreenStyles";
import { TransitionStates, TransitionGroup } from "../../../../design/components/TransitionGroup/TransitionGroup";
import REAWorkaroundView from "../../../reanimated/native/REAWorkaroundView";
import { Freeze } from "../../../../_bundle/Suspender";
import StandaloneChannelScreen from "../channel/StandaloneChannelScreen";
import { useNavigation } from "../../../../_bundle/Module1481";
import useMainTabsPanelsGesture from "./useMainTabsPanelsGesture";
import { dismissKeyboard } from "../../../../utils/native/ChatInputUtils";
import MainTabsNavigatorPanelContext, { MainTabsChannelScreenStackContext } from "./MainTabsNavigatorPanelContext";
import { GestureDetector } from "../../../../_bundle/Module5273";
import useColorThemeBackground from "../../../client_themes/native/useColorThemeBackground";
import { ChannelScreenType } from "./useChannelScreensFromNavigation";
import { getChatLayout } from "../../../chat/native/useChatLayout";
import Dispatcher from "../../../../Dispatcher";
import { freezeScreenIndex } from "../../../channel/native/ScreenIndexFrozen";
import { ThemeContextProvider } from "../../../../_bundle/Module3901";
function $mk96369($env) {
return () => $env[2].get() > 0;
}
function $mk96370($env) {
return function l(a0, a1) {
if (a0 !== a1) {
const r4 = $env;
const r3 = r4[1];
const r7 = r3.get();
const r8 = r4[0];
if (a0) {
if (r7 >= r8) {
r3.set(r8 - 1);
}
} else if (r7 < r8) {
r3.set(r8);
}
}
};
}
function $mk96371($env) {
return () => {
const r4 = $env;
const r3 = r4[1];
const r5 = r3.get();
const r6 = r4[0];
if (r5 >= r6) {
r3.set(r6 - 1);
}
};
}
function $mk96372($env) {
return function() {
const r2 = $env;
return r2[3] && r2[1].get() > r2[0];
};
}
let useStyles, __initData, __initData2, __initData3, FirstChannelScreen, __initData4, __initData5, ChannelScreen, __initData6, __initData7;
const getKey = function getKey(a0) {
return String(a0.Index);
};
useStyles = createStyles({
midnightContainerStyles: {
marginTop: -MIDNIGHT_BORDER_WIDTH,
marginLeft: -MIDNIGHT_BORDER_WIDTH
}
});
__initData = {
code: "function MainTabsChannelScreenStackTsx1(){const{translateX}=this.__closure;return translateX.get()>0;}"
};
__initData2 = {
code: "function MainTabsChannelScreenStackTsx2(isVisibleBeneath,wasVisibleBeneath){const{highestFullyRenderedScreenIndex,Index}=this.__closure;if(isVisibleBeneath===wasVisibleBeneath)return;if(isVisibleBeneath){if(highestFullyRenderedScreenIndex.get()>=Index){highestFullyRenderedScreenIndex.set(Index-1);}return;}if(highestFullyRenderedScreenIndex.get()<Index){highestFullyRenderedScreenIndex.set(Index);}}"
};
__initData3 = {
code: "function MainTabsChannelScreenStackTsx3(){const{enabled,highestFullyRenderedScreenIndex,Index}=this.__closure;return enabled&&highestFullyRenderedScreenIndex.get()>Index;}"
};
FirstChannelScreen = memo(function FirstChannelScreen(props) {
let r93;
let env21960;
const { guildId, channelId, showCreateThread, frame, Index: index2, freeze, isDragging: isDragging2, translateX: translateX3, containerWidth, isActive, maxWidth: maxWidth2, focusChatPressableComponent: focusChatPressableComponent2, transitionState, cleanup, parentFreezeValue, highestFullyRenderedScreenIndex: highestFullyRenderedScreenIndex2 } = props;
const theme = useTheme();
const styles = useStyles();
const chatInputFloating = useMobileVisualRefreshConfig({
location: "MainTabsChannelScreenStack"
}).chatInputFloating;
const orientation = useOrientation();
const r51 = env21960 = {};
env21960[0] = index2;
env21960[1] = highestFullyRenderedScreenIndex2;
env21960[2] = translateX3;
env21960[3] = void 0;
const enabled = HideCoveredChannelsExperiment.useConfig({
location: "MainTabsChannelScreenStack"
}).enabled;
env21960[3] = enabled;
const r58 = $mk96369(r51);
r58.__closure = {
translateX: translateX3
};
r58.__workletHash = 10608377273080;
r58.__initData = __initData;
const r61 = $mk96370(r51);
r61.__closure = {
highestFullyRenderedScreenIndex: highestFullyRenderedScreenIndex2,
Index: index2
};
r61.__workletHash = 10137919010401;
r61.__initData = __initData2;
useAnimatedReaction(r58, r61);
useUnmountEffect($mk96371(r51));
const r73 = $mk96372(r51);
r73.__closure = {
enabled,
highestFullyRenderedScreenIndex: highestFullyRenderedScreenIndex2,
Index: index2
};
r73.__workletHash = 1648562234730;
r73.__initData = __initData3;
const styles2 = useMainTabsChannelScreenStyles(isDragging2, translateX3, maxWidth2, useDerivedValue(r73), parentFreezeValue);
useEffect(() => {
if (transitionState === TransitionStates.YEETED) {
cleanup();
}
}, [cleanup, transitionState]);
const style = [styles2, , ,];
const r89 = containerWidth != null ? {
width: containerWidth
} : null;
L7: {
style[1] = r89;
const MIDNIGHT = ThemeTypes.MIDNIGHT;
r93 = void 0;
if (theme === MIDNIGHT) {
if (chatInputFloating) {
const PORTRAIT = OrientationType.PORTRAIT;
r93 = void 0;
if (orientation !== PORTRAIT) {
break L7;
}
const r98 = frame != null;
r93 = void 0;
if (r98) {
break L7;
}
}
r93 = styles.midnightContainerStyles;
}
}
style[2] = r93;
return <REAWorkaroundView style={style}>
<Freeze freeze={freeze}>
<View collapsable={false} style={StyleSheet.absoluteFill} pointerEvents={isActive ? "auto" : "box-only"} accessibilityElementsHidden={isActive ? void 0 : !isActive} importantForAccessibility={isActive ? void 0 : "no-hide-descendants"}>
<StandaloneChannelScreen guildId={guildId} channelId={channelId} showCreateThread={showCreateThread} isNavigationScreen={containerWidth == null} frame={frame} screenIndex={index2} />
</View>
</Freeze>
{focusChatPressableComponent2}
</REAWorkaroundView>;
});
__initData4 = {
code: "function MainTabsChannelScreenStackTsx4(){const{translateX}=this.__closure;return translateX.get()===0;}"
};
__initData5 = {
code: "function MainTabsChannelScreenStackTsx5(isFullyOpen,prev){const{Index,mainTabsDisallowGesture}=this.__closure;if(isFullyOpen===prev)return;if(Index!==1)return;mainTabsDisallowGesture.set(isFullyOpen);}"
};
ChannelScreen = memo(function ChannelScreen(props) {
let r138, r144, Provider, channelId, freeze, guildId, isActive, props2, showCreateThread, style;
let transitionState2, cleanup2, Index, navigation, ref, translateX, disallowGesture, current, ref2;
let env21962;
L4: {
guildId = props.guildId;
channelId = props.channelId;
showCreateThread = props.showCreateThread;
transitionState2 = props.transitionState;
cleanup2 = props.cleanup;
isActive = props.isActive;
freeze = props.freeze;
const parentFreezeValue = props.parentFreezeValue;
Index = props.Index;
const highestFullyRenderedScreenIndex2 = props.highestFullyRenderedScreenIndex;
navigation = void 0;
ref = void 0;
translateX = void 0;
disallowGesture = void 0;
current = void 0;
ref2 = void 0;
const theme = useTheme();
const styles = useStyles();
const chatInputFloating = useMobileVisualRefreshConfig({
location: "MainTabsChannelScreenStack"
}).chatInputFloating;
const orientation = useOrientation();
navigation = useNavigation();
ref = useRef(false);
const mainTabsPanelsGesture = useMainTabsPanelsGesture({
canDrag: transitionState2 !== TransitionStates.YEETED,
onVisibilityChange: useCallback((a0) => {
if (!a0) {
if (ref.current) {
cleanup2();
} else {
ref.current = true;
navigation.goBack();
}
}
}, [cleanup2, navigation]),
onDragStart: dismissKeyboard,
startShown: false
});
const { gesture, panelGestureContext, isDragging: isDragging2 } = mainTabsPanelsGesture;
translateX = mainTabsPanelsGesture.translateX;
const { movePanel, maxWidth: maxWidth2 } = mainTabsPanelsGesture;
const r74 = env21962 = {};
env21962[0] = Index;
env21962[1] = highestFullyRenderedScreenIndex2;
env21962[2] = translateX;
env21962[3] = void 0;
const enabled = HideCoveredChannelsExperiment.useConfig({
location: "MainTabsChannelScreenStack"
}).enabled;
env21962[3] = enabled;
const r79 = $mk96369(r74);
r79.__closure = {
translateX
};
r79.__workletHash = 10608377273080;
r79.__initData = __initData;
const r82 = $mk96370(r74);
r82.__closure = {
highestFullyRenderedScreenIndex: highestFullyRenderedScreenIndex2,
Index
};
r82.__workletHash = 10137919010401;
r82.__initData = __initData2;
useAnimatedReaction(r79, r82);
useUnmountEffect($mk96371(r74));
const r94 = $mk96372(r74);
r94.__closure = {
enabled,
highestFullyRenderedScreenIndex: highestFullyRenderedScreenIndex2,
Index
};
r94.__workletHash = 1648562234730;
r94.__initData = __initData3;
const derivedValue = useDerivedValue(r94);
disallowGesture = useContext(MainTabsNavigatorPanelContext).disallowGesture;
const I = () => translateX.get() === 0;
I.__closure = {
translateX
};
I.__workletHash = 1803281708382;
I.__initData = __initData4;
const y = function y(a0, a1) {
if (a0 !== a1 && Index === 1) {
disallowGesture.set(a0);
}
};
y.__closure = {
Index,
mainTabsDisallowGesture: disallowGesture
};
y.__workletHash = 4369586160197;
y.__initData = __initData5;
useAnimatedReaction(I, y);
current = {
cleanup: cleanup2,
movePanel
};
ref2 = useRef(current);
useEffect(() => {
ref2.current = current;
});
useEffect(() => {
L6: {
const current2 = ref2.current;
const { cleanup: cleanup3, movePanel } = current2;
if (transitionState2 !== TransitionStates.MOUNTED && transitionState2 !== TransitionStates.ENTERED) {
if (ref.current) {
cleanup3();
break L6;
}
ref.current = true;
movePanel(false, false, 0, true);
} else {
movePanel(true, false, 0, false);
}
}
}, [transitionState2]);
const styles2 = useMainTabsChannelScreenStyles(isDragging2, translateX, maxWidth2, derivedValue, parentFreezeValue);
props2 = {
gesture,
children: null
};
Provider = MainTabsChannelScreenStackContext.Provider;
r138 = {
value: panelGestureContext,
children: null
};
style = [styles2, ,];
const MIDNIGHT = ThemeTypes.MIDNIGHT;
r144 = void 0;
if (theme === MIDNIGHT) {
if (chatInputFloating) {
const PORTRAIT = OrientationType.PORTRAIT;
r144 = void 0;
if (orientation !== PORTRAIT) {
break L4;
}
}
r144 = styles.midnightContainerStyles;
}
}
style[1] = r144;
r138.children = <REAWorkaroundView style={style} accessibilityElementsHidden={isActive ? void 0 : !isActive} importantForAccessibility={isActive ? void 0 : "no-hide-descendants"}>
<Freeze freeze={freeze}>
<StandaloneChannelScreen guildId={guildId} channelId={channelId} showCreateThread={showCreateThread} isNavigationScreen frame={null} screenIndex={Index} />
</Freeze>
</REAWorkaroundView>;
props2.children = <Provider {...r138} />;
return <GestureDetector {...props2} />;
});
__initData6 = {
code: "function MainTabsChannelScreenStackTsx6(){const{translateX,maxWidth}=this.__closure;return translateX.get()===maxWidth;}"
};
__initData7 = {
code: "function MainTabsChannelScreenStackTsx7(value,prev){const{runOnJS,setIsHidden}=this.__closure;if(value===prev)return;runOnJS(setIsHidden)(value);}"
};
const r61 = memo(function MainTabsChannelScreenStack(props) {
let c21963_10, sharedValue, ref3, ref4;
const { screens, screenStackActive, translateX: translateX2, isDragging, maxWidth, highestFullyRenderedScreenIndex } = props;
let shouldFreeze = props.shouldFreeze;
const { focusChatPressableComponent, firstScreenWidth, firstScreenFrame } = props;
c21963_10 = void 0;
sharedValue = void 0;
ref3 = void 0;
ref4 = void 0;
const colorThemeBackground = useColorThemeBackground();
const [state, setState] = useState(translateX2.get() === maxWidth);
const D = () => translateX2.get() === maxWidth;
D.__closure = {
translateX: translateX2,
maxWidth
};
D.__workletHash = 9963940499904;
D.__initData = __initData6;
const E = function E(a0, a1) {
if (a0 !== a1) {
_ReanimatedRexport.runOnJS(setState)(a0);
}
};
E.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
setIsHidden: setState
};
E.__workletHash = 10167608718442;
E.__initData = __initData7;
useAnimatedReaction(D, E);
useEffect(() => {
const MediaPlayerManager = NativeModules.MediaPlayerManager;
if (MediaPlayerManager != null) {
const pauseAllMediaPlayers = MediaPlayerManager.pauseAllMediaPlayers;
if (pauseAllMediaPlayers != null) {
pauseAllMediaPlayers.call(MediaPlayerManager);
}
}
}, [useMemo(() => {
const r9 = screens.at(-1);
return r9?.type === ChannelScreenType.DEFAULT ? r9.channelId : null;
}, [screens])]);
const r55 = screens[0];
c21963_10 = r55;
if (shouldFreeze) {
shouldFreeze = state;
}
if (shouldFreeze) {
shouldFreeze = r55 == null || r55.type !== ChannelScreenType.DEFAULT;
}
sharedValue = useSharedValue(0);
useEffect(() => {
let c28018_0 = setTimeout(() => {
sharedValue.set(sharedValue.get() + 1);
}, 10);
return () => clearTimeout(c28018_0);
}, [shouldFreeze, sharedValue]);
const callback = useCallback((a0, a1, a2, a3) => {
let r29;
const index2 = Number(a0);
if (index2 === 0) {
let showCreateThread2 = a1.showCreateThread;
if (showCreateThread2 == null) {
showCreateThread2 = false;
}
let isActive = screenStackActive;
if (screenStackActive) {
isActive = index2 === screens.length - 1;
}
r29 = <FirstChannelScreen key={a0} guildId={a1.guildId} channelId={a1.channelId} showCreateThread={showCreateThread2} focusChatPressableComponent={focusChatPressableComponent} Index={index2} transitionState={a2} cleanup={a3} isDragging={isDragging} translateX={translateX2} isActive={isActive} freeze={index2 < screens.length - 2} containerWidth={firstScreenWidth} frame={firstScreenFrame} parentFreezeValue={sharedValue} maxWidth={maxWidth} highestFullyRenderedScreenIndex={highestFullyRenderedScreenIndex} />;
} else {
let showCreateThread = a1.showCreateThread;
if (showCreateThread == null) {
showCreateThread = false;
}
r29 = <ChannelScreen key={a0} guildId={a1.guildId} channelId={a1.channelId} showCreateThread={showCreateThread} Index={index2} transitionState={a2} parentFreezeValue={sharedValue} cleanup={a3} isActive={index2 === screens.length - 1} freeze={index2 < screens.length - 2} highestFullyRenderedScreenIndex={highestFullyRenderedScreenIndex} />;
}
return r29;
}, [screens.length, focusChatPressableComponent, isDragging, translateX2, firstScreenWidth, firstScreenFrame, maxWidth, sharedValue, screenStackActive, highestFullyRenderedScreenIndex]);
let r79 = r55?.channelId;
if (r79 == null) {
r79 = null;
}
ref3 = useRef(r79);
ref4 = useRef(null);
const r86 = [r55?.type, ,];
const channelId = r55?.channelId;
const r89 = () => {
if (c21963_10?.type != null && ref4.current !== c21963_10.type) {
ref4.current = c21963_10.type;
if (c21963_10.channelId === ref3.current) {
if (!(c21963_10.type !== ChannelScreenType.DEFAULT || getChatLayout().isChatLockedOpen)) {
Dispatcher.dispatch({
type: "TRY_ACK",
location: {
section: AnalyticsSections.CHANNEL,
object: AnalyticsObjects.ACK_CHANNEL_SELECT_SAME_CHANNEL_DISPATCH,
objectType: AnalyticsObjectTypes.ACK_AUTOMATIC
},
channelId: c21963_10.channelId
});
}
} else {
ref3.current = c21963_10.channelId;
}
}
};
r86[1] = channelId;
useEffect(r89, r86);
freezeScreenIndex(shouldFreeze, 0);
return shouldFreeze ? r55?.showCreateThread ? null : <Freeze freeze={shouldFreeze}>
<View collapsable={false} style={StyleSheet.absoluteFill} pointerEvents="box-none" accessibilityElementsHidden={screenStackActive ? void 0 : !screenStackActive} importantForAccessibility={screenStackActive ? void 0 : "no-hide-descendants"}>
<ThemeContextProvider gradient={colorThemeBackground}>
<TransitionGroup items={screens} renderItem={callback} getItemKey={getKey} />
</ThemeContextProvider>
</View>
</Freeze> : <Freeze freeze={shouldFreeze}>
<View collapsable={false} style={StyleSheet.absoluteFill} pointerEvents="box-none" accessibilityElementsHidden={screenStackActive ? void 0 : !screenStackActive} importantForAccessibility={screenStackActive ? void 0 : "no-hide-descendants"}>
<ThemeContextProvider gradient={colorThemeBackground}>
<TransitionGroup items={screens} renderItem={callback} getItemKey={getKey} />
</ThemeContextProvider>
</View>
</Freeze>;
});
export default r61;
@@ -0,0 +1,34 @@
// Metro module 15397 (f15398).
import { StyleSheet } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
const useStyles = createStyles({
scrim: {
...StyleSheet.absoluteFillObject,
zIndex: 5,
backgroundColor: Module712.colors.BACKGROUND_SCRIM
}
});
const __initData = {
code: "function MainTabsContentScrimTsx1(){const{interpolate,translateX,maxWidth,Extrapolation}=this.__closure;return{opacity:interpolate(translateX.get(),[maxWidth,0],[0,0.5],Extrapolation.CLAMP)};}"
};
export function MainTabsContentScrim(props) {
const { translateX, maxWidth } = props;
const styles = useStyles();
const c = function c() {
return {
opacity: _ReanimatedRexport.interpolate(translateX.get(), [maxWidth, 0], [0, 0.5], _ReanimatedRexport.Extrapolation.CLAMP)
};
};
c.__closure = {
interpolate: _ReanimatedRexport.interpolate,
translateX,
maxWidth,
Extrapolation: _ReanimatedRexport.Extrapolation
};
c.__workletHash = 7933670426250;
c.__initData = __initData;
return <ReanimatedRexport.View style={[styles.scrim, useAnimatedStyle(c)]} pointerEvents="none" />;
}
@@ -0,0 +1,257 @@
// Metro module 14917 (f14918).
import * as Module19 from "react";
import { useRef, useLayoutEffect, useState, useEffect, useCallback, useMemo } from "react";
import { Pressable, StyleSheet, View } from "react-native";
import { ComponentActions, ME } from "../../../../Constants";
import Logger from "../../../debug/Logger";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useNavigation } from "../../../../_bundle/Module1481";
import useChatLayout from "../../../chat/native/useChatLayout";
import { useDrawerWidth } from "../../../screen/native/drawer/useDrawerWidth";
import useChatWidth from "../../../chat/native/useChatWidth";
import { convertPortraitToLandscapeScreens, convertLandscapeToPortraitScreens } from "./PanelsNavigationUtils";
import { dismissKeyboard } from "../../../../utils/native/ChatInputUtils";
import useChannelScreensFromNavigation, { ChannelScreenType, isActiveTabsGuilds } from "./useChannelScreensFromNavigation";
import { getRootNavigationRef } from "../../RootNavigationRef.native";
import { transitionToChannel } from "../../../routing/transitionToChannel";
import { ComponentDispatch } from "../../../../utils/ComponentDispatchUtils";
import useMainTabsPanelsGesture from "./useMainTabsPanelsGesture";
import ChannelActionCreators from "../../../../actions/ChannelActionCreators";
import ChannelScreenAnimatedFrame from "./ChannelScreenAnimatedFrame";
import ReanimatedRexport, { useSharedValue, useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import useDesignToggle from "../../../devtools/design_toggles/useDesignToggle";
import { useIsCustomThemeActive } from "../../../client_themes/native/useActiveTheme";
import MainTabsNavigatorPanelContext from "./MainTabsNavigatorPanelContext";
import { GestureDetector } from "../../../../_bundle/Module5273";
import { SidebarCoachmarkOverlay } from "./SidebarCoachmarkOverlay.native";
import YouBarStackNavigator from "../you_bar/YouBarStackNavigator";
import { MainTabsContentScrim } from "./MainTabsContentScrim";
import ThemedHeaderBackgroundGradient from "./ThemedHeaderBackgroundGradient";
import MainTabsChannelScreenStack from "./MainTabsChannelScreenStack";
let c10548_12 = new Logger("MainTabsNavigatorPanel");
const useStyles = createStyles({
container: {
flex: 1
},
containerBackground: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST
},
tabsContainer: {
flex: 1
}
});
const __initData = {
code: "function MainTabsNavigatorPanelTsx1(){const{translateX,highestFullyRenderedScreenIndex}=this.__closure;return{opacity:translateX.get()>0&&highestFullyRenderedScreenIndex.get()<1?1:0};}"
};
const r54 = Module19.memo(function MainTabsNavigatorPanel() {
let c21452_5, state, current, ref3, callback, isChatBesideChannelList, ref4, c21452_16, translateX, movePanel, maxWidth, isDraggingRef, current2, ref5, callback2, sharedValue;
const styles = useStyles();
const navigation = useNavigation();
const chatLayout = useChatLayout();
const { isChatBesideChannelList: isChatBesideChannelList2, isChatLockedOpen } = chatLayout;
const drawerWidth = useDrawerWidth();
const chatWidth = useChatWidth();
const ref = useRef(isChatLockedOpen);
const ref2 = useRef(false);
useLayoutEffect(() => {
if (ref.current !== isChatLockedOpen) {
ref.current = isChatLockedOpen;
if (isChatLockedOpen) {
convertPortraitToLandscapeScreens();
} else {
dismissKeyboard();
convertLandscapeToPortraitScreens();
}
ref2.current = true;
}
}, [isChatLockedOpen]);
const channelScreensFromNavigation = useChannelScreensFromNavigation(navigation);
c21452_5 = channelScreensFromNavigation;
let [screenStackActive, setState] = useState(() => c21452_5[0]?.type === ChannelScreenType.DEFAULT);
state = screenStackActive;
current = channelScreensFromNavigation[0];
ref3 = useRef(current);
useEffect(() => {
ref3.current = current;
}, [current]);
callback = useCallback(() => {
let r24;
setState(false);
const state3 = navigation.getState();
let index = state3.index;
const name = state3.routes[index]?.name;
let r0 = 0;
let r4 = 0;
if (name === "channel") {
do {
const r1 = index - 1;
const r14 = state3.routes[r1];
const r23 = r14 == null;
const r3 = r0;
r24 = r23 ? void 0 : r14.name;
r0 = r3 + 1;
index = r1;
r4 = r0;
} while (r24 === "channel");
}
if (0 < r4) {
navigation.pop(r4);
}
}, [navigation]);
const [state2, setState2] = useState(() => isActiveTabsGuilds(navigation.getState()));
let [state3, setState3] = useState(() => state2);
useEffect(() => {
const handleStateChange2 = function handleStateChange(a0) {
setState2(isActiveTabsGuilds(a0.data.state));
};
navigation.addListener("state", handleStateChange2);
return () => {
navigation.removeListener("state", handleStateChange2);
};
}, [navigation]);
useEffect(() => {
setState3(state2);
}, [state2]);
if (state3) {
state3 = isChatBesideChannelList2;
}
isChatBesideChannelList = state3;
ref4 = useRef(false);
const callback3 = useCallback((a0) => {
setState(a0);
ref4.current = false;
if (a0) {
if (ref3.current != null && navigation.getState().routes[navigation.getState().index].name !== "channel") {
const rootNavigationRef = getRootNavigationRef();
const r2 = rootNavigationRef == null;
let r32 = void 0;
if (!r2) {
const state3 = rootNavigationRef.getState();
r32 = state3 == null ? void 0 : state3.routes[rootNavigationRef == null ? void 0 : rootNavigationRef.getState()?.index]?.name;
}
if (r32 !== "modal") {
ref4.current = true;
transitionToChannel(ref3.current.channelId);
}
}
} else {
callback();
}
}, [navigation, callback]);
const callback4 = useCallback(() => {
ComponentDispatch.dispatch(ComponentActions.BOTTOM_CHANNEL_SCREEN_DRAG_START);
dismissKeyboard();
}, []);
const r100 = current != null && current.type !== ChannelScreenType.FALLBACK_RENDERED;
c21452_16 = r100;
const r108 = isChatBesideChannelList ? isChatLockedOpen : isChatBesideChannelList;
const mainTabsPanelsGesture = useMainTabsPanelsGesture({
canDrag: r108 ? !r108 : r100,
onVisibilityChange: callback3,
onDragStart: callback4,
startShown: channelScreensFromNavigation[0]?.type === ChannelScreenType.DEFAULT,
openWidth: isChatBesideChannelList ? drawerWidth : void 0
});
const { gesture, panelGestureContext, isDragging } = mainTabsPanelsGesture;
translateX = mainTabsPanelsGesture.translateX;
movePanel = mainTabsPanelsGesture.movePanel;
maxWidth = mainTabsPanelsGesture.maxWidth;
isDraggingRef = mainTabsPanelsGesture.isDraggingRef;
useEffect(() => {
c10548_12.log("Chat Layout Changed", {
isNavigatorPanelsBesideChannelList: isChatBesideChannelList,
drawerWidth
});
}, [isChatBesideChannelList, drawerWidth]);
current2 = {
handleExit: callback,
maxWidth,
movePanel,
screens: channelScreensFromNavigation,
firstScreen: current
};
ref5 = useRef(current2);
useEffect(() => {
ref5.current = current2;
});
useEffect(() => {
if (!isDraggingRef.current) {
const current3 = ref5.current;
const { handleExit, maxWidth: maxWidth2, movePanel: movePanel2, screens } = current3;
const r29 = current?.type === ChannelScreenType.DEFAULT;
if (screens.length >= 2) {
translateX.set(r29 ? 0 : maxWidth2);
setState(r29);
return void 0;
}
if (r29) {
if (ref4.current) {
ref4.current = false;
if (translateX.get() === maxWidth2) {
handleExit();
}
return void 0;
}
movePanel2(true, false, 0, true);
} else if (movePanel2(false, false, 0, false)) {
dismissKeyboard();
}
}
}, [current?.type, translateX, isDraggingRef]);
useEffect(() => {
const firstScreen = ref5.current.firstScreen;
if (firstScreen?.type === ChannelScreenType.BACKGROUND_SAVED) {
let guildId = firstScreen.guildId;
if (guildId == null) {
guildId = ME;
}
ChannelActionCreators.preload(guildId, firstScreen.channelId);
}
}, [current?.channelId]);
callback2 = useCallback(() => {
if (c21452_16) {
movePanel(true, false, 0, false);
}
}, [movePanel, r100]);
const memo = useMemo(() => isChatBesideChannelList ? isChatLockedOpen ? null : state ? null : <Pressable style={StyleSheet.absoluteFill} onPress={callback2} /> : null, [callback2, state, isChatLockedOpen, isChatBesideChannelList]);
const r152 = isChatBesideChannelList && isChatLockedOpen ? channelScreensFromNavigation.length <= 1 : !state;
const memo2 = useMemo(() => isChatBesideChannelList ? <ChannelScreenAnimatedFrame translateX={translateX} maxWidth={maxWidth} isChatLockedOpen={isChatLockedOpen} /> : null, [isChatLockedOpen, isChatBesideChannelList, maxWidth, translateX]);
sharedValue = useSharedValue(translateX.get() > 0 ? -1 : 0);
const re = function re() {
return {
opacity: translateX.get() > 0 ? sharedValue.get() < 1 ? 1 : 0 : 0
};
};
re.__closure = {
translateX,
highestFullyRenderedScreenIndex: sharedValue
};
re.__workletHash = 10839500061449;
re.__initData = __initData;
const animatedStyle = useAnimatedStyle(re);
const designToggle = useDesignToggle("channel_list_scrim");
const isCustomThemeActive = useIsCustomThemeActive();
const style = [styles.container, isCustomThemeActive ? !isCustomThemeActive : styles.containerBackground];
const r216 = [<ReanimatedRexport.View style={[styles.tabsContainer, animatedStyle]} accessibilityElementsHidden={r152 ? void 0 : !r152} importantForAccessibility={r152 ? void 0 : "no-hide-descendants"}>
<YouBarStackNavigator />
{designToggle ? <MainTabsContentScrim translateX={translateX} maxWidth={maxWidth} /> : void 0}
</ReanimatedRexport.View>, <ThemedHeaderBackgroundGradient />, ,];
const r222 = channelScreensFromNavigation.length > 0;
let r223 = null;
if (r222) {
if (!state) {
screenStackActive = isChatBesideChannelList ? isChatLockedOpen : isChatBesideChannelList;
}
r223 = <MainTabsChannelScreenStack screens={channelScreensFromNavigation} screenStackActive={screenStackActive} translateX={translateX} isDragging={isDragging} maxWidth={maxWidth} highestFullyRenderedScreenIndex={sharedValue} shouldFreeze={!isChatBesideChannelList} focusChatPressableComponent={memo} firstScreenWidth={isChatBesideChannelList ? isChatLockedOpen ? chatWidth : void 0 : void 0} firstScreenFrame={memo2} />;
}
r216[2] = r223;
return <MainTabsNavigatorPanelContext.Provider value={panelGestureContext}>
<GestureDetector gesture={gesture}>
<View style={style} collapsable={false}>
<SidebarCoachmarkOverlay enabled={isChatBesideChannelList}>{r216}</SidebarCoachmarkOverlay>
</View>
</GestureDetector>
</MainTabsNavigatorPanelContext.Provider>;
});
export default r54;
@@ -0,0 +1,12 @@
// Metro module 14924 (f14925).
import { createContext } from "react";
import { Gesture } from "../../../../_bundle/Module5273";
import { createFakeSharedValue } from "../../../reanimated/ReanimatedHelperTypes";
const context = createContext({
gesture: Gesture.Pan(),
disallowGesture: createFakeSharedValue(false),
translateX: createFakeSharedValue(0)
});
const context2 = createContext(void 0);
export default context;
export { context2 as MainTabsChannelScreenStackContext };
@@ -0,0 +1,91 @@
// Metro module 14918 (f14919).
import { getRootNavigationRef } from "../../RootNavigationRef.native";
import { coerceMainRoute, coerceChannelRoute, coerceTabsRoute, coerceGuildsRoute } from "../../helpers/NavigationRouteUtils.native";
import { CommonActions } from "../../../../_bundle/Module1485";
import { v4 } from "../../../../_bundle/Module514";
import { HermesBuiltin } from "../../../../_hermes/prelude";
export function convertPortraitToLandscapeScreens() {
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null) {
const state = rootNavigationRef.getState();
if (state != null) {
const r27 = coerceMainRoute(state.routes[0]);
if (r27 != null) {
const state2 = r27.state;
if (state2 != null && state2.index !== 0 && coerceChannelRoute(state2.routes[1]) != null) {
const r14 = coerceTabsRoute(state2.routes[0]);
if (r14 != null) {
const state3 = r14.state;
if (coerceGuildsRoute(state3 == null ? void 0 : state3.routes[r14.state?.index]) != null) {
r27.state = {
...state2,
index: state2.index - 1,
routes: [state2.routes[0], ...state2.routes.slice(2)]
};
const routes = [r27, ...state.routes.slice(1)];
rootNavigationRef.dispatch(CommonActions.reset({
...state,
routes,
index: routes.length - 1
}));
}
}
}
}
}
}
}
export function convertLandscapeToPortraitScreens() {
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null) {
const state = rootNavigationRef.getState();
if (state != null) {
const r28 = coerceMainRoute(state.routes[0]);
if (r28 != null) {
const state2 = r28.state;
if (state2 != null) {
if (state.index === 0) {
if (state2.index === 0) {
return void 0;
}
if (coerceChannelRoute(state2.routes[1]) == null) {
return void 0;
}
}
const r14 = coerceTabsRoute(state2.routes[0]);
if (r14 != null) {
const state3 = r14.state;
const r48 = coerceGuildsRoute(state3 == null ? void 0 : state3.routes[r14.state?.index]);
if (r48 != null) {
const routes = [state2.routes[0], ,];
let key = r48.params?.channelId;
if (key == null) {
key = `channel-${v4()}`;
}
routes[1] = {
name: "channel",
key,
params: {
channelId: r48.params?.channelId,
guildId: r48.params?.guildId
}
};
HermesBuiltin.arraySpread(routes, state2.routes.slice(1), 2);
r28.state = {
...state2,
index: state2.index + 1,
routes
};
const routes2 = [r28, ...state.routes.slice(1)];
rootNavigationRef.dispatch(CommonActions.reset({
...state,
routes: routes2,
index: routes2.length - 1
}));
}
}
}
}
}
}
}
@@ -0,0 +1,37 @@
// Metro module 14925 (f14926).
import { useState, useEffect, Fragment, createContext } from "react";
import { View, StyleSheet } from "react-native";
import { NOOP } from "../../../../Constants";
import useInitialValue from "../../../../hooks/useInitialValue";
import { LayerContextManager } from "../../../../design/components/Layers/native/LayerContext.native";
let context, styles;
const SidebarCoachmarkOverlayLayer = function SidebarCoachmarkOverlayLayer(props) {
const manager = props.manager;
const [, setState] = useState({});
useEffect(() => {
const manager2 = manager;
manager.invalidate = () => setState({});
return () => {
manager2.invalidate = () => null;
};
}, [manager]);
return <View style={styles.overlay} ref={(a0) => manager.setSurfaceRef(a0)} onLayout={NOOP} pointerEvents="box-none">
{manager.items.map((item) => <Fragment key={item.key}>{item.component}</Fragment>)}
</View>;
};
context = createContext(null);
styles = StyleSheet.create({
overlay: {
...StyleSheet.absoluteFillObject,
zIndex: 1
}
});
export { context as SidebarCoachmarkOverlayContext };
export function SidebarCoachmarkOverlay(props) {
const { children, enabled } = props;
const initialValue = useInitialValue(() => new LayerContextManager());
return <context.Provider value={enabled ? initialValue : null}>
{children}
{enabled ? <SidebarCoachmarkOverlayLayer manager={initialValue} /> : null}
</context.Provider>;
}
@@ -0,0 +1,39 @@
// Metro module 15398 (f15399).
import { memo } from "react";
import { StyleSheet, View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { useToken } from "../../../../design/tokens/native/useToken";
import { hex2rgb } from "../../../../_bundle/int2hslRaw";
import Module4611 from "../../../../_bundle/Module4611";
const useStyles = createStyles({
container: {
position: "absolute",
left: 0,
right: 0,
top: 0
}
});
const r30 = memo(function ThemedHeaderBackgroundGradient(props) {
const { baseColor = Module712.colors.BACKGROUND_BASE_LOWEST, minHeight = 16 } = props;
const styles = useStyles();
const safeAreaInsets_native = useSafeAreaInsets_native();
const token = useToken(baseColor);
let r28 = hex2rgb(token, 0);
if (r28 == null) {
r28 = "transparent";
}
return <View style={[styles.container, {
height: Math.max(safeAreaInsets_native.top, minHeight)
}]} pointerEvents="none">
<Module4611 style={StyleSheet.absoluteFill} colors={[token, r28]} start={{
x: 0,
y: 0
}} end={{
x: 0,
y: 1
}} />
</View>;
});
export default r30;
@@ -0,0 +1,93 @@
// Metro module 14857 (f14858).
import { useMemo, useEffect } from "react";
import { createNavigatorFactory, useNavigationBuilder, StackRouter, StackActions } from "../../../../_bundle/Module1481";
import { coerceChannelRoute } from "../../helpers/NavigationRouteUtils.native";
import { useAccessibilityPatchedDescriptors } from "../../../../design/components/Navigator/native/createAccessibleNativeStackNavigator.native";
import { NativeStackView } from "../../../../_bundle/Module9109";
const navigatorFactory = createNavigatorFactory(function ChatPanelNativeStackNavigator(props) {
let state2;
const { id, initialRouteName, children, screenListeners, screenOptions, ...props2 } = props;
state2 = void 0;
const navigationBuilder = useNavigationBuilder(StackRouter, {
id,
initialRouteName,
children,
screenListeners,
screenOptions
});
const { state, descriptors, navigation, NavigationContent } = navigationBuilder;
const memo = useMemo(() => {
let r0, length;
const state3 = {
...state,
routes: [...state.routes]
};
const r16 = [];
const routes = [];
const filteredDescriptors = {};
const r8 = 0 < state3.routes.length;
let r1 = 0;
let r2 = 0;
let r6 = 0;
if (r8) {
do {
const r18 = state3.routes[r1];
const r36 = coerceChannelRoute(r18);
const r5 = r1;
const r3 = r2;
if (r36 != null) {
r16.push(r18);
r0 = r5 <= state3.index ? r3 + 1 : r3;
} else {
routes.push(r18);
const r40 = r18.key in descriptors;
r0 = r3;
if (r40) {
filteredDescriptors[r18.key] = descriptors[r18.key];
r0 = r3;
}
}
r1 = r5 + 1;
length = state3.routes.length;
r2 = r0;
r6 = r2;
} while (r1 < length);
}
state3.index = Math.max(0, state3.index - r6);
state3.routes = routes;
if (state3.routes.length === 0) {
state3.index = 0;
} else if (state3.index >= state3.routes.length) {
state3.index = state3.routes.length - 1;
}
return {
state: state3,
filteredDescriptors
};
}, [state, descriptors]);
state2 = memo.state;
const accessibilityPatchedDescriptors = useAccessibilityPatchedDescriptors(memo.filteredDescriptors);
useEffect(() => {
const r2 = navigation == null;
let r3 = void 0;
if (!r2) {
const addListener = navigation.addListener;
r3 = addListener == null ? void 0 : addListener.call(navigation, "tabPress", (c30793_0) => {
const isFocused = navigation.isFocused();
requestAnimationFrame(() => {
if (state2.index > 0 && isFocused && !c30793_0.defaultPrevented) {
navigation.dispatch({
...StackActions.popToTop(),
target: state2.key
});
}
});
});
}
return r3;
}, [navigation, state2.index, state2.key]);
return <NavigationContent>
<NativeStackView {...props2} state={state2} navigation={navigation} descriptors={accessibilityPatchedDescriptors} />
</NavigationContent>;
});
export default navigatorFactory;
@@ -0,0 +1,190 @@
// Metro module 14919 (f14920).
import { useState, useCallback, useEffect } from "react";
import ChannelStore from "../../../../stores/ChannelStore";
import SelectedChannelStore from "../../../../stores/SelectedChannelStore";
import SelectedGuildStore from "../../../../stores/SelectedGuildStore";
import { ME } from "../../../../Constants";
import { isStaticChannelRoute } from "../../../channel/ChannelConstants";
import { getRootNavigationRef } from "../../RootNavigationRef.native";
import { coerceTabsRoute, coerceGuildsRoute, coerceChannelRoute } from "../../helpers/NavigationRouteUtils.native";
import useChatLayout, { getChatLayout } from "../../../chat/native/useChatLayout";
let c10550_10, resolveBackgroundScreen, resolveChannelScreens;
const getActiveTabsRoute = function getActiveTabsRoute(a0) {
if (a0 != null) {
const state = a0.state;
const r3 = state == null;
let r4 = void 0;
if (!r3) {
const routes = state.routes;
let r11 = a0.state?.index;
if (r11 == null) {
const state2 = a0.state;
r11 = (state2 == null ? void 0 : state2.routes.length) - 1;
}
r4 = routes[r11];
}
if (r4 != null) {
return r4;
}
if (a0.params?.screen != null) {
return {
key: "resolved",
name: a0.params.screen,
params: a0.params.params
};
}
const rootNavigationRef = getRootNavigationRef();
if ((rootNavigationRef == null ? void 0 : rootNavigationRef.isReady()) === true) {
return rootNavigationRef.getCurrentRoute();
}
}
};
resolveBackgroundScreen = function resolveBackgroundScreen(a0) {
const r12 = coerceTabsRoute(a0.routes[0]);
if (r12 == null) {
return [];
}
const activeTabsRoute = getActiveTabsRoute(r12);
if (activeTabsRoute == null) {
return [];
}
const r18 = coerceGuildsRoute(activeTabsRoute);
if (r18 == null) {
return [];
}
const guildId2 = r18.params?.guildId;
let channelId = r18.params?.channelId;
if (channelId == null) {
channelId = void 0;
}
if (channelId == null) {
return [];
}
if (!isStaticChannelRoute(channelId) && ChannelStore.getChannel(channelId) == null) {
return [];
}
const search = r18.params?.search;
return [{
index: 0,
type: search != null && search ? c10550_10.FALLBACK_RENDERED : c10550_10.BACKGROUND_SAVED,
guildId: guildId2,
channelId,
showCreateThread: false
}];
};
resolveChannelScreens = function resolveChannelScreens(state, a1) {
const r10 = [];
const r5 = 0 <= state.index;
let r0 = 0;
if (r5) {
do {
const r22 = coerceChannelRoute(state.routes[r0]);
const r1 = r0;
if (r22 != null) {
r10.push({
index: r10.length,
type: c10550_10.DEFAULT,
guildId: r22.params.guildId,
channelId: r22.params.channelId,
showCreateThread: r22.params.showCreateThread
});
}
r0 = r1 + 1;
} while (r0 <= state.index);
}
if (a1.isChatLockedOpen) {
const r39 = resolveBackgroundScreen(state);
let c21453_0 = r39;
if (r39.length > 0) {
return [...r39, ...r10.map((item) => ({
...item,
index: item.index + c21453_0.length
}))];
}
}
return r10.length > 0 ? r10 : resolveBackgroundScreen(state);
};
c10550_10 = {
DEFAULT: 0,
0: "DEFAULT",
BACKGROUND_SAVED: 1,
1: "BACKGROUND_SAVED",
FALLBACK_RENDERED: 2,
2: "FALLBACK_RENDERED"
};
export default function useChannelScreensFromNavigation(a0) {
let callback;
let c21454_0 = a0;
const chatLayout = useChatLayout();
let c21454_1 = chatLayout;
const [state, setState] = useState(() => {
let r20;
let r10 = resolveChannelScreens(c21454_0.getState(), c21454_1);
if (!(r10.length > 0)) {
let guildId2 = SelectedGuildStore.getGuildId();
const channelId = SelectedChannelStore.getChannelId();
if (channelId == null) {
r20 = [];
} else {
if (guildId2 == null) {
guildId2 = ME;
}
r20 = [{
index: 0,
type: c10550_10.FALLBACK_RENDERED,
guildId: guildId2,
channelId
}];
}
r10 = r20;
}
return r10;
});
callback = useCallback((a0, a1) => {
if (a0 != null && a0.length > 0) {
setState(a0);
} else {
const r16 = coerceTabsRoute(a1.routes[0]);
const r3 = r16 != null;
let r17 = void 0;
if (r3) {
const activeTabsRoute = getActiveTabsRoute(r16);
const r20 = activeTabsRoute != null;
r17 = void 0;
if (r20) {
const r24 = coerceGuildsRoute(activeTabsRoute);
r17 = r24 == null ? void 0 : r24.params?.guildId;
}
}
const guildId = r17;
setState((prevState) => prevState.length !== 0 ? guildId != null && guildId !== prevState[0].guildId ? [] : prevState[0].type !== c10550_10.FALLBACK_RENDERED ? [{
...prevState[0],
type: c10550_10.FALLBACK_RENDERED
}] : prevState : prevState);
}
}, []);
useEffect(() => {
const state = c21454_0.getState();
callback(resolveChannelScreens(state, c21454_1), state);
}, [a0, chatLayout, callback]);
useEffect(() => {
const handleStateChange2 = function handleStateChange(a0) {
callback(resolveChannelScreens(a0.data.state, getChatLayout()), a0.data.state);
};
c21454_0.addListener("state", handleStateChange2);
return () => {
c21454_0.removeListener("state", handleStateChange2);
};
}, [a0, callback]);
return state;
};
export { c10550_10 as ChannelScreenType };
export { getActiveTabsRoute };
export function isActiveTabsGuilds(a0) {
const r12 = coerceTabsRoute(a0.routes[0]);
if (r12 == null) {
return false;
}
const activeTabsRoute = getActiveTabsRoute(r12);
return activeTabsRoute != null && coerceGuildsRoute(activeTabsRoute) != null;
}
@@ -0,0 +1,51 @@
// Metro module 15401 (f15402).
import { useMemo } from "react";
import { StyleSheet } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
const useStyles = createStyles({
elevation: {
...StyleSheet.absoluteFillObject,
...Module712.shadows.SHADOW_LOW
}
});
const __initData = {
code: "function useMainTabsChannelScreenStylesTsx1(){const{freezeValue,isDragging,translateX,maxWidth,elevationStyle,isCompletelyCovered}=this.__closure;var _freezeValue,_isCompletelyCovered;(_freezeValue=freezeValue)===null||_freezeValue===void 0||_freezeValue.get();const showBorder=isDragging.get()||translateX.get()!==0&&translateX.get()!==maxWidth;return{transform:[{translateX:translateX.get()}],shadowOpacity:showBorder?elevationStyle.shadowOpacity:0,elevation:showBorder?elevationStyle.elevation:0,opacity:(_isCompletelyCovered=isCompletelyCovered)!==null&&_isCompletelyCovered!==void 0&&_isCompletelyCovered.get()?0:1};}"
};
export function useMainTabsChannelScreenStyles(a0, a1, a2, a3, a4) {
let animatedStyle;
const styles = useStyles();
const elevation = styles.elevation;
const c = function c() {
if (a4 != null) {
a4.get();
}
let r8 = a0.get();
if (!r8) {
r8 = a1.get() !== 0 && a1.get() !== a2;
}
const r23 = {
transform: [{
translateX: a1.get()
}],
shadowOpacity: r8 ? elevation.shadowOpacity : 0,
elevation: r8 ? elevation.elevation : 0,
opacity: null
};
r23.opacity = (a3 == null ? void 0 : a3.get()) ? 0 : 1;
return r23;
};
c.__closure = {
freezeValue: a4,
isDragging: a0,
translateX: a1,
maxWidth: a2,
elevationStyle: elevation,
isCompletelyCovered: a3
};
c.__workletHash = 16765484569296;
c.__initData = __initData;
animatedStyle = useAnimatedStyle(c);
return useMemo(() => [styles.elevation, animatedStyle], [styles, animatedStyle]);
}
@@ -0,0 +1,343 @@
// Metro module 14920 (f14921).
import { useRef, useCallback, useEffect, useContext, useMemo } from "react";
import { LaunchPadTypes } from "../../../launchpad/native/LaunchPadConstants";
import * as _PlatformUtils from "../../../../utils/PlatformUtils";
import * as _PanelsConfig from "../../../panels/native/PanelsConfig";
import { DEFAULT_PANELS_ANIMATION_CONFIG } from "../../../panels/native/PanelsConfig";
import useLaunchPadType from "../../../launchpad/native/useLaunchPadType";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import useWindowDimensions_native from "../../../screen/useWindowDimensions.native";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import { useSharedValue, runOnUI, useAnimatedReaction } from "../../../reanimated/ReanimatedRexport";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import * as _timingPresets from "../../../../design/animation/reanimated/timing/timingPresets";
import * as _spring from "../../../../design/animation/reanimated/spring/spring";
import LaunchPadGestureRefContext from "../../../launchpad/native/LaunchPadGestureRefContext";
import * as _Module5273 from "../../../../_bundle/Module5273";
import { Gesture } from "../../../../_bundle/Module5273";
const isAndroid = _PlatformUtils.isAndroid();
const ANDROID_PANELS_ANIMATION_CONFIG = isAndroid ? _PanelsConfig.ANDROID_PANELS_ANIMATION_CONFIG : DEFAULT_PANELS_ANIMATION_CONFIG;
const __initData = {
code: "function useMainTabsPanelsGestureTsx1(Width){const{isDragging,translateX,IS_ANDROID,withTiming,timingInstant}=this.__closure;if(isDragging.get())return;if(translateX.get()===0)return;translateX.set(IS_ANDROID?withTiming(Width,timingInstant,'animate-always'):Width);}"
};
const __initData2 = {
code: "function useMainTabsPanelsGestureTsx2(show,isFling,velocity,force){const{translateX,Width,onVisibilityChange,runOnJS,onPreMovement,panelsConfig,isTimingConfig,withTiming,withSpring}=this.__closure;if(!force&&translateX.get()!==0&&translateX.get()!==Width){return false;}const targetTranslationX=show?0:Width;if(translateX.get()===targetTranslationX){if(onVisibilityChange!=null){runOnJS(onVisibilityChange)(show);}return false;}if(onPreMovement!=null){runOnJS(onPreMovement)(show);}const animationConfig=show?isFling?panelsConfig.swipeSidePanelOpen:panelsConfig.nonSwipeSidePanelOpen:isFling?panelsConfig.swipeSidePanelClose:panelsConfig.nonSwipeSidePanelClose;function handleAnimationFinish(finished){'worklet';if(!finished)return;if(onVisibilityChange!=null){runOnJS(onVisibilityChange)(show);}}translateX.set(isTimingConfig(animationConfig)?withTiming(targetTranslationX,animationConfig,'respect-motion-settings',handleAnimationFinish):withSpring(targetTranslationX,{...animationConfig,velocity:velocity},'respect-motion-settings',handleAnimationFinish));return true;}"
};
const __initData3 = {
code: "function handleAnimationFinish_useMainTabsPanelsGestureTsx3(finished){const{onVisibilityChange,runOnJS,show}=this.__closure;if(!finished)return;if(onVisibilityChange!=null){runOnJS(onVisibilityChange)(show);}}"
};
const __initData4 = {
code: "function useMainTabsPanelsGestureTsx4(){const{disallowGesture}=this.__closure;return disallowGesture.get();}"
};
const __initData5 = {
code: "function useMainTabsPanelsGestureTsx5(currentDisallow,previousDisallow){const{didJustAllowGesture}=this.__closure;if(currentDisallow===previousDisallow)return;if(currentDisallow)return;didJustAllowGesture.set(true);}"
};
const __initData6 = {
code: "function useMainTabsPanelsGestureTsx6(e){const{isDragging,disallowGesture,didJustAllowGesture,runOnJS,setIsDraggingRef,panelsConfig,movePanel,translateX,Width}=this.__closure;try{if(!isDragging.get()||disallowGesture.get()||didJustAllowGesture.get()){return;}}finally{isDragging.set(false);didJustAllowGesture.set(false);runOnJS(setIsDraggingRef)(false);}if(Math.abs(e.velocityX)>panelsConfig.minFlingVelocityX){movePanel(e.velocityX<0,true,e.velocityX,true);}else{movePanel(translateX.get()<Width/2,false,e.velocityX,true);}}"
};
const __initData7 = {
code: "function useMainTabsPanelsGestureTsx7(e){const{disallowGesture,translateX,Width,didJustAllowGesture}=this.__closure;if(disallowGesture.get()){const currentTranslateX=translateX.get();if(currentTranslateX===0||currentTranslateX===Width){return;}translateX.set(0);return;}translateX.set(Math.max(0,Math.min(Width,translateX.get()+e.changeX)));didJustAllowGesture.set(false);}"
};
const __initData8 = {
code: "function useMainTabsPanelsGestureTsx8(){const{isDragging,runOnJS,setIsDraggingRef,onDragStart}=this.__closure;isDragging.set(true);runOnJS(setIsDraggingRef)(true);if(onDragStart!=null){runOnJS(onDragStart)();}}"
};
const __initData9 = {
code: "function useMainTabsPanelsGestureTsx9(event,manager){const{State,startPosition,GESTURE_MIN_DISTANCE,disallowGesture,translateX,cancelOnSwipeRightFromStart,Width,launchPadType,LaunchPadTypes,windowWidth,LAUNCHPAD_GESTURE_INSET}=this.__closure;if(event.state!==State.BEGAN)return;const touch=event.allTouches[0];if(touch==null)return;const xDiff=touch.x-startPosition.get().x;const xDiffAbs=Math.abs(xDiff);if(xDiffAbs<=GESTURE_MIN_DISTANCE)return;if(disallowGesture.get()){return;}const yDiffAbs=Math.abs(touch.y-startPosition.get().y);if(xDiffAbs<=yDiffAbs||xDiffAbs*xDiffAbs+yDiffAbs*yDiffAbs<GESTURE_MIN_DISTANCE*GESTURE_MIN_DISTANCE){return;}if(xDiff<=0){if(translateX.get()===0){manager.fail();return;}}else{if(cancelOnSwipeRightFromStart===true&&translateX.get()>=Width){manager.fail();return;}}const isGestureBasedLaunchPad=launchPadType===LaunchPadTypes.GESTURE_EDGE||launchPadType===LaunchPadTypes.GESTURE_FULL;if(isGestureBasedLaunchPad&&xDiff<0){const launchpadGestureEdge=windowWidth-LAUNCHPAD_GESTURE_INSET;if(launchPadType===LaunchPadTypes.GESTURE_FULL&&startPosition.get().x<launchpadGestureEdge||launchPadType===LaunchPadTypes.GESTURE_EDGE&&startPosition.get().x>=launchpadGestureEdge){manager.fail();return;}}manager.activate();}"
};
const __initData10 = {
code: "function useMainTabsPanelsGestureTsx10(event,manager){const{startPosition}=this.__closure;const touch=event.allTouches[0];if(touch==null)return;startPosition.set({x:touch.x,y:touch.y});manager.begin();}"
};
export default function useMainTabsPanelsGesture(a0) {
let sharedValue3, callback2, sharedValue4, sharedValue5, context, memo;
const { canDrag, onVisibilityChange, onDragStart, onPreMovement, startShown } = a0;
let openWidth = a0.openWidth;
const cancelOnSwipeRightFromStart = a0.cancelOnSwipeRightFromStart;
sharedValue3 = void 0;
callback2 = void 0;
sharedValue4 = void 0;
sharedValue5 = void 0;
context = void 0;
memo = void 0;
const launchPadType = useLaunchPadType();
const safeAreaInsets_native = useSafeAreaInsets_native();
let c21455_6 = safeAreaInsets_native;
const Width = useWindowDimensions_native().Width;
if (openWidth == null) {
openWidth = Width;
}
const width2 = openWidth;
const sharedValue = useSharedValue(startShown ? 0 : width2);
const sharedValue2 = useSharedValue(false);
const ref = useRef(false);
const callback = useCallback((a0) => {
ref.current = a0;
}, [ref]);
sharedValue3 = useSharedValue(false);
useEffect(() => {
const r11 = function e(a0) {
if (!sharedValue2.get() && sharedValue.get() !== 0) {
sharedValue.set(isAndroid ? _timing.withTiming(a0, _timingPresets.timingInstant, "animate-always") : a0);
}
};
r11.__closure = {
isDragging: sharedValue2,
translateX: sharedValue,
IS_ANDROID: isAndroid,
withTiming: _timing.withTiming,
timingInstant: _timingPresets.timingInstant
};
r11.__workletHash = 16976202846494;
r11.__initData = __initData;
runOnUI(r11)(width2);
}, [sharedValue2, sharedValue, width2]);
const R = function R(a0, a1, a2, a3) {
let c27856_0 = a0;
if (!a3 && sharedValue.get() !== 0 && sharedValue.get() !== width2) {
return false;
}
const r12 = a0 ? 0 : width2;
if (sharedValue.get() === r12) {
if (onVisibilityChange != null) {
_ReanimatedRexport.runOnJS(onVisibilityChange)(a0);
}
return false;
}
if (onPreMovement != null) {
_ReanimatedRexport.runOnJS(onPreMovement)(a0);
}
const r9 = a0 ? a1 ? ANDROID_PANELS_ANIMATION_CONFIG.swipeSidePanelOpen : ANDROID_PANELS_ANIMATION_CONFIG.nonSwipeSidePanelOpen : a1 ? ANDROID_PANELS_ANIMATION_CONFIG.swipeSidePanelClose : ANDROID_PANELS_ANIMATION_CONFIG.nonSwipeSidePanelClose;
const handleAnimationFinish = function handleAnimationFinish(a0) {
if (a0 ? onVisibilityChange != null : a0) {
_ReanimatedRexport.runOnJS(onVisibilityChange)(c27856_0);
}
};
handleAnimationFinish.__closure = {
onVisibilityChange,
runOnJS: _ReanimatedRexport.runOnJS,
show: a0
};
handleAnimationFinish.__workletHash = 1018878139815;
handleAnimationFinish.__initData = __initData3;
const isTimingConfig = _PanelsConfig.isTimingConfig(r9);
sharedValue.set(isTimingConfig ? _timing.withTiming(r12, r9, "respect-motion-settings", handleAnimationFinish) : _spring.withSpring(r12, {
...r9,
velocity: a2
}, "respect-motion-settings", handleAnimationFinish));
return true;
};
R.__closure = {
translateX: sharedValue,
Width: width2,
onVisibilityChange,
runOnJS: _ReanimatedRexport.runOnJS,
onPreMovement,
panelsConfig: ANDROID_PANELS_ANIMATION_CONFIG,
isTimingConfig: _PanelsConfig.isTimingConfig,
withTiming: _timing.withTiming,
withSpring: _spring.withSpring
};
R.__workletHash = 4205680413964;
R.__initData = __initData2;
callback2 = useCallback(R, [onVisibilityChange, onPreMovement, sharedValue, width2]);
sharedValue4 = useSharedValue(false);
const U = () => sharedValue3.get();
U.__closure = {
disallowGesture: sharedValue3
};
U.__workletHash = 15338765161171;
U.__initData = __initData4;
const N = function N(a0, a1) {
if (a0 !== a1 && !a0) {
sharedValue4.set(true);
}
};
N.__closure = {
didJustAllowGesture: sharedValue4
};
N.__workletHash = 17048450187141;
N.__initData = __initData5;
useAnimatedReaction(U, N);
sharedValue5 = useSharedValue({
x: 0,
y: 0
});
context = useContext(LaunchPadGestureRefContext);
memo = useMemo(() => {
const r28 = Gesture.Pan().enabled(canDrag).requireExternalGestureToFail(context).manualActivation(_PlatformUtils.isAndroid());
const r39 = r28.hitSlop({
top: -c21455_6.top,
left: -c21455_6.left,
bottom: -c21455_6.bottom,
right: -c21455_6.right
});
const u = function u(a0, a1) {
const r5 = a0.allTouches[0];
if (r5 != null) {
sharedValue5.set({
x: r5.x,
y: r5.y
});
a1.begin();
}
};
u.__closure = {
startPosition: sharedValue5
};
u.__workletHash = 718728838752;
u.__initData = __initData10;
const r45 = r39.onTouchesDown(u);
const l = function l(a0, a1) {
if (a0.state === _Module5273.State.BEGAN) {
const r17 = a0.allTouches[0];
if (r17 != null) {
const r23 = r17.x - sharedValue5.get().x;
const r25 = Math.abs(r23);
if (!(r25 <= 12) && !sharedValue3.get()) {
const r35 = Math.abs(r17.y - sharedValue5.get().y);
if (!(r25 <= r35) && !(r25 * r25 + r35 * r35 < 144)) {
if (r23 <= 0) {
if (sharedValue.get() === 0) {
a1.fail();
return void 0;
}
} else if (cancelOnSwipeRightFromStart === true && sharedValue.get() >= width2) {
a1.fail();
return void 0;
}
L18: {
if (!(launchPadType !== LaunchPadTypes.GESTURE_EDGE && launchPadType !== LaunchPadTypes.GESTURE_FULL) && r23 < 0) {
const r60 = Width - 48;
if (!(launchPadType === LaunchPadTypes.GESTURE_FULL && sharedValue5.get().x < r60)) {
if (launchPadType !== LaunchPadTypes.GESTURE_EDGE) {
break L18;
}
if (!(sharedValue5.get().x >= r60)) {
break L18;
}
}
a1.fail();
return void 0;
}
}
a1.activate();
}
}
}
}
};
l.__closure = {
State: _Module5273.State,
startPosition: sharedValue5,
GESTURE_MIN_DISTANCE: 12,
disallowGesture: sharedValue3,
translateX: sharedValue,
cancelOnSwipeRightFromStart,
Width: width2,
launchPadType,
LaunchPadTypes,
windowWidth: Width,
LAUNCHPAD_GESTURE_INSET: 48
};
l.__workletHash = 13108412336922;
l.__initData = __initData9;
const r58 = r45.onTouchesMove(l);
const r60 = function() {
sharedValue2.set(true);
_ReanimatedRexport.runOnJS(callback)(true);
if (onDragStart != null) {
_ReanimatedRexport.runOnJS(onDragStart)();
}
};
r60.__closure = {
isDragging: sharedValue2,
runOnJS: _ReanimatedRexport.runOnJS,
setIsDraggingRef: callback,
onDragStart
};
r60.__workletHash = 8659650895938;
r60.__initData = __initData8;
const r68 = r58.onStart(r60);
const n = function n(a0) {
L5: {
if (sharedValue3.get()) {
const r26 = sharedValue.get();
if (r26 !== 0 && r26 !== width2) {
sharedValue.set(0);
break L5;
}
return void 0;
}
sharedValue.set(Math.max(0, Math.min(width2, sharedValue.get() + a0.changeX)));
sharedValue4.set(false);
}
};
n.__closure = {
disallowGesture: sharedValue3,
translateX: sharedValue,
Width: width2,
didJustAllowGesture: sharedValue4
};
n.__workletHash = 13355779907583;
n.__initData = __initData7;
const r75 = r68.onChange(n);
const r77 = function e(a0) {
L8: {
try {
if (!sharedValue2.get()) {
break L8;
}
if (sharedValue3.get()) {
break L8;
}
if (sharedValue4.get()) {
break L8;
}
} catch (r77) {
sharedValue2.set(false);
sharedValue4.set(false);
_ReanimatedRexport.runOnJS(callback)(false);
throw r77;
}
sharedValue2.set(false);
sharedValue4.set(false);
_ReanimatedRexport.runOnJS(callback)(false);
if (Math.abs(a0.velocityX) > ANDROID_PANELS_ANIMATION_CONFIG.minFlingVelocityX) {
callback2(a0.velocityX < 0, true, a0.velocityX, true);
} else {
callback2(sharedValue.get() < width2 / 2, false, a0.velocityX, true);
}
return void 0;
}
sharedValue2.set(false);
sharedValue4.set(false);
_ReanimatedRexport.runOnJS(callback)(false);
};
r77.__closure = {
isDragging: sharedValue2,
disallowGesture: sharedValue3,
didJustAllowGesture: sharedValue4,
runOnJS: _ReanimatedRexport.runOnJS,
setIsDraggingRef: callback,
panelsConfig: ANDROID_PANELS_ANIMATION_CONFIG,
movePanel: callback2,
translateX: sharedValue,
Width: width2
};
r77.__workletHash = 2071301756262;
r77.__initData = __initData6;
return r75.onFinalize(r77);
}, [safeAreaInsets_native, sharedValue, width2, Width, sharedValue2, callback2, onDragStart, canDrag, sharedValue5, launchPadType, cancelOnSwipeRightFromStart, sharedValue3, callback, context, sharedValue4]);
return {
gesture: memo,
panelGestureContext: useMemo(() => ({
gesture: memo,
disallowGesture: sharedValue3,
translateX: sharedValue
}), [memo, sharedValue3, sharedValue]),
isDragging: sharedValue2,
translateX: sharedValue,
movePanel: callback2,
maxWidth: width2,
isDraggingRef: ref
};
};
@@ -0,0 +1,115 @@
// Metro module 15273 (f15274).
import { useMemo } from "react";
import { View } from "react-native";
import GuildReadStateStore from "../../../../stores/GuildReadStateStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../_bundle/Module589";
import useNotificationsTabBadge from "../tabs/notifications/useNotificationsTabBadge";
import { BADGE_SIZE, BADGE_PADDING, Badge } from "../../../../design/void/native";
import ClipView, { CutoutShape } from "../../../../design/components/Icon/native/ClipView";
import { isAndroid } from "../../../../_bundle/Module501";
import { ArrowLargeLeftIcon } from "../../../../design/components/Icon/native/redesign/generated/ArrowLargeLeftIcon";
import { XSmallIcon } from "../../../../design/components/Icon/native/redesign/generated/XSmallIcon";
import { XLargeIcon } from "../../../../design/components/Icon/native/redesign/generated/XLargeIcon";
let useStyles;
const IconWithBadge = function IconWithBadge(props) {
let includeNotificationsCount = props.includeNotificationsCount;
if (includeNotificationsCount === void 0) {
includeNotificationsCount = false;
}
let c21834_0, memo;
const Icon = props.Icon;
c21834_0 = void 0;
memo = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([GuildReadStateStore], () => GuildReadStateStore.getTotalMentionCount());
const value = useNotificationsTabBadge().value;
const value2 = (stateFromStores ?? 0) + (includeNotificationsCount ? value : 0);
c21834_0 = value2;
memo = useMemo(() => c21834_0 < 10 ? BADGE_SIZE : BADGE_SIZE + 8, [value2]);
const memo2 = useMemo(() => {
if (c21834_0 !== 0) {
return {
shape: CutoutShape.RoundedRect,
x: 12 - BADGE_PADDING,
y: 16 - BADGE_PADDING,
width: memo + 2 * BADGE_PADDING,
height: BADGE_SIZE + 2 * BADGE_PADDING,
cornerRadius: (BADGE_SIZE + 2 * BADGE_PADDING) / 2
};
}
}, [value2, memo]);
return <View style={isAndroid() ? {
height: 40,
width: 40,
paddingTop: 8,
marginRight: -8
} : void 0}>
<View style={styles.backIcon}>
<ClipView cutouts={memo2 != null ? [memo2] : []}>
<Icon size="md" style={styles.backIcon} color="interactive-text-default" />
</ClipView>
{value2 > 0 ? <View style={styles.badgeWrapper}>
<Badge value={value2} maxValue={99} />
</View> : null}
</View>
</View>;
};
useStyles = createStyles({
badgeWrapper: {
position: "absolute",
top: 16,
left: 12
},
backIcon: {
height: 24,
width: 24
},
iconWithBadge: {
display: "flex",
flexDirection: "row",
alignItems: "center",
gap: Module712.space.PX_4,
borderRadius: Module712.modules.button.BORDER_RADIUS,
padding: 7,
backgroundColor: Module712.colors.CONTROL_OVERLAY_SECONDARY_BACKGROUND_DEFAULT
}
});
export const BACK_ICON_WITH_BADGE_HIT_SLOP = {
top: 8,
bottom: 8,
left: 8,
right: 8
};
export function SettingsLeftIconWithBadge(props) {
let props2;
const { navigation, includeNotificationsCount = false } = props;
const memo2 = useMemo(() => navigation.getState().index > 0, [navigation]);
const r14 = {
includeNotificationsCount,
Icon: null
};
if (memo2) {
r14.Icon = ArrowLargeLeftIcon;
props2 = r14;
} else {
r14.Icon = XSmallIcon;
props2 = r14;
}
return <IconWithBadge {...props2} />;
}
export function LeftBackIconWithBadge(props) {
let includeNotificationsCount = props.includeNotificationsCount;
if (includeNotificationsCount === void 0) {
includeNotificationsCount = false;
}
return <IconWithBadge includeNotificationsCount={includeNotificationsCount} Icon={ArrowLargeLeftIcon} />;
}
export function CloseIconWithBadgeOnSide(props) {
const count = props.count;
return <View style={useStyles().iconWithBadge}>
<XLargeIcon size="sm" color="white" />
{count > 0 ? <Badge value={count} /> : null}
</View>;
}
@@ -0,0 +1,38 @@
// Metro module 9124 (f9125).
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({
badge: {
backgroundColor: Module712.colors.BACKGROUND_BRAND
},
badgeClassic: {
backgroundColor: Module712.colors.INTERACTIVE_TEXT_ACTIVE
},
mask: {
alignItems: "center",
justifyContent: "center"
}
});
const r40 = memo(function Badge(props) {
const { size = 12, maskSize = 4, classic = false, maskColor, style, badgeStyle } = props;
const styles = useStyles();
const height = size + 2 * maskSize;
return <View style={[styles.mask, maskColor != null ? {
backgroundColor: maskColor,
height,
width: height,
borderRadius: height / 2
} : void 0, style]}>
<View style={[classic ? styles.badgeClassic : styles.badge, {
height: size,
width: size,
borderRadius: size / 2
}, badgeStyle]} />
</View>;
});
export default r40;
export const DEFAULT_BADGE_SIZE = 12;
export const CHANNEL_BADGE_SIZE = 8;
export const DEFAULT_BADGE_MASK_SIZE = 4;
@@ -0,0 +1,187 @@
// Metro module 10281 (f10282).
import { useMemo, memo } from "react";
import { View } from "react-native";
import RelationshipStore from "../../../../stores/RelationshipStore";
import { ImageIcon } from "../../../../design/components/Icon/native/redesign/generated/ImageIcon";
import { VideoIcon } from "../../../../design/components/Icon/native/redesign/generated/VideoIcon";
import { MusicIcon } from "../../../../design/components/Icon/native/redesign/generated/MusicIcon";
import { AttachmentIcon } from "../../../../design/components/Icon/native/redesign/generated/AttachmentIcon";
import { LinkIcon } from "../../../../design/components/Icon/native/redesign/generated/LinkIcon";
import { StickerIcon } from "../../../../design/components/Icon/native/redesign/generated/StickerIcon";
import { PhoneCallIcon } from "../../../../design/components/Icon/native/redesign/generated/PhoneCallIcon";
import { PhoneHangUpIcon } from "../../../../design/components/Icon/native/redesign/generated/PhoneHangUpIcon";
import { useFontScale } from "../../../screen/native/useFontScale";
import { renderMessagePreviewMarkup } from "../../../message_previews/native/MessagePreviewMarkup";
import MobileVisualRefreshExperiment from "../../../themes/experiments/MobileVisualRefreshExperiment";
import { useFormattedMessagePreview, isMessageContentPreviewable } from "../../../message_previews/useFormattedMessagePreview";
import { getLayoutStyles } from "./guild_channels/layouts/ChannelListLayout";
import { scaleTextLineHeight } from "../../../screen/native/useScaledTextLineHeight.android";
import { Text } from "../../../../design/components/Text/native/Text";
import useTheme from "../../../../hooks/useTheme";
import { createNativeStyleProperties } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useToken } from "../../../../design/tokens/native/useToken";
import { RenderEmbeds, InlineEmbedMedia, InlineAttachmentMedia } from "../../../user_settings/UserSettings";
import RowGenerator from "../../../messages/native/renderer/RowGenerator";
import ChatItem from "../../../../components_native/chat/ChatItem";
import { MessageContextType } from "../../../messages/native/renderer/RowGeneratorTypes";
import { processColorOrThrow } from "../../../messages/native/renderer/RowGeneratorStyleSheet";
import { useStateFromStores } from "../../../../_bundle/Module589";
let Component, ChannelRowPreview, NativeChannelRowPreview;
const PreviewIcon = function PreviewIcon(props) {
const { icon, ...props2 } = props;
if (icon === "image") {
return <ImageIcon {...props2} />;
}
if (icon === "video") {
return <VideoIcon {...props2} />;
}
if (icon === "audio") {
return <MusicIcon {...props2} />;
}
if (icon === "attachment") {
return <AttachmentIcon {...props2} />;
}
if (icon === "link") {
return <LinkIcon {...props2} />;
}
if (icon === "sticker") {
return <StickerIcon {...props2} />;
}
if (icon === "call-active") {
return <PhoneCallIcon {...props2} />;
}
if (icon === "call-ended") {
return <PhoneHangUpIcon {...props2} />;
}
};
ChannelRowPreview = function ChannelRowPreview(props) {
let text;
const { message, channel, layout, lineClamp: lineClamp2 = 1, muted } = props;
let variant = props.variant;
let color = props.color;
const r15 = MobileVisualRefreshExperiment("ChannelRowPreview");
const fontScale = useFontScale();
const formattedMessagePreview = useFormattedMessagePreview(message, channel);
const styles = getLayoutStyles(layout);
const minHeight = scaleTextLineHeight(styles.messagePreview.text.variant, fontScale);
if (formattedMessagePreview == null) {
return null;
}
const { authorLabel, color: color2, trailingIcon } = formattedMessagePreview;
if (color == null) {
color = color2;
}
L13: {
const type = formattedMessagePreview.type;
if (type === "text") {
text = formattedMessagePreview.text;
} else {
if (type !== "markup") {
text = void 0;
if (type !== "message") {
break L13;
}
}
text = <Component markup={formattedMessagePreview.type === "markup" ? formattedMessagePreview.markup : formattedMessagePreview.message.content} channelId={message.channel_id} guildId={channel.guild_id} muted={muted} layout={layout} color={color} />;
}
}
if (variant == null) {
variant = r15 ? "text-sm/normal" : styles.messagePreview.text.variant;
}
return <View style={{
flexDirection: "row",
alignItems: "center",
minHeight
}}>
<Text lineClamp={lineClamp2} variant={variant} maxFontSizeMultiplier={1.75} color={color} style={{
paddingBottom: 2,
flexShrink: 1
}}>
{authorLabel != null && `${authorLabel}: `}
{text}
</Text>
{trailingIcon != null && <PreviewIcon icon={trailingIcon} size={styles.messagePreview.messageTypeIconSizeNew} color={color} style={{
marginLeft: 4
}} />}
</View>;
};
NativeChannelRowPreview = function NativeChannelRowPreview(props) {
const { message, lineClamp, messageSizeCacheRef, maxHeight, gifAutoPlay: gifAutoPlay2 = false } = props;
const gifAutoPlay = gifAutoPlay2;
const { textColor, gradientStyles, gradientColors } = props;
const theme = useTheme();
let c17840_2 = createNativeStyleProperties({
seeMoreLabelColor: Module712.colors.TEXT_DEFAULT
})(theme);
const token = useToken(textColor);
const setting = RenderEmbeds.getSetting();
const setting2 = InlineEmbedMedia.getSetting();
const setting3 = InlineAttachmentMedia.getSetting();
return <ChatItem pointerEvents="none" horizontalOffset={0} modifyRow={function modifyRow(a0) {
let textColor = void 0;
a0.contextType = MessageContextType.SEARCH;
if (token != null) {
try {
textColor = processColorOrThrow(token);
} catch ($e) {
textColor = void 0;
}
}
if (textColor != null) {
a0.message.textColor = textColor;
}
if (lineClamp != null) {
if (textColor == null) {
textColor = c17840_2.seeMoreLabelColor;
}
a0.truncation = {
numberOfLines: lineClamp,
expandable: false,
seeMoreLabel: "...",
seeMoreLabelColor: textColor
};
}
}} message={message} rowGenerator={useMemo(() => {
const rowGenerator = new RowGenerator();
rowGenerator.setOptions({
renderEmbeds: setting,
inlineEmbedMedia: setting2,
inlineAttachmentMedia: setting3,
renderReactions: false,
animateEmoji: false,
gifAutoPlay,
renderReplies: false,
renderCodedLinks: false,
renderGiftCode: false,
renderActivityInviteEmbed: false,
renderThreadEmbeds: false,
renderForumPostActions: false,
renderComponents: false,
ignoreMentioned: true,
enableSwipeActions: false,
renderExecutedCommands: false,
useAlternateEmbedColors: true
});
return rowGenerator;
}, [setting, setting2, setting3, gifAutoPlay])} messageSizeCacheRef={messageSizeCacheRef} maxHeight={maxHeight} gradientStyles={gradientStyles} gradientColors={gradientColors} />;
};
Component = memo(function(a0) {
const { markup, channelId, guildId } = a0;
return renderMessagePreviewMarkup({
content: markup,
muted: a0.muted,
guildId,
channelId,
layout: a0.layout,
color: a0.color,
fontScale: useFontScale()
});
});
const r32 = memo(function(a0) {
const stateFromStores = useStateFromStores([RelationshipStore], () => RelationshipStore.isBlockedOrIgnored(a0.message.author.id), [a0.message.author.id]);
return isMessageContentPreviewable(a0.message) && !stateFromStores ? <NativeChannelRowPreview {...a0} /> : <ChannelRowPreview {...a0} />;
});
export { ChannelRowPreview };
export { NativeChannelRowPreview };
export { r32 as NativeMessageChannelRowPreview };
@@ -0,0 +1,304 @@
// Metro module 12032 (f12033).
import { createElement, useEffect, useMemo, useRef } from "react";
import { View } from "react-native";
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { DARK_03_LIGHT_02 } from "../../../../design/migrations/native/LegacyTokens";
import MobileVisualRefreshExperiment from "../../../themes/experiments/MobileVisualRefreshExperiment";
import { useThemeContext, isThemeLight } from "../../../../design/shared";
import useRefValue from "../../../../hooks/useRefValue";
import { useStateFromStores } from "../../../../_bundle/defaultAreStatesEqual";
import ReanimatedRexport, { useSharedValue, useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import * as _spring from "../../../../design/animation/reanimated/spring/spring";
import { Text } from "../../../../design/components/Text/native/Text";
import FastImage from "../../../../components_native/common/FastImage";
let width, SPRING_OPTIONS_SCALE, SPRING_OPTIONS_POSITION, useStyles, c8272_13, __initData, GroupMemberCount, GroupMemberAvatar;
const AnimatedContainer = function AnimatedContainer(props) {
let sharedValue, sharedValue2, sharedValue3, sharedValue4;
const { scale, translateX, shadow, translateY, animateOnMount: animateOnMount2, children } = props;
sharedValue = void 0;
sharedValue2 = void 0;
sharedValue3 = void 0;
sharedValue4 = void 0;
const styles = useStyles(MobileVisualRefreshExperiment("GroupAvatar"));
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
sharedValue = useSharedValue(animateOnMount2 ? 0 : 1);
sharedValue2 = useSharedValue(animateOnMount2 ? 0 : translateY);
sharedValue3 = useSharedValue(animateOnMount2 ? 0 : translateX);
sharedValue4 = useSharedValue(animateOnMount2 ? scale / 2 : scale);
useEffect(() => {
sharedValue.set(1);
sharedValue4.set(scale);
sharedValue2.set(translateY);
sharedValue3.set(translateX);
}, [sharedValue, sharedValue4, sharedValue2, sharedValue3, scale, translateY, translateX]);
const T = function T() {
return {
opacity: _timing.withTiming(sharedValue.get()),
transform: [{
translateX: stateFromStores ? sharedValue3.get() : _spring.withSpring(sharedValue3.get(), SPRING_OPTIONS_POSITION)
}, {
translateY: stateFromStores ? sharedValue2.get() : _spring.withSpring(sharedValue2.get(), SPRING_OPTIONS_POSITION)
}, {
scale: stateFromStores ? sharedValue4.get() : _spring.withSpring(sharedValue4.get(), SPRING_OPTIONS_SCALE)
}]
};
};
T.__closure = {
withTiming: _timing.withTiming,
opacityAnimation: sharedValue,
useReducedMotion: stateFromStores,
translateXAnimation: sharedValue3,
withSpring: _spring.withSpring,
SPRING_OPTIONS_POSITION,
translateYAnimation: sharedValue2,
scaleAnimation: sharedValue4,
SPRING_OPTIONS_SCALE
};
T.__workletHash = 8800301056148;
T.__initData = __initData;
return <ReanimatedRexport.View style={[styles.avatarContainer, useAnimatedStyle(T), shadow ? styles.shadow : void 0]}>{children}</ReanimatedRexport.View>;
};
GroupMemberCount = function GroupMemberCount(props) {
const count2 = props.count;
const styles = useStyles(MobileVisualRefreshExperiment("GroupAvatar"));
return <View style={styles.avatarWrapper}>
<View style={styles.overflowCount}>
<Text variant="text-sm/semibold">
+
{count2}
</Text>
</View>
</View>;
};
GroupMemberAvatar = function GroupMemberAvatar(props) {
const { guildId, user } = props;
const styles = useStyles(MobileVisualRefreshExperiment("GroupAvatar"));
const memo = useMemo(() => user == null ? void 0 : user.getAvatarSource(guildId, false, 32), [guildId, user]);
return memo != null ? <View style={styles.avatarWrapper}>
<FastImage style={styles.avatar} source={memo} />
</View> : null;
};
width = 38;
SPRING_OPTIONS_SCALE = {
damping: 30,
stiffness: 400
};
SPRING_OPTIONS_POSITION = {
damping: 30,
stiffness: 400
};
useStyles = createStyles((a0) => {
const shadowContainer = {
borderRadius: Module712.radii.sm,
shadowColor: a0 ? void 0 : Module712.colors.BLACK,
shadowOffset: a0 ? void 0 : {
width: 0,
height: 0
},
shadowRadius: a0 ? void 0 : 5,
shadowOpacity: a0 ? void 0 : 0.2,
elevation: a0 ? void 0 : 10
};
const backgroundColor = a0 ? void 0 : Module712.colors.CARD_BACKGROUND_DEFAULT;
const backgroundColor2 = a0 ? void 0 : Module712.colors.WHITE;
const backgroundColor3 = a0 ? void 0 : Module712.colors.WHITE;
const gradientContainer = {
width: Module712.modules.mobile.GROUP_AVATAR_SIZE,
height: Module712.modules.mobile.GROUP_AVATAR_SIZE,
overflow: "hidden",
borderRadius: Module712.radii.sm,
backgroundColor: a0 ? void 0 : Module712.colors.CARD_BACKGROUND_DEFAULT
};
return {
groupContainer: {
position: "relative"
},
shadowContainer,
shadowContainerBackground: {
backgroundColor
},
shadowContainerBackgroundLight: {
backgroundColor: backgroundColor2,
opacity: 0.4
},
shadowContainerBackgroundDark: {
backgroundColor: backgroundColor3,
opacity: 0.15
},
gradientContainer,
gradientDimOverlay: {
position: "absolute",
left: 0,
top: 0,
right: 0,
bottom: 0,
backgroundColor: a0 ? void 0 : Module712.colors.BACKGROUND_MOD_SUBTLE
},
gradientImageBorder: {
width: Module712.modules.mobile.GROUP_AVATAR_SIZE,
height: Module712.modules.mobile.GROUP_AVATAR_SIZE,
borderRadius: Module712.radii.sm,
borderWidth: a0 ? void 0 : 1,
borderColor: a0 ? void 0 : Module712.colors.BORDER_SUBTLE,
position: "absolute"
},
avatarContainer: {
position: "absolute",
top: "50%",
left: "50%",
width,
height: width,
marginTop: -19,
marginLeft: -19
},
shadow: {
shadowColor: a0 ? void 0 : Module712.colors.BLACK,
shadowOpacity: a0 ? void 0 : DARK_03_LIGHT_02,
shadowOffset: a0 ? void 0 : {
width: 0,
height: 3
},
shadowRadius: a0 ? void 0 : 2
},
avatar: {
width: 32,
height: 32,
position: "absolute",
borderRadius: 16
},
avatarWrapper: {
position: "absolute",
width,
height: width,
justifyContent: "center",
alignItems: "center",
borderRadius: 19,
backgroundColor: a0 ? void 0 : Module712.colors.BACKGROUND_BASE_LOWER
},
overflowCount: {
width,
height: width,
position: "absolute",
borderRadius: 19,
backgroundColor: a0 ? Module712.colors.BACKGROUND_MOD_SUBTLE : Module712.colors.BACKGROUND_BASE_LOWER,
display: "flex",
alignItems: "center",
justifyContent: "center"
}
};
});
c8272_13 = [[{
translateY: 0,
translateX: 0,
scale: 1
}, {
translateY: 0,
translateX: 0,
scale: 0
}, {
translateY: 0,
translateX: 0,
scale: 0
}, {
translateY: 0,
translateX: 0,
scale: 0
}], [{
translateY: -14,
translateX: -14,
scale: 0.75
}, {
translateY: 12,
translateX: 12,
scale: 0.875
}, {
translateY: 0,
translateX: 0,
scale: 0
}, {
translateY: 0,
translateX: 0,
scale: 0
}], [{
translateY: -4,
translateX: 16,
scale: 0.75
}, {
translateY: 14,
translateX: -14,
scale: 0.875
}, {
translateY: -18,
translateX: -12,
scale: 0.625
}, {
translateY: 0,
translateX: 0,
scale: 0
}], [{
translateY: -14,
translateX: -14,
scale: 0.875
}, {
translateY: 14,
translateX: 14,
scale: 0.875
}, {
translateY: -18,
translateX: 18,
scale: 0.625
}, {
translateY: 18,
translateX: -18,
scale: 0.625
}]];
__initData = {
code: "function GroupAvatarTsx1(){const{withTiming,opacityAnimation,useReducedMotion,translateXAnimation,withSpring,SPRING_OPTIONS_POSITION,translateYAnimation,scaleAnimation,SPRING_OPTIONS_SCALE}=this.__closure;return{opacity:withTiming(opacityAnimation.get()),transform:[{translateX:useReducedMotion?translateXAnimation.get():withSpring(translateXAnimation.get(),SPRING_OPTIONS_POSITION)},{translateY:useReducedMotion?translateYAnimation.get():withSpring(translateYAnimation.get(),SPRING_OPTIONS_POSITION)},{scale:useReducedMotion?scaleAnimation.get():withSpring(scaleAnimation.get(),SPRING_OPTIONS_SCALE)}]};}"
};
export default function GroupAvatar(props) {
let c19351_3, count, c19351_5, animateOnMount;
const { users, guildId: guildId2 } = props;
c19351_3 = void 0;
count = void 0;
c19351_5 = void 0;
animateOnMount = void 0;
const styles = useStyles(MobileVisualRefreshExperiment("GroupAvatar"));
const themeContext = useThemeContext();
const { theme, primaryColor } = themeContext;
let r34 = isThemeLight(theme) ? styles.shadowContainerBackgroundLight : styles.shadowContainerBackgroundDark;
const ref = useRef(false);
useEffect(() => {
ref.current = true;
}, []);
const r49 = c8272_13[Math.max(0, Math.min(c8272_13.length - 1, users.length - 1))];
c19351_3 = users.length > 4;
count = users.length - 3;
c19351_5 = 10 <= count ? 1 : 2;
animateOnMount = useRefValue(ref);
const r62 = r49.map((item, index) => {
const user2 = users[index];
return user2 != null ? createElement(AnimatedContainer, {
...item,
key: user2.id,
animateOnMount,
shadow: users.length >= 2
}, c19351_3 && index === c19351_5 ? <GroupMemberCount count={count} /> : <GroupMemberAvatar guildId={guildId2} user={user2} />) : null;
});
const style = [styles.shadowContainer, ,];
if (primaryColor == null) {
r34 = styles.shadowContainerBackground;
}
style[1] = r34;
return <View style={styles.groupContainer}>
<View style={style}>
<View style={styles.gradientContainer}>
{primaryColor == null && <View style={styles.gradientDimOverlay} />}
</View>
<View style={styles.gradientImageBorder} />
</View>
{r62}
</View>;
};
@@ -0,0 +1,295 @@
// Metro module 9118 (f9119).
import * as Module19 from "react";
import { useMemo, useLayoutEffect } from "react";
import { View, Platform } from "react-native";
import { MIN_HEADER_HEIGHT } from "./MainTabsV2Constants";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { Text, TextStyleSheet } from "../../../../design/components/Text/native/Text";
import { useToken } from "../../../../design/tokens/native/useToken";
import HeaderDebugOverlay_native from "../../../devtools/design_toggles/HeaderDebugOverlay.native";
import { HeaderBackButton } from "../../../../_bundle/Module5150";
import { isAndroid } from "../../../../utils/PlatformUtils";
import PressableNavigatorModalIcon from "./navigator/PressableNavigatorModalIcon";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { useTheme } from "../../../../_bundle/Module1481";
import { useGradientTop } from "../../../client_themes/native/ClientThemesOverrides";
import { DeprecatedLayoutAnimation } from "../../../animations/native/DeprecatedLayoutAnimation";
import shallowEqual from "../../../../_bundle/shallowEqual";
import ChannelActions from "../channel/ChannelActions";
import ChannelHeader from "../channel/header/ChannelHeader";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { Icon } from "../../../../design/void/native";
function $mk81897($env) {
return (a0) => {
const r1 = $env.$parent;
return r1[6]((0, r1[0])(r1[2][10]).PressableNavigatorBackIcon, {
...a0,
navigation: $env[0]
});
};
}
let renderGenericTitle, HeaderTextButton, HeaderChannelActions, useStyles, HeaderInner;
let env5977 = {};
export function GenericHeaderTitle(props) {
let token, c16967_5;
const { title, subtitle, color: color2 = "mobile-text-heading-primary", subtitleColor: _subtitleColor, icon, maxFontSizeMultiplier: _maxFontSizeMultiplier, ...rest } = props;
const color = color2;
const { subtitleColor = "text-default", maxFontSizeMultiplier: maxFontSizeMultiplier2 = 2 } = props;
const maxFontSizeMultiplier = maxFontSizeMultiplier2;
token = void 0;
c16967_5 = void 0;
const token2 = useToken(Module712.modules.mobile.HEADER_TITLE_TEXT_STYLE);
let variant = rest.variant;
if (variant == null) {
variant = token2;
}
const renderTitleContainer = function renderTitleContainer(a0) {
let r23;
if (icon != null) {
r23 = <View accessible accessibilityRole={a0} style={c16967_5.titleContainer}>
{icon}
{(0, jsx)(Text, {
lineClamp: 1,
variant: token,
color,
style: c16967_5.headerText,
maxFontSizeMultiplier,
children: title
})}
</View>;
} else {
r23 = (0, jsx)(Text, {
accessibilityRole: a0,
lineClamp: 1,
variant: token,
color,
style: c16967_5.headerText,
maxFontSizeMultiplier,
children: title
});
}
return r23;
};
token = variant;
const styles = useStyles();
c16967_5 = styles;
const r37 = HeaderDebugOverlay_native("os-drawn");
return subtitle == null && r37 == null ? renderTitleContainer("header") : <View accessible accessibilityRole="header">
{renderTitleContainer(subtitle != null ? void 0 : "header")}
{subtitle != null ? (0, jsx)(Text, {
lineClamp: 1,
variant: "text-xs/medium",
color: subtitleColor,
style: styles.subtitleText,
maxFontSizeMultiplier,
children: subtitle
}) : null}
{r37}
</View>;
}
renderGenericTitle = function renderGenericTitle(a0) {
return (0, jsx)(GenericHeaderTitle, {
title: a0.children
});
};
HeaderTextButton = function HeaderTextButton(props) {
const { labelStyle, ...props2 } = props;
return <HeaderBackButton labelStyle={[useStyles().backButtonLabel, labelStyle]} labelVisible backImage={() => null} truncatedLabel={props2.label} accessibilityLabel={props2.label} {...props2} />;
};
HeaderChannelActions = function HeaderChannelActions(props) {
const { route: route2, screenIndex: screenIndex2 } = props;
return <ChannelActions containerStyle={useStyles().headerRightContainer} {...route2.params} screenIndex={screenIndex2} />;
};
Platform;
useStyles = createStyles({
headerRightContainer: {
marginRight: 16
},
headerWrapper: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
flexDirection: "row",
alignItems: "center",
flexShrink: 0,
flexGrow: 1,
borderColor: Module712.colors.MOBILE_HEADER_BORDER,
borderBottomWidth: 1
},
actionButtonPressable: {
padding: 8,
zIndex: 100,
width: 40,
height: 40,
borderRadius: 20
},
actionButtonIcon: {
tintColor: Module712.colors.MOBILE_HEADER_ICON_DEFAULT
},
headerText: {
textAlign: "center",
fontSize: 18
},
subtitleText: {
textAlign: "center"
},
backButtonLabel: {
...TextStyleSheet["text-md/semibold"],
color: Module712.colors.TEXT_BRAND
},
titleContainer: {
flexDirection: "row",
alignItems: "center",
gap: Module712.space.PX_8
}
});
HeaderInner = Module19.memo(function HeaderInner(props) {
const { navigation: navigation3, options, back, route: route2, shouldHandleSafeArea = true, style } = props;
const styles = useStyles();
let c16969_1 = styles;
const top2 = useSafeAreaInsets_native().top;
const top = shouldHandleSafeArea ? top2 : 0;
let headerLeft = options.headerLeft;
if (headerLeft === void 0) {
let env16970;
const r27 = env16970 = {
$parent: env5977
};
env16970[0] = navigation3;
headerLeft = $mk81897(r27);
}
let headerTitle2 = options.headerTitle;
const headerRight2 = options.headerRight;
const text = useTheme().colors.text;
const gradientTop = useGradientTop();
const memo = useMemo(() => [c16969_1.headerWrapper, gradientTop, {
paddingTop: top,
minHeight: top + MIN_HEADER_HEIGHT
}, style], [top, gradientTop, styles, style]);
const r41 = typeof headerTitle2 !== "string" ? headerTitle2 == null ? renderGenericTitle : headerTitle2 : renderGenericTitle;
const r45 = HeaderDebugOverlay_native("custom-drawn");
useLayoutEffect(() => DeprecatedLayoutAnimation({
duration: 0
}));
const r59 = [headerLeft({
label: back?.title,
canGoBack: navigation3.isFocused() && navigation3.canGoBack(),
tintColor: text
}), , , ,];
if (typeof headerTitle2 !== "string") {
let title2 = options.title;
if (title2 == null) {
title2 = route2.name;
}
headerTitle2 = title2;
}
r59[1] = r41({
children: headerTitle2,
tintColor: text
});
r59[2] = headerRight2 == null ? void 0 : headerRight2({
canGoBack: navigation3.isFocused() && navigation3.canGoBack(),
tintColor: text
});
r59[3] = r45;
return <View style={memo}>{r59}</View>;
}, (a0, a1) => {
let r11 = !!shallowEqual(a0, a1, ["back"]);
if (r11) {
let back = a0.back;
if (back == null) {
back = {};
}
let back2 = a1.back;
if (back2 == null) {
back2 = {};
}
r11 = shallowEqual(back, back2);
}
return r11;
});
export { renderGenericTitle };
export { HeaderTextButton };
export function getRenderHeaderTextButton(label, onPress) {
return function(a0) {
return <HeaderTextButton label={label} onPress={onPress} {...a0} />;
};
}
export function renderHeader(a0) {
return <HeaderInner {...a0} />;
}
export function getRenderBackImage(a0) {
let env16968;
const r0 = env16968 = {
$parent: env5977
};
env16968[0] = a0;
return $mk81897(r0);
}
export function getRenderModalBackImage(navigation) {
if (isAndroid()) {
return void 0;
}
return () => (0, jsx)(PressableNavigatorModalIcon, {
navigation
});
}
export function getRenderModalCloseImage(navigation2) {
if (isAndroid()) {
return void 0;
}
return () => (0, jsx)(PressableNavigatorModalIcon, {
navigation: navigation2,
type: "close"
});
}
export { HeaderInner as Header };
export function getDefaultStackHeaderProps(a0) {
let env16974;
const r1 = env16974 = {
$parent: env5977
};
env16974[0] = a0;
return {
headerLeft: $mk81897(r1),
headerTitle: renderGenericTitle,
headerBackVisible: false
};
}
export function getDefaultChannelStackHeaderProps(a0, route) {
let screenIndex;
let r9 = a0.getState().routes.findIndex((a0) => a0.key === route.key);
if (r9 == null) {
r9 = "none";
}
let env16976;
screenIndex = r9;
const r10 = env16976 = {
$parent: env5977
};
env16976[0] = a0;
return {
headerLeft: $mk81897(r10),
headerTitle: function headerTitle() {
return <ChannelHeader {...route.params} isNavigationScreen screenIndex={screenIndex} />;
},
headerRight: function headerRight() {
return (0, jsx)(HeaderChannelActions, {
route,
screenIndex
});
},
headerBackVisible: false
};
}
export function HeaderIconButton(props) {
const { accessibilityLabel, onPress: onPress2, source, resizeMode } = props;
let color2 = props.color;
const styles = useStyles();
if (color2 == null) {
color2 = styles.actionButtonIcon.tintColor;
}
return <PressableOpacity accessibilityRole="button" accessibilityLabel={accessibilityLabel} style={styles.actionButtonPressable} onPress={onPress2}>
<Icon color={color2} source={source} resizeMode={resizeMode} />
</PressableOpacity>;
}
@@ -0,0 +1,127 @@
// Metro module 10125 (f10126).
import { memo, useCallback } from "react";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { isAndroid } from "../../../../utils/PlatformUtils";
import * as _native from "../../../../design/void/native";
import { Icon } from "../../../../design/void/native";
import MobileVisualRefreshExperiment from "../../../themes/experiments/MobileVisualRefreshExperiment";
import { useFontScale } from "../../../screen/native/useFontScale";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { Text } from "../../../../design/components/Text/native/Text";
import Badge, { CHANNEL_BADGE_SIZE } from "./Badge";
let useStyles, Component;
const ButtonBadge = function ButtonBadge(props) {
let badgePosition = props.badgePosition;
if (badgePosition === void 0) {
badgePosition = "left";
}
const styles2 = useStyles(false);
return <Badge size={CHANNEL_BADGE_SIZE} maskSize={2} style={badgePosition === "left" ? styles2.unreadBadgeLeft : styles2.unreadBadgeRight} maskColor={styles2.unreadBadgeMask.color} />;
};
useStyles = createStyles((a0) => ({
actionIconButtonPressable: {
minWidth: 32,
minHeight: 32,
borderRadius: 20,
marginEnd: 12,
display: "flex",
alignItems: "center",
justifyContent: "center",
flexDirection: "row",
paddingRight: 12,
paddingLeft: 12
},
withoutMargin: {
marginEnd: 0
},
filled: {
backgroundColor: a0 ? void 0 : Module712.colors.REDESIGN_BUTTON_TERTIARY_BACKGROUND
},
outlined: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
borderWidth: 1,
borderColor: Module712.colors.INPUT_BACKGROUND_DEFAULT,
...Module712.shadows.SHADOW_LOW
},
roundButton: {
maxWidth: 32,
maxHeight: 32
},
actionIcon: {
tintColor: a0 ? Module712.colors.ICON_SUBTLE : Module712.colors.INTERACTIVE_TEXT_DEFAULT
},
actionText: {
marginLeft: 4,
marginTop: isAndroid() ? -2 : 0
},
unreadBadgeLeft: {
position: "absolute",
left: -2,
top: -1
},
unreadBadgeRight: {
position: "absolute",
right: -2,
top: -1
},
unreadBadgeMask: {
color: Module712.colors.BACKGROUND_BASE_LOW
},
countStyle: {
position: "relative",
marginLeft: Module712.space.PX_8
}
}));
Component = memo(function(a0) {
let r16;
const { IconComponent, source } = a0;
let color2 = a0.color;
const color = color2;
const isRefreshEnabled = a0.isRefreshEnabled;
const styles = useStyles(isRefreshEnabled);
const callback = useCallback(() => {
const r0 = source != null;
let r2 = null;
if (r0) {
let color2 = color;
if (color == null) {
color2 = styles.actionIcon.tintColor;
}
r2 = <Icon size={Icon.Sizes.SMALL} source={source} color={color2} />;
}
return r2;
}, [styles, color, source]);
if (IconComponent != null) {
if (isRefreshEnabled) {
color2 = Module712.colors.ICON_SUBTLE;
}
r16 = <IconComponent size="sm" color={color2} />;
} else {
r16 = callback();
}
return r16;
});
export default function IconActionButton(props) {
const { source: source2, IconComponent, variant = "filled", color: color2, buttonText, accessibilityLabel, style } = props;
let badge = props.badge;
const { badgePosition = "left", count = 0, noMargin, hitSlop, disabled, onPress, onLongPress } = props;
const isRefreshEnabled = MobileVisualRefreshExperiment("IconActionButton");
const styles2 = useStyles(isRefreshEnabled);
const fontScale = useFontScale();
let r16 = buttonText != null && !(fontScale > 1.2);
const style2 = [styles2.actionIconButtonPressable, variant === "outlined" ? styles2.outlined : styles2.filled, r16 ? void 0 : styles2.roundButton, noMargin ? styles2.withoutMargin : void 0, style];
const r50 = [<Component IconComponent={IconComponent} color={color2} source={source2} isRefreshEnabled={isRefreshEnabled} />, , , ,];
if (r16) {
r16 = <Text variant="text-sm/bold" style={styles2.actionText}>{buttonText}</Text>;
}
r50[1] = r16;
r50[2] = count > 0 ? <_native.Badge style={styles2.countStyle} value={count} /> : null;
if (badge) {
badge = <ButtonBadge badgePosition={badgePosition} />;
}
r50[3] = badge;
return <PressableOpacity hitSlop={hitSlop} onPress={onPress} onLongPress={onLongPress} disabled={disabled} accessibilityRole="button" accessibilityLabel={accessibilityLabel} style={style2}>{r50}</PressableOpacity>;
};
export const ICON_ACTION_BUTTON_SIZE = 32;
export { ButtonBadge };
@@ -0,0 +1,10 @@
// Metro module 9119 (f9120).
import { StyleSheet } from "react-native";
import { isMobileVisualRefreshEnabled } from "../../../themes/experiments/MobileVisualRefreshExperiment";
const r17 = 2 * StyleSheet.hairlineWidth;
export const MIN_HEADER_HEIGHT = 56;
export const HEADER_CORNER_RADIUS = 8;
export function getMinHeaderHeight(a0) {
return isMobileVisualRefreshEnabled(a0) ? 64 : 56;
}
export { r17 as MIDNIGHT_BORDER_WIDTH };
@@ -0,0 +1,35 @@
// Metro module 9123 (f9124).
import { useMemo } from "react";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import * as _native from "../../../../design/void/native";
import Badge from "./Badge";
const useStyles = createStyles({
maskStyle: {
position: "relative",
right: void 0
},
unreadDot: {
width: 0,
height: 0
},
badgeStyle: {
flexGrow: 1,
flexShrink: 0
},
unreadBadge: {
position: "relative",
bottom: -3
},
lowPriorityBadge: {
backgroundColor: Module712.unsafe_rawColors.PRIMARY_400
}
});
export default function MaskedBadge(props) {
const { backgroundColor, unread, value, maxValue, lowPriority, size, style } = props;
const styles = useStyles();
const memo = useMemo(() => ({
backgroundColor
}), [backgroundColor]);
return value > 0 ? <_native.MaskedBadge maskStyle={[memo, styles.maskStyle]} dotStyle={styles.unreadDot} style={[styles.badgeStyle, lowPriority ? styles.lowPriorityBadge : null, style]} value={value} maxValue={maxValue} /> : unread ? <Badge size={size} maskColor={backgroundColor} style={styles.unreadBadge} /> : null;
};
@@ -0,0 +1,56 @@
// Metro module 15025 (f15026).
import { useRef, useEffect } from "react";
import { View } from "react-native";
import MessageRequestStore from "../../../message_request/MessageRequestStore";
import SpamMessageRequestStore from "../../../message_request/SpamMessageRequestStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { MessageRequestLottie } from "../../../../design/components/LottieIcon/native/generated/index";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { intl, t } from "../../../../intl/index.native";
import { IconButton } from "../../../../design/components/Button/native/IconButton.native";
import IconActionButton, { ButtonBadge } from "./IconActionButton";
import Module11841 from "../../../../_bundle/Module11841";
let useStyles, $mk95121 = function() {
return () => MessageRequestStore.getMessageRequestsCount();
}, $mk95122 = function() {
return () => SpamMessageRequestStore.getSpamChannelsCount();
};
const MessageRequestAnimation = function MessageRequestAnimation(props) {
const color = props.color;
const ref = useRef(null);
const stateFromStores2 = useStateFromStores([MessageRequestStore], $mk95121());
useStateFromStores([SpamMessageRequestStore], $mk95122());
const stateFromStores = stateFromStores2;
useEffect(() => {
if (stateFromStores > 0 && ref != null) {
const current = ref.current;
if (current != null) {
current.play();
}
}
}, [stateFromStores]);
return <MessageRequestLottie ref={ref} color={color} size="sm" autoPlay />;
};
useStyles = createStyles({
buttonContainer: {
position: "relative"
}
});
export default function MessageRequestsButton(props) {
const { alternateVariant = false, ...props2 } = props;
const styles = useStyles();
const stateFromStores2 = useStateFromStores([MessageRequestStore], $mk95121());
const stateFromStores3 = useStateFromStores([SpamMessageRequestStore], $mk95122());
if (stateFromStores2 === 0 && stateFromStores3 === 0) {
return null;
}
if (alternateVariant) {
const text = stateFromStores2 > 0 ? stateFromStores2.toString() : void 0;
return <View style={styles.buttonContainer} collapsable={false}>
{text != null ? <Button icon={<MessageRequestAnimation />} variant="secondary" text={text} size="sm" accessibilityLabel={intl.string(t.e7GWjQ)} {...props2} /> : <IconButton variant="secondary" size="sm" icon={<MessageRequestAnimation />} accessibilityLabel={intl.string(t.e7GWjQ)} {...props2} />}
{stateFromStores2 > 0 && <ButtonBadge badgePosition="right" />}
</View>;
}
return <IconActionButton source={Module11841} IconComponent={MessageRequestAnimation} accessibilityLabel={intl.string(t.e7GWjQ)} buttonText={stateFromStores2 > 0 ? stateFromStores2.toString() : void 0} badge={stateFromStores2 > 0} badgePosition="right" {...props2} />;
};
@@ -0,0 +1,55 @@
// Metro module 10099 (f10100).
import { forwardRef } from "react";
import { View, StyleSheet } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { NAV_BAR_HEIGHT } from "../../../../design/components/Navigator/native/NavigatorConstants.native";
import Module712 from "../../../../_bundle/Module712";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { intl, t } from "../../../../intl/index.native";
import { isAndroid } from "../../../../utils/PlatformUtils";
import { ArrowLargeLeftIcon } from "../../../../design/components/Icon/native/redesign/generated/ArrowLargeLeftIcon";
import { Text } from "../../../../design/components/Text/native/Text";
import { SearchField } from "../../../../design/components/TextField/native/SearchField.native";
const useStyles = createStyles({
container: {
flexDirection: "row",
alignItems: "center",
height: NAV_BAR_HEIGHT,
paddingHorizontal: Module712.space.PX_16,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
borderBottomWidth: StyleSheet.hairlineWidth,
borderColor: Module712.colors.BORDER_STRONG
},
cancelText: {
paddingLeft: Module712.space.PX_16
},
cancelIcon: {
marginRight: Module712.space.PX_16
},
flex: {
flex: 1
}
});
const r58 = forwardRef(function({ onClose, ...props }, a1) {
const styles = useStyles();
const r53 = <PressableOpacity accessibilityRole="button" accessibilityLabel={intl.string(t["ETE/oC"])} onPress={onClose} hitSlop={{
top: 8,
right: 8,
bottom: 8,
left: 8
}}>
{isAndroid() ? <ArrowLargeLeftIcon style={styles.cancelIcon} /> : <Text style={styles.cancelText} maxFontSizeMultiplier={2} variant="text-md/semibold" color="mobile-text-heading-primary">
{intl.string(t["ETE/oC"])}
</Text>}
</PressableOpacity>;
return <View style={styles.container}>
{isAndroid() ? r53 : null}
<View style={styles.flex}>
<View>
<SearchField size="md" isRound ref={a1} {...props} />
</View>
</View>
{isAndroid() ? null : r53}
</View>;
});
export default r58;
@@ -0,0 +1,36 @@
// Metro module 11469 (f11470).
import { Pressable } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { MagnifyingGlassIcon } from "../../../../design/components/Icon/native/redesign/generated/MagnifyingGlassIcon";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
const useStyles = createStyles({
searchButton: {
backgroundColor: Module712.colors.INPUT_BACKGROUND_DEFAULT,
height: 40,
alignItems: "center",
flexDirection: "row",
paddingHorizontal: 12
},
roundedCorners: {
borderRadius: 20
},
roundedCornersAlt: {
borderRadius: Module712.radii.round
},
text: {
marginLeft: 8
}
});
export const SEARCH_BAR_HEIGHT = 40;
export function SearchButtonContent(props) {
const { panelVariant, ...props2 } = props;
const styles = useStyles();
return <Pressable {...props2} style={[styles.searchButton, panelVariant ? styles.roundedCornersAlt : styles.roundedCorners, props2.style]}>
<MagnifyingGlassIcon size="xs" />
<Text variant="text-sm/medium" color="text-muted" style={styles.text} maxFontSizeMultiplier={2}>
{intl.string(t["5h0QOP"])}
</Text>
</Pressable>;
}
@@ -0,0 +1,62 @@
// Metro module 12022 (f12023).
import * as _spring from "../../../../../design/animation/reanimated/spring/spring";
let c8262_2 = {
damping: 35,
stiffness: 275,
mass: 1,
overshootClamping: true,
restSpeedThreshold: 0.001,
restDisplacementThreshold: 0.001
};
const n = function n() {
return {
initialValues: {
transform: [{
scale: 0
}],
opacity: 0
},
animations: {
transform: [{
scale: _spring.withSpring(1, c8262_2)
}],
opacity: _spring.withSpring(1, c8262_2)
}
};
};
n.__closure = {
withSpring: _spring.withSpring,
CHANNEL_SPRING_CONFIG: c8262_2
};
n.__workletHash = 5885186288311;
n.__initData = {
code: "function ChannelAnimationConstantsTsx1(){const{withSpring,CHANNEL_SPRING_CONFIG}=this.__closure;return{initialValues:{transform:[{scale:0}],opacity:0},animations:{transform:[{scale:withSpring(1,CHANNEL_SPRING_CONFIG)}],opacity:withSpring(1,CHANNEL_SPRING_CONFIG)}};}"
};
const t = function t() {
return {
initialValues: {
transform: [{
scale: 1
}],
opacity: 1
},
animations: {
transform: [{
scale: _spring.withSpring(0, c8262_2)
}],
opacity: _spring.withSpring(0, c8262_2)
}
};
};
t.__closure = {
withSpring: _spring.withSpring,
CHANNEL_SPRING_CONFIG: c8262_2
};
t.__workletHash = 1746051409364;
t.__initData = {
code: "function ChannelAnimationConstantsTsx2(){const{withSpring,CHANNEL_SPRING_CONFIG}=this.__closure;return{initialValues:{transform:[{scale:1}],opacity:1},animations:{transform:[{scale:withSpring(0,CHANNEL_SPRING_CONFIG)}],opacity:withSpring(0,CHANNEL_SPRING_CONFIG)}};}"
};
export const MESSAGE_PREVIEW_DELAY = 350;
export { c8262_2 as CHANNEL_SPRING_CONFIG };
export { n as TYPING_ENTERING };
export { t as TYPING_EXITING };
@@ -0,0 +1,148 @@
// Metro module 15498 (f15499).
import * as Module19 from "react";
import { View } from "react-native";
import { SUBTITLE_OPACITY_NORMAL } from "../../../../channel_list_v2/native/RedesignChannelListConstants";
import { UnreadSetting } from "../../../../read_states/ReadStateConstants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import { isIOS, isAndroid } from "../../../../../utils/PlatformUtils";
import { getLayoutStyles } from "./layouts/ChannelListLayout";
import isRoleRequired from "../../../../channel/isRoleRequired";
import ChannelTitle from "./ChannelTitle";
import { LockIcon } from "../../../../../design/components/Icon/native/redesign/generated/LockIcon";
import { WarningIcon } from "../../../../../design/components/Icon/native/redesign/generated/WarningIcon";
import GuildRoleSubscriptionGatedChannelIcon from "../../../../guild_role_subscriptions/native/premium_channel/GuildRoleSubscriptionGatedChannelIcon";
import { Text } from "../../../../../design/components/Text/native/Text";
let useStyles;
const ChannelContentComponent = function ChannelContentComponent(props) {
const { name, subtitle, unread } = props;
let resolvedUnreadSetting = props.resolvedUnreadSetting;
let locked = props.locked;
const { muted, lastMessageTimestampString, channel, connected, layout } = props;
let mentionCount = props.mentionCount;
const mentionBadge = props.mentionBadge;
let isSubscriptionGated = props.isSubscriptionGated;
const needSubscriptionToAccess = props.needSubscriptionToAccess;
const styles = useStyles();
const styles2 = getLayoutStyles(layout);
let r32 = channel != null;
if (r32) {
if (!locked) {
locked = isRoleRequired(channel);
}
r32 = locked;
}
let r29 = channel == null ? void 0 : channel.isNSFW();
const isValidElement = Module19.isValidElement(subtitle);
let r18 = lastMessageTimestampString != null;
let r14 = r18 ? mentionBadge == null : r18;
const style = [styles.leftBox, {
justifyContent: isValidElement ? "space-between" : "center"
}];
const paddingRight = r14 ? 30 : 0;
if (resolvedUnreadSetting == null) {
resolvedUnreadSetting = UnreadSetting.ONLY_MENTIONS;
}
const r61 = [<ChannelTitle title={name} muted={muted} unread={unread} resolvedUnreadSetting={resolvedUnreadSetting} connected={connected} layout={layout} />, ,];
let r62 = r32 ? r32 : r29;
if (r62) {
const style2 = [styles.channelTraits, {
maxWidth: 14 * (r32 ? r29 ? 2 : 1 : 1)
}];
if (r32) {
r32 = <LockIcon size="xxs" color="icon-muted" style={styles.channelTraitIcon} />;
}
const r75 = [r32, , ,];
if (r29) {
r29 = <WarningIcon size="xxs" color="icon-muted" style={styles.channelTraitIcon} />;
}
r75[1] = r29;
if (isSubscriptionGated) {
isSubscriptionGated = <GuildRoleSubscriptionGatedChannelIcon locked={needSubscriptionToAccess} isInMainTabsExperiment />;
}
r75[2] = isSubscriptionGated;
r62 = <View style={style2}>{r75}</View>;
}
r61[1] = r62;
const r85 = [<View style={{
flexDirection: "row",
paddingRight,
alignItems: "center"
}}>{r61}</View>, ,];
let r86 = null;
if (isValidElement) {
if (mentionCount == null) {
mentionCount = 0;
}
r86 = <View style={[{
paddingRight: mentionCount > 0 ? 20 : 0
}, {
marginTop: styles2.messagePreview.margin.marginTop
}]}>{subtitle}</View>;
}
r85[1] = r86;
const r97 = [<View style={style}>{r85}</View>, ,];
const style3 = r14 ? styles.rightContentAbsolute : styles.rightBox;
const r106 = [r18 ? <Text variant="text-xs/medium" color="text-muted" style={{
marginLeft: "auto"
}} maxFontSizeMultiplier={1.75}>{lastMessageTimestampString}</Text> : r18, , ,];
const style4 = [{
alignItems: "center",
paddingLeft: 4
}, ,];
if (r18) {
r18 = {
marginTop: 5
};
}
style4[1] = r18;
r106[1] = <View style={style4}>{mentionBadge}</View>;
if (r14) {
r14 = <View style={{
flex: 1
}} />;
}
r106[2] = r14;
r97[1] = <View style={style3}>{r106}</View>;
return <View style={styles.channelContent}>
<View style={styles.channelContainer}>{r97}</View>
</View>;
};
useStyles = createStyles({
channelContent: {
flex: 1,
marginTop: isIOS() ? 2 : -1
},
channelContainer: {
display: "flex",
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between"
},
leftBox: {
flexDirection: "column",
alignItems: "flex-start",
flexShrink: 1
},
rightBox: {
flexDirection: "column",
alignItems: "flex-end"
},
rightContentAbsolute: {
position: "absolute",
right: 0,
top: 0
},
channelTraits: {
display: "flex",
flexDirection: "row",
alignItems: "center"
},
channelTraitIcon: {
opacity: SUBTITLE_OPACITY_NORMAL,
marginRight: 4,
marginTop: isAndroid() ? 2 : 0
}
});
export function renderChannelContent(a0) {
return <ChannelContentComponent {...a0} />;
}
@@ -0,0 +1,109 @@
// Metro module 15500 (f15501).
import { View } from "react-native";
import GuildStore from "../../../../../stores/GuildStore";
import RelationshipStore from "../../../../../stores/RelationshipStore";
import UserStore from "../../../../../stores/UserStore";
import { UnreadSetting } from "../../../../read_states/ReadStateConstants";
import getChannelA11yLabel from "../../../../channel/getChannelA11yLabel";
import { intl, t } from "../../../../../intl/index.native";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { getLayoutStyles, isLayoutCozy, makeSizeStyle } from "./layouts/ChannelListLayout";
import { useStateFromStores } from "../../../../../_bundle/Module589";
import GuildIcon from "../../../../guild/native/GuildIcon";
import { ChannelIcon } from "../../../../app_launcher/native/options/channel/AppLauncherChannelListActionSheet";
import { getRelativeTimestamp } from "../../../../notification_center/NotificationCenterUtils";
import { renderChannelWrapper } from "./ChannelWrapper";
import GroupDMAvatar from "../../../../group_dm/native/GroupDMAvatar";
import { renderChannelContent } from "./ChannelContent";
import { computeChannelName } from "../../../../channel/useChannelName";
let useStyles;
const LaunchpadChannelIcon = function LaunchpadChannelIcon(props) {
const { channel, layout } = props;
const styles = useStyles(layout);
const styles2 = getLayoutStyles(layout);
return <>
{[<View style={styles.guildBadgeIcon}>
<GuildIcon guild={useStateFromStores([GuildStore], () => GuildStore.getGuild(channel.guild_id))} size={styles2.icon.guildBadgeIconSize} />
</View>, <ChannelIcon channel={channel} size={isLayoutCozy(layout) ? "md" : "sm"} wrapperSize={isLayoutCozy(layout) ? 48 : 32} />]}
</>;
};
useStyles = createStyles((a0) => ({
guildBadgeIcon: {
position: "absolute",
zIndex: 1,
bottom: -4,
right: -4,
borderColor: Module712.colors.BACKGROUND_BASE_LOW,
borderWidth: 2,
borderRadius: isLayoutCozy(a0) ? 9 : 6
}
}));
export function getChannelAccessibilityProps(a0) {
const channel2 = a0.channel;
return {
accessible: true,
accessibilityRole: "button",
accessibilityLabel: getChannelA11yLabel({
channel: channel2,
unread: a0.unread,
mentionCount: a0.mentionCount,
voiceStates: a0.voiceStates,
embeddedActivitiesCount: a0.embeddedActivitiesCount
}),
...channel2.isGuildVoice() ? {
accessibilityHint: intl.string(t["9C444m"])
} : channel2.isGuildStageVoice() ? {
accessibilityHint: intl.string(t["9C444m"])
} : void 0
};
}
export function renderChannelItem(a0) {
const { channel: channel2, subtitle, unreadBadge, mentionBadge, locked = false, unread = false, resolvedUnreadSetting = UnreadSetting.ONLY_MENTIONS, live = false, muted = false, latestMessageTimestamp, layout, end, connected, mentionCount, launchpad } = a0;
let channelName = a0.channelName;
const { fontScale, isSubscriptionGated = false, needSubscriptionToAccess = false, panelVariant = false } = a0;
const lastMessageTimestampString = latestMessageTimestamp == null ? null : muted ? null : getRelativeTimestamp(latestMessageTimestamp);
const styles = getLayoutStyles(layout);
const r12 = [unreadBadge, <View style={{
position: "relative",
borderRadius: Module712.radii.round,
justifyContent: "center",
alignItems: "center",
flexShrink: 0,
flexGrow: 0,
...makeSizeStyle(styles.icon.wrapper.size),
...styles.icon.margin
}}>
{channel2.isGroupDM() ? <GroupDMAvatar channel={channel2} size={styles.icon.avatarSize} /> : <LaunchpadChannelIcon channel={channel2} layout={layout} />}
</View>, , ,];
if (channelName == null) {
channelName = computeChannelName(channel2, UserStore, RelationshipStore);
}
r12[2] = renderChannelContent({
layout,
name: channelName,
subtitle,
unread,
resolvedUnreadSetting,
muted,
lastMessageTimestampString,
channel: channel2,
locked,
connected,
live,
mentionCount,
mentionBadge,
isSubscriptionGated,
needSubscriptionToAccess
});
r12[3] = end != null ? <View style={{
paddingLeft: 8
}}>{end}</View> : null;
return renderChannelWrapper(<>{r12}</>, {
channel: channel2,
layout,
launchpad,
fontScale,
panelVariant
});
}
@@ -0,0 +1,13 @@
// Metro module 15310 (f15311).
import { View } from "react-native";
import { getLayoutStyles } from "./layouts/ChannelListLayout";
export function renderChannelPressableWrapper(a0, { layout, launchpad, isThread, panelVariant = false }) {
const layout2 = getLayoutStyles(layout, launchpad).layout;
return <View style={[isThread ? layout2.marginThread : panelVariant ? layout2.marginPanels : layout2.margin, {
flex: 1,
flexDirection: "row",
alignItems: "center"
}]}>
{a0}
</View>;
}
@@ -0,0 +1,40 @@
// Metro module 15494 (f15495).
import { getLayoutStyles } from "./layouts/ChannelListLayout";
import { Text } from "../../../../../design/components/Text/native/Text";
import { getChannelSubtitleData } from "../../../../channel/native/getChannelSubtitleData";
import { renderMessagePreviewMarkup } from "../../../../message_previews/native/MessagePreviewMarkup";
const ChannelSubtitle = function ChannelSubtitle(props) {
let muted = props.muted;
const { connected, channelId, guildId, layout, subtitle, textProps } = props;
const channelSubtitleData = getChannelSubtitleData(subtitle);
if (channelSubtitleData == null) {
return null;
}
const r22 = channelSubtitleData.type === "voice" && connected;
if (muted == null) {
muted = false;
}
return <Text {...textProps}>
{renderMessagePreviewMarkup({
content: channelSubtitleData.subtitle,
muted,
channelId,
guildId,
layout,
color: "text-muted",
disableAnimatedEmoji: !r22
})}
</Text>;
};
export function renderChannelSubtitle({ subtitle, muted, layout, channelId, guildId, connected }) {
if (subtitle == null) {
return null;
}
const props = {
variant: getLayoutStyles(layout).messagePreview.text.variant,
color: "text-muted",
lineClamp: 1,
maxFontSizeMultiplier: 1.75
};
return typeof subtitle === "string" ? <Text {...props}>{subtitle}</Text> : <ChannelSubtitle channelId={channelId} guildId={guildId} layout={layout} subtitle={subtitle} muted={muted} connected={connected} textProps={props} />;
}
@@ -0,0 +1,47 @@
// Metro module 15499 (f15500).
import * as Module19 from "react";
import { useMemo } from "react";
import { UnreadSetting } from "../../../../read_states/ReadStateConstants";
import { createStyleProperties } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { getLayoutStyles } from "./layouts/ChannelListLayout";
import { Text } from "../../../../../design/components/Text/native/Text";
const styleProperties = createStyleProperties({
muted: Module712.colors.TEXT_MUTED,
normal: Module712.colors.REDESIGN_CHANNEL_NAME_MUTED_TEXT,
unreadOrConnected: Module712.colors.REDESIGN_CHANNEL_NAME_TEXT
});
const r40 = Module19.memo(function ChannelTitle(props) {
let title = props.title;
const { muted, unread, resolvedUnreadSetting, connected, layout } = props;
const styles = getLayoutStyles(layout);
const r14 = styleProperties();
let c22084_4 = r14;
const memo = useMemo(() => {
let normal = c22084_4.normal;
if (muted) {
normal = c22084_4.muted;
} else {
let r7 = unread;
if (unread) {
r7 = resolvedUnreadSetting === UnreadSetting.ALL_MESSAGES;
}
if (!r7) {
r7 = connected;
}
if (r7) {
normal = c22084_4.unreadOrConnected;
}
}
return {
color: normal,
paddingRight: 4,
flexShrink: 1
};
}, [unread, r14, connected, muted, resolvedUnreadSetting]);
if (title == null) {
title = "";
}
return <Text variant={styles.channelName.text.variant} lineClamp={1} maxFontSizeMultiplier={1.75} style={memo}>{title}</Text>;
});
export default r40;
@@ -0,0 +1,39 @@
// Metro module 15030 (f15031).
import { memo } from "react";
import { View } from "react-native";
import { MUTED_OPACITY_CONTENT } from "../../../../channel_list_v2/native/RedesignChannelListConstants";
import { UnreadSetting } from "../../../../read_states/ReadStateConstants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import { getLayoutStyles, makeSizeStyle } from "./layouts/ChannelListLayout";
import { useFontScale } from "../../../../screen/native/useFontScale";
import Badge, { CHANNEL_BADGE_SIZE } from "../Badge";
const useStyles = createStyles({
unreadBadge: {
flexGrow: 0,
flexShrink: 0,
position: "absolute"
},
unreadBadgePanel: {
marginLeft: -16
}
});
const r36 = memo(function ChannelUnreadBadge(props) {
const { unread, resolvedUnreadSetting, muted, isThread, layout, launchpad, panelVariant = false } = props;
const styles2 = useStyles();
const styles = getLayoutStyles(layout, launchpad);
const fontScale = useFontScale();
let r24 = null;
if (unread) {
const style = [styles2.unreadBadge, panelVariant ? styles2.unreadBadgePanel : void 0, , ,];
const unreadBadge = styles.unreadBadge;
style[2] = isThread ? unreadBadge.positionThread : unreadBadge.position;
style[3] = makeSizeStyle(styles.unreadBadge.size);
r24 = <View style={style}>
<Badge classic={panelVariant} size={CHANNEL_BADGE_SIZE * Math.max(fontScale, 1)} badgeStyle={[{
opacity: resolvedUnreadSetting === UnreadSetting.ALL_MESSAGES ? muted ? MUTED_OPACITY_CONTENT : 1 : MUTED_OPACITY_CONTENT
}]} />
</View>;
}
return r24;
});
export default r36;
@@ -0,0 +1,23 @@
// Metro module 15311 (f15312).
import { View } from "react-native";
import { getScaledChannelRowHeight, getLayoutStyles } from "./layouts/ChannelListLayout";
export function renderChannelWrapper(a0, { channel, layout, fontScale, launchpad, panelVariant = false }) {
const scaledChannelRowHeight = getScaledChannelRowHeight(fontScale, layout, (channel == null ? void 0 : channel.isThread()) && !launchpad);
const styles = getLayoutStyles(layout, launchpad);
const r29 = channel == null ? void 0 : channel.isThread();
const layout2 = styles.layout;
const style = [{
flex: 1,
flexDirection: "row",
alignItems: "center",
position: "relative"
}, {
minHeight: scaledChannelRowHeight - (r29 ? 2 * layout2.marginThread.marginVertical : 2 * layout2.margin.marginVertical)
}, ,];
const r40 = channel == null ? void 0 : channel.isThread();
const container = styles.container;
style[2] = r40 ? container.paddingThread : panelVariant ? container.paddingPanels : container.padding;
return <View style={style}>
{a0}
</View>;
}
@@ -0,0 +1,98 @@
// Metro module 15495 (f15496).
import { memo } from "react";
import { View } from "react-native";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { getLayoutStyles } from "./layouts/ChannelListLayout";
import { Text } from "../../../../../design/components/Text/native/Text";
import { Avatar, Icon } from "../../../../../design/void/native";
import Module15496 from "../../../../../_bundle/Module15496";
const useStyles = createStyles((a0) => ({
container: {
flexDirection: "row",
alignItems: "center",
marginLeft: -2
},
overflowCircle: {
backgroundColor: Module712.colors.BACKGROUND_MOD_STRONG,
borderRadius: Module712.radii.round,
display: "flex",
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
height: a0,
width: a0
},
wrapper: {
borderRadius: Module712.radii.round,
borderColor: Module712.colors.BACKGROUND_BASE_LOW,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
borderWidth: 2
},
badge: {
borderRadius: Module712.radii.round,
paddingHorizontal: 8,
display: "flex",
flexDirection: "row",
alignItems: "center",
height: a0
},
audienceBadge: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER
}
}));
const r29 = memo(function VoiceOrStageSummaryRow(props) {
const { users, max = 5 } = props;
let c22083_0 = max;
const { guildId, layout, audienceCount } = props;
const styles = getLayoutStyles(layout);
const size = styles.voiceOrStageSummaryRow.size;
let c22083_3 = Math.max(users.length - max, 0);
const styles2 = useStyles(size);
return <View style={[styles2.container, {
height: size + 4
}]}>
{users.map((a0, index) => {
let r33;
if (index >= c22083_0) {
return void 0;
}
if (index === c22083_0 - 1) {
r33 = c22083_3 > 0 ? <View key="overflow" style={[styles2.wrapper, index !== 0 && {
marginLeft: -12
}]}>
<View style={styles2.overflowCircle}>
<Text variant="text-xs/medium">
{`+${c22083_3 + 1}`}
</Text>
</View>
</View> : <View key={index} style={[styles2.wrapper, index !== 0 && {
marginLeft: -12
}]}>
<Avatar user={a0} guildId={guildId} size={styles.voiceOrStageSummaryRow.avatarSize} />
</View>;
} else {
r33 = <View key={index} style={[styles2.wrapper, index !== 0 && {
marginLeft: -12
}]}>
<Avatar user={a0} guildId={guildId} size={styles.voiceOrStageSummaryRow.avatarSize} />
</View>;
}
return r33;
})}
{audienceCount != null && audienceCount > 0 && <View style={[styles2.wrapper, users.length > 0 && {
marginLeft: -12
}]}>
<View style={[styles2.badge, styles2.audienceBadge]}>
<Icon size={Icon.Sizes.CUSTOM} style={{
height: 14,
width: 14
}} source={Module15496} />
<Text variant="text-sm/bold" style={{
marginLeft: 4
}}>{audienceCount}</Text>
</View>
</View>}
</View>;
});
export default r29;
@@ -0,0 +1,46 @@
// Metro module 10285 (f10286).
import { ChannelListLayoutTypes } from "../../../../ChannelListLayoutTypes";
import { CHANNEL_LIST_STYLES_COZY_DRAWER, CHANNEL_LIST_STYLES_COZY_DRAWER_SMOL } from "./layout/CozyDrawer";
import { CHANNEL_LIST_STYLES_COMPACT_LAUNCHPAD, CHANNEL_LIST_STYLES_COMPACT } from "./layout/Compact";
import { CHANNEL_LIST_STYLES_COZY_LAUNCHPAD, CHANNEL_LIST_STYLES_COZY } from "./layout/Cozy";
import { ChannelListLayoutSetting } from "../../../../../user_settings/UserSettings";
const getLayoutStyles = function getLayoutStyles(a0, r4 = false) {
if (ChannelListLayoutTypes.COZY_DRAWER === a0) {
return CHANNEL_LIST_STYLES_COZY_DRAWER;
}
if (ChannelListLayoutTypes.COZY_DRAWER_SMOL === a0) {
return CHANNEL_LIST_STYLES_COZY_DRAWER_SMOL;
}
if (ChannelListLayoutTypes.COMPACT === a0) {
return r4 ? CHANNEL_LIST_STYLES_COMPACT_LAUNCHPAD : CHANNEL_LIST_STYLES_COMPACT;
}
if (ChannelListLayoutTypes.MINIMAL !== a0) {
ChannelListLayoutTypes.COZY;
}
return r4 ? CHANNEL_LIST_STYLES_COZY_LAUNCHPAD : CHANNEL_LIST_STYLES_COZY;
};
export { getLayoutStyles };
export function makeSizeStyle(a0) {
return {
width: a0,
height: a0
};
}
export function isLayoutCompact(a0) {
return a0 === ChannelListLayoutTypes.COMPACT;
}
export function isLayoutCozy(a0) {
return a0 === ChannelListLayoutTypes.COZY || a0 === ChannelListLayoutTypes.COZY_DRAWER || a0 === ChannelListLayoutTypes.COZY_DRAWER_SMOL;
}
export function useMessagesTabLayout(a0) {
const setting = ChannelListLayoutSetting.useSetting();
return a0 ? ChannelListLayoutTypes.COZY_DRAWER_SMOL : setting === ChannelListLayoutTypes.COMPACT ? ChannelListLayoutTypes.COMPACT : ChannelListLayoutTypes.COZY;
}
export function getScaledChannelRowHeight(a0, a1, r8 = false) {
const styles = getLayoutStyles(a1);
const r30 = Math.max(Math.max(a0, 1) * (styles.channelName.height + (styles.messagePreview.margin.marginTop + styles.messagePreview.height)), styles.icon.wrapper.size);
const container = styles.container;
const r36 = r30 + 2 * (r8 ? container.paddingThread.paddingVertical : container.padding.paddingVertical);
const layout = styles.layout;
return r36 + 2 * (r8 ? layout.marginThread.marginVertical : layout.margin.marginVertical) + (a1 === ChannelListLayoutTypes.COMPACT ? 4 : 0);
}
@@ -0,0 +1,222 @@
// Metro module 10288 (f10289).
import Module712 from "../../../../../../../_bundle/Module712";
import { AvatarSizes, IconSizes } from "../../../../../../../design/void/native";
import { GuildIconSizes } from "../../../../../../guild/native/GuildIcon";
import { GameIconSizes } from "../../../../../../game_detection/native/GameIcon";
import deepmerge from "../utils/deepmerge";
let c6871_2 = {
layout: {
margin: {
marginLeft: 4,
marginRight: 4,
marginVertical: 0
},
marginPanels: {
marginLeft: 8,
marginRight: 8,
marginVertical: 0
},
marginThread: {
marginLeft: 56,
marginRight: 4,
marginVertical: 0
}
},
container: {
borderRadius: Module712.radii.md,
padding: {
paddingVertical: 4,
paddingLeft: 20,
paddingRight: 12
},
paddingPanels: {
paddingVertical: 4,
paddingLeft: 8,
paddingRight: 8
},
paddingThread: {
paddingVertical: 4,
paddingLeft: 8,
paddingRight: 12
}
},
voiceUsers: {
height: 36,
margin: {
marginLeft: 60
}
},
voiceOrStageSummaryRow: {
size: 24,
avatarSize: AvatarSizes.XSMALL
},
channelName: {
height: 20,
text: {
variant: "redesign/channel-title/semibold"
}
},
messagePreview: {
messageTypeIconSize: IconSizes.EXTRA_SMALL,
messageTypeIconSizeNew: "xxs",
height: 16,
text: {
variant: "text-xs/medium"
},
margin: {
marginTop: 0
}
},
timestamp: {
text: {
variant: "text-xs/medium"
}
},
inviteRow: {
text: {
variant: "text-sm/semibold"
}
},
icon: {
avatarSize: AvatarSizes.REFRESH_MEDIUM_32,
guildIconSize: GuildIconSizes.SMALL_32,
guildBadgeIconSize: GuildIconSizes.XXSMALL_12,
wrapper: {
size: 32
},
channelIcon: {
size: 16
},
margin: {
marginRight: 8
},
emoji: {
size: 16,
lineHeight: 24
}
},
unreadBadge: {
size: 8,
position: {
left: 4
},
positionThread: {
left: -48
}
},
mentionBadge: {
position: {
top: 28
},
positionThread: {
top: 20
}
},
category: {
height: 30,
margin: {
marginTop: 16
},
text: {
size: 14
}
},
typing: {
position: {
top: 3,
left: 3
},
positionThread: {
top: -5,
left: -16
},
typingIndicator: {
position: {
top: 20,
left: 10
}
},
avatarSize: AvatarSizes.REFRESH_MEDIUM_32
},
activeThreadCount: {
text: {
variant: "text-xs/bold"
}
},
joinVoiceButton: {
text: {
variant: "text-xs/bold"
},
layout: {
paddingVertical: 4,
paddingRight: 8,
paddingLeft: 8,
height: 24
},
icon: {
size: IconSizes.EXTRA_SMALL,
gameSize: GameIconSizes.SIZE_24
}
},
threadSpine: {
left: 38,
startAndEndHeight: 15,
transform: [{
translateY: 10
}],
topOffset: -2
},
happeningNow: {
margin: {
marginTop: 16,
marginBottom: 16
}
},
separator: {
margin: {
marginVertical: 12
}
},
searchButton: {
margin: {
marginHorizontal: 16
},
marginPanels: {
marginHorizontal: 12
}
}
};
const r113 = deepmerge(c6871_2, {
layout: {
marginThread: {
marginLeft: 4
}
},
container: {
paddingThread: {
paddingLeft: 8
}
},
unreadBadge: {
positionThread: {
left: 4
}
}
});
export { c6871_2 as CHANNEL_LIST_STYLES_COMPACT };
export function getCompactStyles(a0) {
return a0 ? deepmerge(c6871_2, {
messagePreview: {
text: {
variant: "text-sm/medium",
color: "text-muted"
}
},
timestamp: {
text: {
variant: "text-xs/semibold"
}
}
}) : c6871_2;
}
export { r113 as CHANNEL_LIST_STYLES_COMPACT_LAUNCHPAD };
@@ -0,0 +1,170 @@
// Metro module 10289 (f10290).
import deepmerge from "../utils/deepmerge";
import { CHANNEL_LIST_STYLES_COMPACT } from "./Compact";
import Module712 from "../../../../../../../_bundle/Module712";
import { AvatarSizes, IconSizes } from "../../../../../../../design/void/native";
import { GuildIconSizes } from "../../../../../../guild/native/GuildIcon";
import { GameIconSizes } from "../../../../../../game_detection/native/GameIcon";
const r93 = deepmerge(CHANNEL_LIST_STYLES_COMPACT, {
layout: {
margin: {
marginVertical: 2
},
marginPanels: {
marginVertical: 2
},
marginThread: {
marginVertical: 2,
marginLeft: 76
}
},
container: {
borderRadius: Module712.radii.lg,
padding: {
paddingVertical: 8
},
paddingPanels: {
paddingVertical: 8
},
paddingThread: {
paddingVertical: 6,
paddingLeft: 8
}
},
category: {
margin: {
marginTop: 24
}
},
voiceUsers: {
height: 40,
margin: {
marginTop: -4,
marginLeft: 80
}
},
voiceOrStageSummaryRow: {
size: 32,
avatarSize: AvatarSizes.REFRESH_MEDIUM_32
},
messagePreview: {
text: {
variant: "redesign/message-preview/medium"
},
messageTypeIconSize: IconSizes.REFRESH_SMALL_16,
messageTypeIconSizeNew: "xs",
height: 18,
margin: {
marginTop: 2
}
},
inviteRow: {
text: {
variant: "text-md/semibold"
}
},
icon: {
avatarSize: AvatarSizes.LARGE_48,
guildIconSize: GuildIconSizes.LARGE,
guildBadgeIconSize: GuildIconSizes.XSMALL_20,
wrapper: {
size: 48
},
channelIcon: {
size: 24
},
margin: {
marginRight: 12
},
emoji: {
size: 24,
lineHeight: 32
}
},
unreadBadge: {
positionThread: {
left: -68
}
},
mentionBadge: {
position: {
top: 34
},
positionThread: {
top: 27
}
},
joinVoiceButton: {
text: {
variant: "text-sm/bold"
},
layout: {
paddingVertical: 6,
paddingRight: 12,
paddingLeft: 12,
height: 32
},
icon: {
size: IconSizes.REFRESH_SMALL_16,
gameSize: GameIconSizes.SMALL
}
},
threadSpine: {
left: 48,
startAndEndHeight: 16,
transform: [{
translateY: 0
}],
topOffset: -6
},
happeningNow: {
margin: {
marginBottom: 20
}
},
typing: {
position: {
top: 12,
left: 12
},
positionThread: {
top: 3,
left: -17
},
typingIndicator: {
position: {
top: 25,
left: 11
}
}
},
separator: {
margin: {
marginVertical: 20
}
}
});
const r105 = deepmerge(r93, {
layout: {
marginThread: {
marginLeft: 0
}
},
container: {
paddingThread: {
paddingLeft: 20
}
},
unreadBadge: {
positionThread: {
left: 4
}
},
mentionBadge: {
positionThread: {
top: 34
}
}
});
export { r93 as CHANNEL_LIST_STYLES_COZY };
export { r105 as CHANNEL_LIST_STYLES_COZY_LAUNCHPAD };
@@ -0,0 +1,141 @@
// Metro module 10286 (f10287).
import deepmerge from "../utils/deepmerge";
import { CHANNEL_LIST_STYLES_COMPACT } from "./Compact";
import Module712 from "../../../../../../../_bundle/Module712";
import { IconSizes, AvatarSizes } from "../../../../../../../design/void/native";
import { GuildIconSizes } from "../../../../../../guild/native/GuildIcon";
import { GameIconSizes } from "../../../../../../game_detection/native/GameIcon";
const r82 = deepmerge(CHANNEL_LIST_STYLES_COMPACT, {
container: {
borderRadius: Module712.radii.md,
padding: {
paddingVertical: 4,
paddingLeft: 20,
paddingRight: 12
},
paddingPanels: {
paddingVertical: 6,
paddingLeft: 8,
paddingRight: 8
},
paddingThread: {
paddingVertical: 4,
paddingLeft: 8,
paddingRight: 12
}
},
channelName: {
height: 20,
text: {
variant: "text-md/semibold"
}
},
messagePreview: {
text: {
variant: "text-xs/medium"
},
messageTypeIconSize: IconSizes.EXTRA_SMALL,
messageTypeIconSizeNew: "xs",
height: 18,
margin: {
marginTop: 0
}
},
inviteRow: {
text: {
variant: "text-md/semibold"
}
},
icon: {
avatarSize: AvatarSizes.NORMAL,
guildIconSize: GuildIconSizes.NORMAL,
guildBadgeIconSize: GuildIconSizes.XXSMALL,
wrapper: {
size: 40
},
channelIcon: {
size: 40
},
margin: {
marginRight: 8
},
emoji: {
size: 24,
lineHeight: 32
}
},
unreadBadge: {
positionThread: {
left: -68
}
},
mentionBadge: {
position: {
top: 34
},
positionThread: {
top: 27
}
},
joinVoiceButton: {
text: {
variant: "text-sm/bold"
},
layout: {
paddingVertical: 6,
paddingRight: 12,
paddingLeft: 12,
height: 32
},
icon: {
size: IconSizes.REFRESH_SMALL_16,
gameSize: GameIconSizes.SMALL
}
},
threadSpine: {
left: 48,
startAndEndHeight: 16,
transform: [{
translateY: 0
}],
topOffset: -6
},
happeningNow: {
margin: {
marginBottom: 20
}
},
typing: {
position: {
top: 12,
left: 12
},
positionThread: {
top: 3,
left: -17
},
typingIndicator: {
position: {
top: 25,
left: 11
}
}
},
separator: {
margin: {
marginVertical: 20
}
}
});
const r96 = deepmerge(CHANNEL_LIST_STYLES_COMPACT, {
container: {
paddingPanels: {
paddingVertical: 8
}
},
icon: {
avatarSize: AvatarSizes.REFRESH_MEDIUM_32
}
});
export { r82 as CHANNEL_LIST_STYLES_COZY_DRAWER };
export { r96 as CHANNEL_LIST_STYLES_COZY_DRAWER_SMOL };
@@ -0,0 +1,72 @@
// Metro module 10287 (f10288).
let options;
const merge = function merge() {
return Array.prototype.slice.call(arguments, 0).reduce((acc, item) => {
let c26644_1 = item;
if (Array.isArray(item)) {
throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");
}
Object.keys(item).forEach((item) => {
L31: {
if (!["__proto__", "constructor", "prototype"].includes(item)) {
const r9 = Array;
if (r9.isArray(acc[item])) {
const r11 = Array;
if (r11.isArray(c26644_1[item])) {
acc[item] = merge.options.mergeArrays ? Array.from(new Set(acc[item].concat(c26644_1[item]))) : c26644_1[item];
break L31;
}
}
const r24 = acc[item];
let r0 = false;
if (typeof r24 === "object") {
r0 = false;
if (r24 !== null) {
if (typeof Object.getPrototypeOf === "function") {
const prototypeOf = Object.getPrototypeOf(r24);
r0 = prototypeOf === Object.prototype || prototypeOf === null;
} else {
r0 = Object.prototype.toString.call(r24) === "[object Object]";
}
}
}
if (r0) {
const r12 = c26644_1[item];
let r39 = false;
if (typeof r12 === "object") {
r39 = false;
if (r12 !== null) {
if (typeof Object.getPrototypeOf === "function") {
const prototypeOf2 = Object.getPrototypeOf(r12);
r39 = prototypeOf2 === Object.prototype || prototypeOf2 === null;
} else {
r39 = Object.prototype.toString.call(r12) === "[object Object]";
}
}
}
if (r39) {
acc[item] = merge(acc[item], c26644_1[item]);
break L31;
}
}
acc[item] = c26644_1[item];
}
}
});
return acc;
}, {});
};
options = {
mergeArrays: true
};
merge.options = options;
merge.withOptions = function(a0, ...args) {
merge.options = {
mergeArrays: true,
...a0
};
const r17 = merge.apply(void 0, [...args]);
merge.options = options;
return r17;
};
export default merge;
@@ -0,0 +1,35 @@
// Metro module 15078 (f15079).
import { View } from "react-native";
import { createStyles } from "../../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../../_bundle/Module712";
import useTheme from "../../../../../../hooks/useTheme";
import { isThemeLight } from "../../../../../../design/shared";
import { Ellipsis } from "../../../../../../design/void/native";
const useStyles = createStyles((a0) => ({
ellipsisWrapper: {
zIndex: 10,
borderRadius: 17,
borderWidth: 2,
borderColor: Module712.colors.BACKGROUND_BASE_LOW
},
ellipsis: {
borderRadius: 13,
paddingVertical: 4,
paddingStart: 4,
paddingEnd: 2,
marginRight: 0,
backgroundColor: a0 ? Module712.unsafe_rawColors.BRAND_200 : Module712.unsafe_rawColors.BRAND_500
},
ellipsisDot: {
width: 4,
height: 4,
backgroundColor: a0 ? Module712.unsafe_rawColors.BRAND_500 : Module712.unsafe_rawColors.WHITE
}
}));
export function TypingIndicator(props) {
const style = props.style;
const styles = useStyles(isThemeLight(useTheme()));
return <View style={[styles.ellipsisWrapper, style]}>
<Ellipsis style={[styles.ellipsis]} dotStyle={styles.ellipsisDot} disableScale />
</View>;
}
@@ -0,0 +1,48 @@
// Metro module 13156 (f13157).
import { useEffect, useCallback } from "react";
import { useSharedValue, useAnimatedReaction } from "../../../../reanimated/ReanimatedRexport";
const __initData = {
code: "function useFlashListAnimationDisablerTsx1(){const{lastId}=this.__closure;return lastId.get();}"
};
const __initData2 = {
code: "function useFlashListAnimationDisablerTsx2(current,prev){const{enableAnimation}=this.__closure;if(current!==prev){enableAnimation.set(false);}}"
};
const __initData3 = {
code: "function useFlashListAnimationDisablerTsx3(finished){const{enableAnimation}=this.__closure;if(finished&&!enableAnimation.get()){enableAnimation.set(true);}}"
};
export function useFlashListAnimationDisabler(a0) {
let c20399_0 = a0;
const sharedValue = useSharedValue(false);
const sharedValue2 = useSharedValue(a0);
useEffect(() => {
sharedValue2.set(c20399_0);
}, [sharedValue2, a0]);
const _ = () => sharedValue2.get();
_.__closure = {
lastId: sharedValue2
};
_.__workletHash = 9889142626009;
_.__initData = __initData;
const u = function u(a0, a1) {
if (a0 !== a1) {
sharedValue.set(false);
}
};
u.__closure = {
enableAnimation: sharedValue
};
u.__workletHash = 6114249067388;
u.__initData = __initData2;
useAnimatedReaction(_, u);
const b = function b(a0) {
if (a0 ? !sharedValue.get() : a0) {
sharedValue.set(true);
}
};
b.__closure = {
enableAnimation: sharedValue
};
b.__workletHash = 5697261629076;
b.__initData = __initData3;
return [sharedValue, useCallback(b, [sharedValue])];
}
@@ -0,0 +1,30 @@
// Metro module 15815 (f15816).
import { useCallback } from "react";
import ChannelStore from "../../../../../stores/ChannelStore";
import ChannelActionCreators from "../../../../../actions/ChannelActionCreators";
import { transitionToChannel } from "../../../../routing/transitionToChannel";
import showLongPressForumPostActionSheet from "../../../../action_sheet/native/components/showLongPressForumPostActionSheet";
import showThreadLongPressActionSheet from "../../../../threads/native/components/showThreadLongPressActionSheet";
import { openChannelLongPressActionSheet } from "../../../../channel/native/openChannelLongPressActionSheet";
export function useTextChannelPressEvents(a0, a1) {
const navigationReplace = a1;
return {
onPress: useCallback(() => {
ChannelActionCreators.preload(a0.guild_id, a0.id);
transitionToChannel(a0.id, {
navigationReplace
});
}, [a0.id, a0.guild_id, a1]),
onLongPress: useCallback(() => {
const channel = ChannelStore.getChannel(a0.parent_id);
if (channel != null && (channel.isForumLikeChannel() && a0.isForumPost())) {
showLongPressForumPostActionSheet(a0, channel);
} else if (a0.isThread()) {
showThreadLongPressActionSheet(a0.id);
} else {
openChannelLongPressActionSheet(a0.id);
}
}, [a0]),
unstable_pressDelay: 32
};
}
Loaded 100 of 33051 files, more files were not shown because too many files have changed in this diff. Show more