81 lines
5.3 KiB
TypeScript
81 lines
5.3 KiB
TypeScript
// Metro module 15916 (f15917).
|
|
import { VoicePanelModes } from "../../VoicePanelConstants";
|
|
import { VoicePanelControlsModes } from "../controls/VoicePanelControlsConstants";
|
|
import { PIP_WINDOW_OFFSET } from "../../../panels/morphable/native/MorphablePanelConstants";
|
|
import { useSharedValue, useAnimatedReaction } from "../../../reanimated/ReanimatedRexport";
|
|
import useAnimatedKeyboardHeight from "../../../keyboard/native/useAnimatedKeyboardHeight";
|
|
import useScreenNameSharedValue from "../../../panels/morphable/native/useScreenNameSharedValue";
|
|
import { useToken } from "../../../../design/tokens/native/useToken";
|
|
import Module712 from "../../../../_bundle/Module712";
|
|
import * as _cheapWorkletShallowEqual from "../../../reanimated/native/cheapWorkletShallowEqual";
|
|
import getPIPBottomOffsetForPIPMode from "../../../panels/morphable/native/getPIPBottomOffsetForPIPMode";
|
|
import getAdjustedBottomOffsets from "../../../panels/morphable/native/getAdjustedBottomOffsets";
|
|
import calculateVoicePanelHeaderSpecs from "../header/calculateVoicePanelHeaderSpecs";
|
|
import updateSharedValueIfChanged_native from "../../../reanimated/utils/updateSharedValueIfChanged.native";
|
|
const __initData = {
|
|
code: "function usePIPAvoidanceSpecsTsx1(){const{mode,controlsSpecs,keyboardHeight,safeArea,screenName}=this.__closure;return{mode:mode.get(),controlsSpecs:controlsSpecs.get(),keyboardHeight:keyboardHeight.get(),safeArea:safeArea.get(),screenName:screenName.get()};}"
|
|
};
|
|
const __initData2 = {
|
|
code: "function usePIPAvoidanceSpecsTsx2(props,previous){const{cheapWorkletShallowEqual,VoicePanelModes,VoicePanelControlsModes,DEFAULT_CHANNEL_INPUT_HEIGHT,PIP_WINDOW_OFFSET,getPIPBottomOffsetForPIPMode,getAdjustedBottomOffsets,calculateVoicePanelHeaderSpecs,edgeGutter,updateSharedValueIfChanged,pipAvoidanceSpecs}=this.__closure;if(cheapWorkletShallowEqual(props,previous!==null&&previous!==void 0?previous:undefined))return;const{mode:mode,controlsSpecs:controlsSpecs,keyboardHeight:keyboardHeight,safeArea:safeArea,screenName:screenName}=props;const screenBottomOffset=function(){if(mode!==VoicePanelModes.PIP){if(mode===VoicePanelModes.PANEL&&controlsSpecs.mode===VoicePanelControlsModes.DRAWER){return DEFAULT_CHANNEL_INPUT_HEIGHT+PIP_WINDOW_OFFSET;}return 0;}return getPIPBottomOffsetForPIPMode(screenName);}();let{bottomOffset:bottomOffset}=getAdjustedBottomOffsets({screenBottomOffset:screenBottomOffset,safeAreaBottom:safeArea.bottom,keyboardHeight:keyboardHeight});if(keyboardHeight<=0&&mode===VoicePanelModes.PANEL&&controlsSpecs.mode===VoicePanelControlsModes.FLOATING_DEFAULT){bottomOffset+=controlsSpecs.height+PIP_WINDOW_OFFSET;}const{height:headerHeight}=calculateVoicePanelHeaderSpecs(safeArea,edgeGutter);updateSharedValueIfChanged(pipAvoidanceSpecs,{top:mode===VoicePanelModes.PANEL&&controlsSpecs.mode===VoicePanelControlsModes.FLOATING_DEFAULT?headerHeight:0,bottom:bottomOffset});}"
|
|
};
|
|
export default function usePIPAvoidanceSpecs({ mode, controlsSpecs, safeArea }) {
|
|
const sharedValue = useSharedValue({
|
|
top: 0,
|
|
bottom: 0
|
|
});
|
|
const animatedKeyboardHeight = useAnimatedKeyboardHeight();
|
|
let c22601_4 = animatedKeyboardHeight;
|
|
const screenNameSharedValue = useScreenNameSharedValue();
|
|
let c22601_5 = screenNameSharedValue;
|
|
const token = useToken(Module712.modules.mobile.VOICE_PANEL_GUTTER);
|
|
const r35 = () => ({
|
|
mode: mode.get(),
|
|
controlsSpecs: controlsSpecs.get(),
|
|
keyboardHeight: c22601_4.get(),
|
|
safeArea: safeArea.get(),
|
|
screenName: c22601_5.get()
|
|
});
|
|
r35.__closure = {
|
|
mode,
|
|
controlsSpecs,
|
|
keyboardHeight: animatedKeyboardHeight,
|
|
safeArea,
|
|
screenName: screenNameSharedValue
|
|
};
|
|
r35.__workletHash = 17017598468922;
|
|
r35.__initData = __initData;
|
|
const u = function u(a0, a1) {
|
|
if (!_cheapWorkletShallowEqual.cheapWorkletShallowEqual(a0, a1 == null ? void 0 : a1)) {
|
|
const { mode: mode2, controlsSpecs: controlsSpecs2, keyboardHeight, safeArea: safeArea2, screenName } = a0;
|
|
const bottomOffset = getAdjustedBottomOffsets({
|
|
screenBottomOffset: mode2 !== VoicePanelModes.PIP ? mode2 === VoicePanelModes.PANEL ? controlsSpecs2.mode === VoicePanelControlsModes.DRAWER ? 60 + PIP_WINDOW_OFFSET : 0 : 0 : getPIPBottomOffsetForPIPMode(screenName),
|
|
safeAreaBottom: safeArea2.bottom,
|
|
keyboardHeight
|
|
}).bottomOffset;
|
|
const bottom = keyboardHeight <= 0 && mode2 === VoicePanelModes.PANEL && controlsSpecs2.mode === VoicePanelControlsModes.FLOATING_DEFAULT ? bottomOffset + (controlsSpecs2.height + PIP_WINDOW_OFFSET) : bottomOffset;
|
|
const height = calculateVoicePanelHeaderSpecs(safeArea2, token).height;
|
|
updateSharedValueIfChanged_native(sharedValue, {
|
|
top: mode2 === VoicePanelModes.PANEL ? controlsSpecs2.mode === VoicePanelControlsModes.FLOATING_DEFAULT ? height : 0 : 0,
|
|
bottom
|
|
});
|
|
}
|
|
};
|
|
u.__closure = {
|
|
cheapWorkletShallowEqual: _cheapWorkletShallowEqual.cheapWorkletShallowEqual,
|
|
VoicePanelModes,
|
|
VoicePanelControlsModes,
|
|
DEFAULT_CHANNEL_INPUT_HEIGHT: 60,
|
|
PIP_WINDOW_OFFSET,
|
|
getPIPBottomOffsetForPIPMode,
|
|
getAdjustedBottomOffsets,
|
|
calculateVoicePanelHeaderSpecs,
|
|
edgeGutter: token,
|
|
updateSharedValueIfChanged: updateSharedValueIfChanged_native,
|
|
pipAvoidanceSpecs: sharedValue
|
|
};
|
|
u.__workletHash = 13029906729161;
|
|
u.__initData = __initData2;
|
|
useAnimatedReaction(r35, u);
|
|
return sharedValue;
|
|
};
|