// Metro module 10697 (f10698). import _slicedToArray from "../../../../_bundle/_slicedToArray"; import { useState, useCallback, useEffect } from "react"; import { StyleSheet, View, ScrollView, TouchableWithoutFeedback } from "react-native"; import * as _ChannelCallStore from "../ChannelCallStore"; import { BOX_MODE_THRESHOLD_WIDTH, BOX_MODE_ACTIONSHEET_HEIGHT } from "../ChannelCallConstants"; import { Fonts, ComponentActions } from "../../../../Constants"; import { isIOS } from "../../../../utils/PlatformUtils"; import { createStyles } from "../../../../design/components/Styles/native/createStyles"; import Module712 from "../../../../_bundle/Module712"; import TextStyles from "../../../rebrand/native/TextStyles"; import { Tooltip, TooltipArrowPositions, TooltipArrowDirections, STANDARD_EASING } from "../../../../design/void/native"; import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native"; import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport"; import ReanimatedRexport, { useAnimatedStyle, useSharedValue, useDerivedValue } from "../../../reanimated/ReanimatedRexport"; import { useCanShowTooltip } from "../../../tooltip/useCanShowTooltip"; import * as _ConstantsIOS from "../../../../ConstantsIOS"; import { intl, t } from "../../../../intl/index.native"; import { ActionSheetHeaderBar } from "../../../../design/components/Sheet/native/ActionSheetHeaderBar.native"; import { UNSAFE_markDismissibleContentAsDismissed } from "../../../dismissible_content/DismissibleContentUnsafeUtils"; import { DismissibleContent } from "../../../../_bundle/Module1358"; import * as _timing from "../../../../design/animation/reanimated/timing/timing"; import { Gesture, GestureDetector } from "../../../../_bundle/Module5273"; import TooltipActionCreators from "../../../tooltip/TooltipActionCreators"; import useWindowDimensions_native from "../../../screen/useWindowDimensions.native"; import useBottomVoiceControlsSheetWidth from "../useBottomVoiceControlsSheetWidth"; import { ComponentDispatch } from "../../../../utils/ComponentDispatchUtils"; import { useThemeContext } from "../../../../_bundle/Module3901"; import VisualEffectView from "../../../visual_effect_view/native/VisualEffectView"; import { isThemeLight } from "../../../../design/shared"; import CallPTTButton, { CallPTTButtonLooks } from "../../../../components_native/calls/CallPTTButton"; let FocusedControlsBottomDrawerTooltip, FocusedControlsAboveActionBarView, FocusedControlsBottomDrawer, c7192_15, EXTENDED_CONTROLS_OFFSET_Y, EXTENDED_CONTROLS_LANDSCAPE_OFFSET_Y, useStyles, c7192_19, c7192_20, c7192_21, c7192_23, c7192_25, c7192_27, c7192_28, c7192_29, c7192_30, c7192_31, c7192_32; let env7192 = {}; const FocusedControlsExpanded = function FocusedControlsExpanded(props) { const { expandedControls, availableHeight, positionY } = props; const styles = useStyles(); const bottom = useSafeAreaInsets_native().bottom; const [state, setState] = useState(false); const callback2 = useCallback((a0) => { const r1 = a0.nativeEvent.layout.height > availableHeight - bottom; if (r1 !== state) { setState(r1); } }, [availableHeight, bottom, state]); const r32 = function _() { const opacity = Math.min(-1 * positionY.get() / c7192_15, 1); return { opacity, pointerEvents: opacity === 0 ? "none" : "auto" }; }; r32.__closure = { positionY, EXPANDED_DRAWER_SHOW_POSITION: c7192_15 }; r32.__workletHash = 10567472250823; r32.__initData = c7192_21; return {expandedControls} ; }; FocusedControlsBottomDrawerTooltip = function FocusedControlsBottomDrawerTooltip(props) { const positionY2 = props.positionY; const styles = useStyles(); const canShowTooltip = useCanShowTooltip(_ConstantsIOS.TooltipNames.SCREENSHARE_SWIPE_UP_CONTROLS, true); const r23 = function() { return { opacity: 1 - Math.min(-1 * positionY2.get() / c7192_15, 1) }; }; r23.__closure = { positionY: positionY2, EXPANDED_DRAWER_SHOW_POSITION: c7192_15 }; r23.__workletHash = 4429631762525; r23.__initData = c7192_23; const animatedStyle = useAnimatedStyle(r23); return canShowTooltip ? : null; }; FocusedControlsAboveActionBarView = function FocusedControlsAboveActionBarView(props) { const { positionY: positionY3, offsetY, aboveActionBar, onPressHeader, isExpanded } = props; const styles = useStyles(); const r21 = function _() { return { opacity: 2 - Math.max(Math.abs(positionY3.get()) / (offsetY / 3 - c7192_15), 0) }; }; r21.__closure = { offsetY, EXPANDED_DRAWER_SHOW_POSITION: c7192_15, positionY: positionY3 }; r21.__workletHash = 5042367101380; r21.__initData = c7192_25; const animatedStyle = useAnimatedStyle(r21); return {aboveActionBar != null && {aboveActionBar}} ; }; FocusedControlsBottomDrawer = function FocusedControlsBottomDrawer(props) { let env18207 = { $parent: env7192 }; const { children, expandedControls, actionBarControlsHeight, reveal } = props; env18207[0] = reveal; const aboveActionBar = props.aboveActionBar; env18207[1] = props.onDrawerClose; const onDrawerOpen2 = props.onDrawerOpen; env18207[2] = void 0; env18207[3] = void 0; env18207[4] = void 0; env18207[5] = void 0; env18207[6] = void 0; env18207[7] = void 0; env18207[8] = void 0; env18207[9] = void 0; const styles = useStyles(); const safeAreaInsets_native = useSafeAreaInsets_native(); const { bottom: bottom2, right } = safeAreaInsets_native; env18207[2] = right; const top = safeAreaInsets_native.top; const windowDimensions_native = useWindowDimensions_native(); const height = windowDimensions_native.height; const isLandscapeMode = windowDimensions_native.width > BOX_MODE_THRESHOLD_WIDTH; env18207[3] = isLandscapeMode; const bottomVoiceControlsSheetWidth = useBottomVoiceControlsSheetWidth(); env18207[4] = bottomVoiceControlsSheetWidth; const sheetHeight = isLandscapeMode ? Math.min(BOX_MODE_ACTIONSHEET_HEIGHT, height) : height; env18207[5] = sheetHeight; const controlHeightWithOffset = isLandscapeMode ? actionBarControlsHeight : actionBarControlsHeight + bottom2; env18207[6] = controlHeightWithOffset; const controlMaxHeight = sheetHeight - controlHeightWithOffset; env18207[7] = controlMaxHeight; const r55 = sheetHeight - controlHeightWithOffset; const availableHeight2 = isLandscapeMode ? r55 - (top + 54 + 12) : r55 - (top + 54 + (isIOS() ? 48 : 16)); const portraitOffsetY = top + 54 + (isIOS() ? 48 : 16) + bottom2; let onDrawerOpen, state2, setState2, sharedValue, derivedValue, sharedValue2, sharedValue3, sharedValue4, callback, handleOpen2, handleClose2; const landscapeOffsetY = top + 54 + 12; let c18208_0 = controlMaxHeight; let c18208_1 = isLandscapeMode; let c18208_2 = portraitOffsetY; let c18208_3 = landscapeOffsetY; const onClose2 = () => { const r3 = env18207[1]; return r3 == null ? void 0 : r3(); }; onDrawerOpen = onDrawerOpen2; state2 = void 0; setState2 = void 0; sharedValue = void 0; derivedValue = void 0; sharedValue2 = void 0; sharedValue3 = void 0; sharedValue4 = void 0; callback = void 0; handleOpen2 = function handleOpen() { if (!state2) { if (onDrawerOpen != null) { onDrawerOpen(); } setState2(true); } }; handleClose2 = function handleClose() { if (state2) { const r5 = env18207[1]; if (r5 != null) { r5(); } setState2(false); callback(); } }; [state2, setState2] = useState(false); sharedValue = useSharedValue(0); const O = function O() { return c18208_1 ? c18208_0 - c18208_3 : c18208_0 - c18208_2; }; O.__closure = { isLandscapeMode, controlMaxHeight, landscapeOffsetY, portraitOffsetY }; O.__workletHash = 13346503100323; O.__initData = c7192_27; derivedValue = useDerivedValue(O); sharedValue2 = useSharedValue(0); sharedValue3 = useSharedValue(false); sharedValue4 = useSharedValue(0); callback = useCallback(() => { UNSAFE_markDismissibleContentAsDismissed(DismissibleContent.SOUNDBOARD_MOBILE_NEW_BADGE); }, []); const callback2 = useCallback(() => { const r10 = sharedValue.get(); let r9 = 0; const r1 = r10 !== 0; if (!r1) { r9 = -derivedValue.get(); } sharedValue.set(_timing.withTiming(r9, c7192_19)); if (r1) { (0, _ChannelCallStore.resetFocusTimer)(); callback(); } else { (0, _ChannelCallStore.clearFocusTimer)(); } setState2(!r1); }, [sharedValue, derivedValue, callback]); const r132 = Gesture.Pan(); const M = function M() { _ReanimatedRexport.runOnJS(_ChannelCallStore.clearFocusTimer)(); sharedValue3.set(sharedValue.get() !== 0); sharedValue4.set(0); if (!(sharedValue.get() != null && sharedValue3.get())) { sharedValue2.set(0); } }; M.__closure = { runOnJS: _ReanimatedRexport.runOnJS, clearFocusTimer: _ChannelCallStore.clearFocusTimer, drawerOpen: sharedValue3, positionY: sharedValue, CLOSE_DRAWER_POSITION: 0, velocity: sharedValue4, startY: sharedValue2 }; M.__workletHash = 9674965708496; M.__initData = c7192_30; const r140 = r132.onStart(M); const N = function N(a0) { sharedValue4.set(a0.velocityY); if (!(-1 * sharedValue.get() > derivedValue.get() + 16)) { let r20 = sharedValue2.get(); if (r20 == null) { r20 = 0; } sharedValue.set(r20 + a0.translationY); } }; N.__closure = { velocity: sharedValue4, positionY: sharedValue, maxHeight: derivedValue, startY: sharedValue2 }; N.__workletHash = 16755118181071; N.__initData = c7192_29; const r146 = r140.onUpdate(N); const H = function H() { const r10 = sharedValue3.get(); const r4 = -1 * sharedValue.get(); const r21 = derivedValue.get() / 2; let r24 = sharedValue4.get(); if (r24 == null) { r24 = 0; } const r3 = -1 * r24; let r26 = sharedValue4.get(); if (r26 == null) { r26 = 0; } L16: { const openDrawer = function openDrawer() { _ReanimatedRexport.runOnJS(handleOpen2)(); sharedValue2.set(-derivedValue.get()); sharedValue.set(_timing.withTiming(sharedValue2.get(), c7192_19)); sharedValue3.set(true); _ReanimatedRexport.runOnJS(TooltipActionCreators.acknowledgeTooltip)(_ConstantsIOS.TooltipNames.SCREENSHARE_SWIPE_UP_CONTROLS); }; const r28 = r26 >= 500; const r6 = sharedValue.get() > 0; if (!(500 <= r3 && !r10) && !(r21 <= r4 && !r10)) { L15: { if (!r6) { if (r28 && r10) { break L15; } if (r21 <= r4) { openDrawer(); break L16; } sharedValue2.set(0); sharedValue.set(_timing.withTiming(0, c7192_20)); sharedValue3.set(false); _ReanimatedRexport.runOnJS(_ChannelCallStore.resetFocusTimer)(); _ReanimatedRexport.runOnJS(handleClose2)(); break L16; } } sharedValue2.set(0); sharedValue.set(_timing.withTiming(0, c7192_20)); sharedValue3.set(false); _ReanimatedRexport.runOnJS(_ChannelCallStore.resetFocusTimer)(); _ReanimatedRexport.runOnJS(handleClose2)(); } else { openDrawer(); } } }; const TIMING_CONFIG = c7192_19; H.__closure = { drawerOpen: sharedValue3, positionY: sharedValue, maxHeight: derivedValue, velocity: sharedValue4, MIN_GESTURE_TRIGGER_VELOCITY: 500, CLOSE_DRAWER_POSITION: 0, runOnJS: _ReanimatedRexport.runOnJS, handleOpen: handleOpen2, startY: sharedValue2, withTiming: _timing.withTiming, TIMING_CONFIG, TooltipActionCreators, TooltipNames: _ConstantsIOS.TooltipNames, TIMING_CONFIG_EXIT: c7192_20, resetFocusTimer: _ChannelCallStore.resetFocusTimer, handleClose: handleClose2 }; H.__workletHash = 6790759206787; H.__initData = c7192_28; const r169 = _slicedToArray([sharedValue, r146.onEnd(H), callback2, state2], 4); const positionY4 = r169[0]; env18207[8] = positionY4; const gesture = r169[1]; const onPressHeader = r169[2]; env18207[9] = onPressHeader; const isExpanded = r169[3]; const f = function f() { const r9 = env18207[0] ? 0 : env18207[6]; const r3 = env18207[3]; return { position: "absolute", height: env18207[5], overflow: "hidden", bottom: r3 ? 16 : 0, right: r3 ? 16 + env18207[2] : 0, borderRadius: r3 ? 8 : 0, width: env18207[4], transform: [{ translateY: _timing.withTiming(r9, c7192_19) }] }; }; f.__closure = { reveal, controlHeightWithOffset, sheetHeight, isLandscapeMode, safeAreaRight: right, sheetWidth: bottomVoiceControlsSheetWidth, withTiming: _timing.withTiming, TIMING_CONFIG }; f.__workletHash = 608185354082; f.__initData = c7192_31; const animatedStyle = useAnimatedStyle(f); useEffect(() => { env18207[8].set(_timing.withTiming(0, c7192_20)); }, [isLandscapeMode, positionY4]); useEffect(() => { if (env18207[0]) { env18207[8].set(0); } }, [reveal, positionY4]); useEffect(() => { const handleSelectActivity2 = function handleSelectActivity() { env18207[8].set(_timing.withTiming(0, c7192_20)); }; ComponentDispatch.subscribe(ComponentActions.SELECT_ACTIVITY, handleSelectActivity2); return () => { ComponentDispatch.unsubscribe(ComponentActions.SELECT_ACTIVITY, handleSelectActivity2); }; }, [positionY4]); const Z = function Z() { return { height: env18207[5], transform: [{ translateY: env18207[7] + env18207[8].get() }] }; }; Z.__closure = { sheetHeight, offsetY: controlMaxHeight, positionY: positionY4 }; Z.__workletHash = 4471821639301; Z.__initData = c7192_32; const animatedStyle2 = useAnimatedStyle(Z); useEffect(() => { ComponentDispatch.subscribe(ComponentActions.TOGGLE_CALL_CONTROL_DRAWER, env18207[9]); return () => { ComponentDispatch.unsubscribe(ComponentActions.TOGGLE_CALL_CONTROL_DRAWER, env18207[9]); }; }, [onPressHeader]); const theme = useThemeContext().theme; return {children} ; }; c7192_15 = 20; EXTENDED_CONTROLS_OFFSET_Y = (a0) => {}; EXTENDED_CONTROLS_LANDSCAPE_OFFSET_Y = (a0) => {}; useStyles = createStyles({ bottomDrawerContainer: { position: "absolute", left: 0, right: 0, bottom: 0, borderRadius: Module712.radii.sm }, visualEffectView: { ...StyleSheet.absoluteFillObject, borderRadius: Module712.radii.sm, overflow: "hidden" }, visualEffectViewBackground: { backgroundColor: "rgba(0, 0, 0, .15)" }, expandedControlsContainer: { marginHorizontal: 16 }, aboveActionBarContainer: { position: "absolute", left: 0, right: 0, top: -32, paddingTop: 4, paddingBottom: 8 }, aboveActionBarChildrenContainer: { position: "absolute", left: 16, right: 16, top: -64 }, ptbButton: { margin: 0, marginHorizontal: 16, marginBottom: 8 }, tooltipStyle: { alignSelf: "center", position: "absolute", top: -28 }, containerStyle: { paddingHorizontal: 8, paddingVertical: 4 }, labelStyle: { ...TextStyles(Fonts.DISPLAY_EXTRABOLD, Module712.unsafe_rawColors.WHITE, 12, { uppercase: true }) } }); c7192_19 = { easing: STANDARD_EASING, duration: 250 }; c7192_20 = { easing: STANDARD_EASING, duration: 400 }; c7192_21 = { code: "function FocusedControlsBottomControlsTsx1(){const{positionY,EXPANDED_DRAWER_SHOW_POSITION}=this.__closure;const opacity=Math.min(positionY.get()*-1/EXPANDED_DRAWER_SHOW_POSITION,1);return{opacity:opacity,pointerEvents:opacity===0?'none':'auto'};}" }; c7192_23 = { code: "function FocusedControlsBottomControlsTsx2(){const{positionY,EXPANDED_DRAWER_SHOW_POSITION}=this.__closure;return{opacity:1-Math.min(positionY.get()*-1/EXPANDED_DRAWER_SHOW_POSITION,1)};}" }; c7192_25 = { code: "function FocusedControlsBottomControlsTsx3(){const{offsetY,EXPANDED_DRAWER_SHOW_POSITION,positionY}=this.__closure;const maxHeightRange=offsetY/3-EXPANDED_DRAWER_SHOW_POSITION;const opacity=2-Math.max(Math.abs(positionY.get())/maxHeightRange,0);return{opacity:opacity};}" }; c7192_27 = { code: "function FocusedControlsBottomControlsTsx4(){const{isLandscapeMode,controlMaxHeight,landscapeOffsetY,portraitOffsetY}=this.__closure;return isLandscapeMode?controlMaxHeight-landscapeOffsetY:controlMaxHeight-portraitOffsetY;}" }; c7192_28 = { code: "function FocusedControlsBottomControlsTsx5(){const{drawerOpen,positionY,maxHeight,velocity,MIN_GESTURE_TRIGGER_VELOCITY,CLOSE_DRAWER_POSITION,runOnJS,handleOpen,startY,withTiming,TIMING_CONFIG,TooltipActionCreators,TooltipNames,TIMING_CONFIG_EXIT,resetFocusTimer,handleClose}=this.__closure;var _velocity$get,_velocity$get2;const isDrawerAlreadyOpen=drawerOpen.get();const isPassedTriggerThreshold=positionY.get()*-1>=maxHeight.get()/2;const isHighOpenVelocity=((_velocity$get=velocity.get())!==null&&_velocity$get!==void 0?_velocity$get:0)*-1>=MIN_GESTURE_TRIGGER_VELOCITY;const isHighCloseVelocity=((_velocity$get2=velocity.get())!==null&&_velocity$get2!==void 0?_velocity$get2:0)>=MIN_GESTURE_TRIGGER_VELOCITY;const isLowerThanMinHeight=positionY.get()>CLOSE_DRAWER_POSITION;function openDrawer(){runOnJS(handleOpen)();startY.set(-maxHeight.get());positionY.set(withTiming(startY.get(),TIMING_CONFIG));drawerOpen.set(true);runOnJS(TooltipActionCreators.acknowledgeTooltip)(TooltipNames.SCREENSHARE_SWIPE_UP_CONTROLS);}function closeDrawer(){startY.set(0);positionY.set(withTiming(CLOSE_DRAWER_POSITION,TIMING_CONFIG_EXIT));drawerOpen.set(false);runOnJS(resetFocusTimer)();runOnJS(handleClose)();}if(isHighOpenVelocity&&!isDrawerAlreadyOpen||isPassedTriggerThreshold&&!isDrawerAlreadyOpen){openDrawer();}else if(isLowerThanMinHeight||isHighCloseVelocity&&isDrawerAlreadyOpen){closeDrawer();}else if(isPassedTriggerThreshold){openDrawer();}else{closeDrawer();}}" }; c7192_29 = { code: "function FocusedControlsBottomControlsTsx6(event){const{velocity,positionY,maxHeight,startY}=this.__closure;var _startY$get;velocity.set(event.velocityY);if(positionY.get()*-1>maxHeight.get()+16){return;}positionY.set(((_startY$get=startY.get())!==null&&_startY$get!==void 0?_startY$get:0)+event.translationY);}" }; c7192_30 = { code: "function FocusedControlsBottomControlsTsx7(){const{runOnJS,clearFocusTimer,drawerOpen,positionY,CLOSE_DRAWER_POSITION,velocity,startY}=this.__closure;runOnJS(clearFocusTimer)();drawerOpen.set(positionY.get()!==CLOSE_DRAWER_POSITION);velocity.set(0);if(positionY.get()==null||!drawerOpen.get()){startY.set(0);}}" }; c7192_31 = { code: "function FocusedControlsBottomControlsTsx8(){const{reveal,controlHeightWithOffset,sheetHeight,isLandscapeMode,safeAreaRight,sheetWidth,withTiming,TIMING_CONFIG}=this.__closure;const revealOffset=reveal?0:controlHeightWithOffset;return{position:'absolute',height:sheetHeight,overflow:'hidden',bottom:isLandscapeMode?16:0,right:isLandscapeMode?16+safeAreaRight:0,borderRadius:isLandscapeMode?8:0,width:sheetWidth,transform:[{translateY:withTiming(revealOffset,TIMING_CONFIG)}]};}" }; c7192_32 = { code: "function FocusedControlsBottomControlsTsx9(){const{sheetHeight,offsetY,positionY}=this.__closure;return{height:sheetHeight,transform:[{translateY:offsetY+positionY.get()}]};}" }; export default function FocusedControlsBottomControls(props) { const { children, actionBar, expandedControls, reveal, header, onDrawerClose, omitPTT = false, onDrawerOpen: onDrawerOpen2 } = props; const styles = useStyles(); const [actionBarControlsHeight, setState3] = useState(0); const callback2 = useCallback((a0) => { setState3(a0.nativeEvent.layout.height); }, []); return {header} {actionBar} {omitPTT ? null : } ; }; export const FOCUSED_CONTROLS_HEADER_HEIGHT = 54; export { FocusedControlsBottomDrawer };