103 lines
4.9 KiB
TypeScript
103 lines
4.9 KiB
TypeScript
// Metro module 16039 (f16040).
|
|
import { memo, useContext, useCallback, useRef } from "react";
|
|
import ChannelStore from "../../../../stores/ChannelStore";
|
|
import { VoicePanelControlsModes, CONTROLS_DRAWER_HEADER_SIZE } from "./VoicePanelControlsConstants";
|
|
import { ComponentActions } from "../../../../Constants";
|
|
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
|
|
import { useGradientTop } from "../../../client_themes/native/ClientThemesOverrides";
|
|
import VoicePanelStateContext from "../VoicePanelStateContext";
|
|
import useStateFromSharedValue from "../../../reanimated/native/useStateFromSharedValue";
|
|
import { useStateFromStores } from "../../../../_bundle/Module589";
|
|
import Module38 from "../../../../_bundle/Module38";
|
|
import { getControlsDrawerOpenWidth } from "../utils/VoicePanelControlsUtils";
|
|
import { ComponentDispatch } from "../../../../utils/ComponentDispatchUtils";
|
|
import { useAppLauncherChatInputRefDummy, AppLauncherKeyboardCloseReason } from "../../../app_launcher/native/AppLauncherContext";
|
|
import { AppLauncherEntrypoint } from "../../../app_launcher/AppLauncherTypes";
|
|
import ReanimatedRexport, { useSharedValue, useDerivedValue, useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
|
|
import AppLauncherNavigator from "../../../app_launcher/native/AppLauncherNavigator";
|
|
import VoicePanelControlsDrawerTitle from "./VoicePanelControlsDrawerTitle";
|
|
import { intl, t } from "../../../../intl/index.native";
|
|
const useStyles = createStyles({
|
|
container: {
|
|
width: "100%",
|
|
paddingTop: CONTROLS_DRAWER_HEADER_SIZE
|
|
}
|
|
});
|
|
const __initData = {
|
|
code: "function VoicePanelControlsAppLauncherTsx1(){const{gestureSpecs}=this.__closure;return gestureSpecs.get().active;}"
|
|
};
|
|
const __initData2 = {
|
|
code: "function VoicePanelControlsAppLauncherTsx2(){const{gestureSpecs}=this.__closure;return gestureSpecs.get().isDrawer;}"
|
|
};
|
|
const __initData3 = {
|
|
code: "function VoicePanelControlsAppLauncherTsx3(){const{isGestureActive,isGestureDrawerMode,windowDimensions,safeArea}=this.__closure;const height=isGestureActive.get()||!isGestureDrawerMode.get()?windowDimensions.height-safeArea.top:'100%';return{height:height};}"
|
|
};
|
|
const r40 = memo(function VoicePanelControlsAppLauncher(props) {
|
|
let derivedValue, derivedValue2;
|
|
const gestureSpecs = props.gestureSpecs;
|
|
derivedValue = void 0;
|
|
derivedValue2 = void 0;
|
|
const styles = useStyles();
|
|
const gradientTop = useGradientTop();
|
|
const context = useContext(VoicePanelStateContext);
|
|
const { setControlsMode, safeArea, windowDimensions, channelId } = context;
|
|
const stateFromSharedValue = useStateFromSharedValue(windowDimensions);
|
|
let c22748_3 = stateFromSharedValue;
|
|
const stateFromSharedValue2 = useStateFromSharedValue(safeArea);
|
|
let c22748_4 = stateFromSharedValue2;
|
|
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId));
|
|
Module38(stateFromStores != null, "channel should not be null");
|
|
const controlsDrawerOpenWidth = getControlsDrawerOpenWidth(stateFromSharedValue.width, stateFromSharedValue2.left, stateFromSharedValue2.right);
|
|
const callback = useCallback(() => {
|
|
ComponentDispatch.dispatch(ComponentActions.SELECT_ACTIVITY);
|
|
setControlsMode({
|
|
mode: VoicePanelControlsModes.HIDDEN
|
|
});
|
|
}, [setControlsMode]);
|
|
const appLauncherChatInputRefDummy = useAppLauncherChatInputRefDummy({
|
|
noop: true
|
|
});
|
|
const VOICE = AppLauncherEntrypoint.VOICE;
|
|
const ref2 = useRef(AppLauncherKeyboardCloseReason.DISMISSED);
|
|
const ref = useRef(void 0);
|
|
const sharedValue = useSharedValue(0);
|
|
const sharedValue2 = useSharedValue(0);
|
|
const y = () => gestureSpecs.get().active;
|
|
y.__closure = {
|
|
gestureSpecs
|
|
};
|
|
y.__workletHash = 1130089519653;
|
|
y.__initData = __initData;
|
|
derivedValue = useDerivedValue(y);
|
|
const E = () => gestureSpecs.get().isDrawer;
|
|
E.__closure = {
|
|
gestureSpecs
|
|
};
|
|
E.__workletHash = 13970291088135;
|
|
E.__initData = __initData2;
|
|
derivedValue2 = useDerivedValue(E);
|
|
const L = function L() {
|
|
return {
|
|
height: derivedValue.get() ? c22748_3.height - c22748_4.top : derivedValue2.get() ? "100%" : c22748_3.height - c22748_4.top
|
|
};
|
|
};
|
|
L.__closure = {
|
|
isGestureActive: derivedValue,
|
|
isGestureDrawerMode: derivedValue2,
|
|
windowDimensions: stateFromSharedValue,
|
|
safeArea: stateFromSharedValue2
|
|
};
|
|
L.__workletHash = 3671157204025;
|
|
L.__initData = __initData3;
|
|
return <>
|
|
<ReanimatedRexport.View style={[styles.container, gradientTop, useAnimatedStyle(L)]}>
|
|
<AppLauncherNavigator bottomSheetIndex={sharedValue2} bottomSheetPosition={sharedValue} bottomSheetExpandReasonRef={ref} context={{
|
|
type: "channel",
|
|
channel: stateFromStores
|
|
}} chatInputRef={appLauncherChatInputRefDummy} entrypoint={VOICE} keyboardCloseReasonRef={ref2} onActivityItemSelected={callback} width={controlsDrawerOpenWidth} />
|
|
<VoicePanelControlsDrawerTitle title={intl.string(t.shUONg)} disablePill />
|
|
</ReanimatedRexport.View>
|
|
</>;
|
|
});
|
|
export default r40;
|