128 lines
5.8 KiB
TypeScript
128 lines
5.8 KiB
TypeScript
// Metro module 11432 (f11433).
|
|
import { memo, useCallback, useContext, useRef, useEffect } from "react";
|
|
import { Platform } from "react-native";
|
|
import { CONTROLS_DRAWER_HEADER_SIZE } from "./VoicePanelControlsConstants";
|
|
import { ComponentActions, ME } from "../../../../Constants";
|
|
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
|
|
import ChannelRTCActionCreators from "../../../../actions/ChannelRTCActionCreators";
|
|
import MobileVisualRefreshExperiment from "../../../themes/experiments/MobileVisualRefreshExperiment";
|
|
import { ComponentDispatch } from "../../../../utils/ComponentDispatchUtils";
|
|
import ChatFloatingNavButton from "../../../chat_input/native/ChatFloatingNavButton";
|
|
import { intl, t } from "../../../../intl/index.native";
|
|
import Module4144 from "../../../../_bundle/Module4144";
|
|
import { IconButton } from "../../../../design/components/Button/native/IconButton.native";
|
|
import VoicePanelStateContext from "../VoicePanelStateContext";
|
|
import { useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
|
|
import ReanimatedNativeView from "../../../core/native/ReanimatedNativeView";
|
|
import ThemedGradient from "../../../client_themes/native/ThemedGradient";
|
|
import { useGradientTop } from "../../../client_themes/native/ClientThemesOverrides";
|
|
import useWindowDimensions_native from "../../../screen/useWindowDimensions.native";
|
|
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
|
|
import { getControlsDrawerOpenWidth } from "../utils/VoicePanelControlsUtils";
|
|
import ChannelActionCreators from "../../../../actions/ChannelActionCreators";
|
|
import useColorThemeBackground from "../../../client_themes/native/useColorThemeBackground";
|
|
import ChatViewWidthContext from "../../../chat/native/ChatViewWidthContext";
|
|
import { ThemeContextProvider } from "../../../../_bundle/Module3901";
|
|
import { AccessibilityView } from "../../../../design/components/AccessibilityView/AccessibilityView.native";
|
|
import VoicePanelControlsDrawerTitle from "./VoicePanelControlsDrawerTitle";
|
|
import ChatView from "../../../chat/native/ChatView";
|
|
let __initData, Component;
|
|
Platform;
|
|
const useStyles = createStyles({
|
|
container: {
|
|
flex: 1,
|
|
overflow: "hidden",
|
|
paddingTop: CONTROLS_DRAWER_HEADER_SIZE
|
|
},
|
|
gradientWrapper: {
|
|
position: "absolute",
|
|
top: CONTROLS_DRAWER_HEADER_SIZE,
|
|
left: 0
|
|
},
|
|
titleBlur: {
|
|
opacity: 0
|
|
}
|
|
});
|
|
const r39 = memo(function VoicePanelDismissChatButton() {
|
|
const r13 = MobileVisualRefreshExperiment("VoicePanelDismissChatButton");
|
|
const callback = useCallback(() => {
|
|
ComponentDispatch.dispatch(ComponentActions.VOICE_PANEL_TIV_CLOSE);
|
|
}, []);
|
|
return r13 ? <ChatFloatingNavButton accessibilityLabel={intl.string(t["5MstTl"])} icon={Module4144} onPress={callback} /> : <IconButton accessibilityLabel={intl.string(t["5MstTl"])} icon={Module4144} onPress={callback} variant="primary-overlay" />;
|
|
});
|
|
__initData = {
|
|
code: "function VoicePanelChatViewTsx1(){const{windowDimensions}=this.__closure;return{width:windowDimensions.get().width,height:windowDimensions.get().height};}"
|
|
};
|
|
Component = memo(function() {
|
|
const windowDimensions = useContext(VoicePanelStateContext).windowDimensions;
|
|
const styles = useStyles();
|
|
const n = () => ({
|
|
width: windowDimensions.get().width,
|
|
height: windowDimensions.get().height
|
|
});
|
|
n.__closure = {
|
|
windowDimensions
|
|
};
|
|
n.__workletHash = 16775846409623;
|
|
n.__initData = __initData;
|
|
return <ReanimatedNativeView style={[styles.gradientWrapper, useAnimatedStyle(n)]}>
|
|
<ThemedGradient absolute />
|
|
</ReanimatedNativeView>;
|
|
});
|
|
const r46 = memo(function VoicePanelChatView(props) {
|
|
const shown = props.shown;
|
|
const styles = useStyles();
|
|
const ref = useRef(null);
|
|
const context = useContext(VoicePanelStateContext);
|
|
let guildId2 = context.guildId;
|
|
const guildId = guildId2;
|
|
const channelId = context.channelId;
|
|
const gradientTop = useGradientTop();
|
|
const width = useWindowDimensions_native().width;
|
|
const safeAreaInsets_native = useSafeAreaInsets_native();
|
|
const controlsDrawerOpenWidth = getControlsDrawerOpenWidth(width, safeAreaInsets_native.left, safeAreaInsets_native.right);
|
|
useEffect(() => {
|
|
let r8 = guildId;
|
|
if (guildId == null) {
|
|
r8 = ME;
|
|
}
|
|
ChannelActionCreators.preload(r8, channelId);
|
|
return () => {
|
|
ChannelRTCActionCreators.updateChatOpen(channelId, false);
|
|
};
|
|
}, [guildId, channelId]);
|
|
useEffect(() => {
|
|
ChannelRTCActionCreators.updateChatOpen(channelId, shown);
|
|
const current = ref.current;
|
|
if (shown) {
|
|
if (current != null) {
|
|
current.chatInputTrackerRegister();
|
|
}
|
|
} else {
|
|
if (current != null) {
|
|
current.chatInputTrackerUnregister();
|
|
}
|
|
const current2 = ref.current;
|
|
if (current2 != null) {
|
|
current2.blur();
|
|
}
|
|
}
|
|
}, [channelId, shown]);
|
|
const callback = useCallback(() => {
|
|
ComponentDispatch.dispatch(ComponentActions.VOICE_PANEL_TIV_CLOSE);
|
|
}, []);
|
|
const colorThemeBackground = useColorThemeBackground();
|
|
const r74 = [<Component />, <VoicePanelControlsDrawerTitle title={intl.string(t["/VQax8"])} disablePill blurStyle={styles.titleBlur} />, ,];
|
|
if (guildId == null) {
|
|
guildId2 = ME;
|
|
}
|
|
r74[2] = <ChatView disableGradient alwaysRespectKeyboard={false} setNoExtractUI={false} guildId={guildId2} channelId={channelId} chatInputRef={ref} screenIndex="voice-panel" />;
|
|
return <ChatViewWidthContext.Provider value={controlsDrawerOpenWidth}>
|
|
<ThemeContextProvider gradient={colorThemeBackground}>
|
|
<AccessibilityView nativeID="voice-panel-chat-view" accessibilityViewIsModal={shown} onAccessibilityEscape={callback} style={[styles.container, gradientTop]}>{r74}</AccessibilityView>
|
|
</ThemeContextProvider>
|
|
</ChatViewWidthContext.Provider>;
|
|
});
|
|
export default r46;
|
|
export { r39 as MemoedVoicePanelDismissChatButton };
|