149 lines
7.7 KiB
TypeScript
149 lines
7.7 KiB
TypeScript
// Metro module 16028 (f16029).
|
|
import { memo, useContext, useCallback, useEffect, useMemo } from "react";
|
|
import { ScrollView } from "react-native";
|
|
import ChannelStore from "../../../../stores/ChannelStore";
|
|
import { CONTROLS_DRAWER_HEADER_EXPANDED_SIZE } from "./VoicePanelControlsConstants";
|
|
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../../_bundle/Module712";
|
|
import ReanimatedRexport, { useSharedValue } from "../../../reanimated/ReanimatedRexport";
|
|
import VoicePanelStateContext from "../VoicePanelStateContext";
|
|
import useIsConnectedToVoiceChannel from "../hooks/useIsConnectedToVoiceChannel";
|
|
import { useEmbeddedActivityLaunchability, EmbeddedActivityLaunchability } from "../../../activities/utils/getEmbeddedActivityLaunchability";
|
|
import { DeveloperMode } from "../../../user_settings/UserSettings";
|
|
import MobileGoLiveEntrypointExperiment, { MobileGoLiveEntrypointTreatment } from "../../../go_live/MobileGoLiveEntrypointExperiment";
|
|
import MobileAudioOutputExperiment from "../../../media_engine/MobileAudioOutputExperiment";
|
|
import useSelectedActiveStream from "../../../video_calls/native/useSelectedActiveStream";
|
|
import { Stack } from "../../../../design/components/Stack/native/Stack.native";
|
|
import { TableRowGroup } from "../../../../design/components/TableRow/native/TableRowGroup.native";
|
|
import { ActivitiesButton, ChatButton, SoundboardButton, ScreenshareButton, GameConsoles, StreamVolumeItem, DeafenSwitch, AudioRouteButton, HideNonVideoParticipants, HideSelfVideo, InviteButton, VoiceSettingsButton, ReportStreamIssueButton, LeaveActivitiesButton, ShareActivityLogsButton, ToggleShowActivitiesDebugOverlay } from "./VoicePanelVoiceControlsButtons";
|
|
import { intl, t } from "../../../../intl/index.native";
|
|
import { VoiceProcessingOptions } from "../../../user_settings/voice/native/UserSettingsVoiceProcessing";
|
|
import { useStateFromStores } from "../../../../_bundle/Module589";
|
|
import { ControlsGestureScrollLock } from "./utils/createUseAnimatedScrollLock";
|
|
import { useIsScreenReaderEnabled } from "../../../a11y/native/useIsScreenReaderEnabled.native";
|
|
import { GestureDetector, Gesture } from "../../../../_bundle/Module5273";
|
|
import { isMetaQuest } from "../../../device/MetaQuestUtils.android";
|
|
import NativeView from "../../../core/native/NativeView";
|
|
import { SafeAreaPaddingView } from "../../../../components_native/common/SafeAreaView";
|
|
import VoicePanelHeaderGlassBlur from "../shared/VoicePanelHeaderGlassBlur";
|
|
let useStyles, AnimatedComponent, Component, scrollIndicatorInsets, __initData;
|
|
const NOOP = function NOOP() {};
|
|
useStyles = createStyles({
|
|
scrollView: {
|
|
flex: 1,
|
|
paddingHorizontal: Module712.space.PX_16
|
|
},
|
|
scrollViewScreenReader: {
|
|
flex: 1,
|
|
paddingHorizontal: Module712.space.PX_16,
|
|
marginTop: CONTROLS_DRAWER_HEADER_EXPANDED_SIZE
|
|
},
|
|
blurRegion: {
|
|
height: CONTROLS_DRAWER_HEADER_EXPANDED_SIZE
|
|
}
|
|
});
|
|
AnimatedComponent = ReanimatedRexport.createAnimatedComponent(ScrollView);
|
|
Component = memo(function({ channel, openTab }) {
|
|
const channelId2 = useContext(VoicePanelStateContext).channelId;
|
|
const isConnectedToVoiceChannel = useIsConnectedToVoiceChannel(channelId2);
|
|
const embeddedActivityLaunchability = useEmbeddedActivityLaunchability(channelId2);
|
|
const setting = DeveloperMode.useSetting();
|
|
const treatment = MobileGoLiveEntrypointExperiment.useConfig({
|
|
location: "VoicePanelVoiceControls"
|
|
}).treatment;
|
|
let nonContextualStreamOutputPresent = MobileAudioOutputExperiment.useConfig({
|
|
location: "VoicePanelVoiceControls"
|
|
}).nonContextualStreamOutputPresent;
|
|
const selectedActiveStream = useSelectedActiveStream(channel);
|
|
const r79 = [isConnectedToVoiceChannel ? <TableRowGroup hasIcons>
|
|
<ActivitiesButton openTab={openTab} />
|
|
{MobileGoLiveEntrypointTreatment.SCREENSHARE_REPLACES_CHAT === treatment ? <ChatButton openTab={openTab} /> : MobileGoLiveEntrypointTreatment.SCREENSHARE_REPLACES_SOUNDBOARD === treatment ? <SoundboardButton channel={channel} /> : <ScreenshareButton channel={channel} />}
|
|
</TableRowGroup> : isConnectedToVoiceChannel, <GameConsoles channel={channel} connected={isConnectedToVoiceChannel} />, , , , , ,];
|
|
if (nonContextualStreamOutputPresent) {
|
|
nonContextualStreamOutputPresent = <StreamVolumeItem />;
|
|
}
|
|
r79[2] = nonContextualStreamOutputPresent;
|
|
r79[3] = <TableRowGroup title={intl.string(t.NiTd0e)} hasIcons>
|
|
<DeafenSwitch />
|
|
<AudioRouteButton channel={channel} connected={isConnectedToVoiceChannel} />
|
|
<HideNonVideoParticipants channelId={channelId2} />
|
|
<HideSelfVideo />
|
|
{isConnectedToVoiceChannel && <InviteButton channel={channel} connected={isConnectedToVoiceChannel} />}
|
|
</TableRowGroup>;
|
|
r79[4] = <VoiceProcessingOptions />;
|
|
r79[5] = <TableRowGroup hasIcons>
|
|
<VoiceSettingsButton guildId={channel.guild_id} />
|
|
{selectedActiveStream != null && <ReportStreamIssueButton stream={selectedActiveStream} />}
|
|
</TableRowGroup>;
|
|
r79[6] = isConnectedToVoiceChannel ? setting ? embeddedActivityLaunchability === EmbeddedActivityLaunchability.CAN_LAUNCH ? <TableRowGroup title={intl.string(t.J6rqB7)} hasIcons>
|
|
<LeaveActivitiesButton />
|
|
<ShareActivityLogsButton />
|
|
<ToggleShowActivitiesDebugOverlay />
|
|
</TableRowGroup> : null : null : null;
|
|
return <Stack spacing={24}>{r79}</Stack>;
|
|
});
|
|
scrollIndicatorInsets = {
|
|
top: CONTROLS_DRAWER_HEADER_EXPANDED_SIZE
|
|
};
|
|
__initData = {
|
|
code: "function VoicePanelVoiceControlsTsx1({offset:offset}){const{isScrolled}=this.__closure;isScrolled.set(offset>0);}"
|
|
};
|
|
const r56 = memo(function VoicePanelVoiceControls(props) {
|
|
let sharedValue, gestureRef, scrollerRef;
|
|
const { isVisible, openTab } = props;
|
|
sharedValue = void 0;
|
|
gestureRef = void 0;
|
|
scrollerRef = void 0;
|
|
const styles = useStyles();
|
|
const channelId = useContext(VoicePanelStateContext).channelId;
|
|
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId));
|
|
sharedValue = useSharedValue(false);
|
|
const r37 = function(a0) {
|
|
sharedValue.set(a0.offset > 0);
|
|
};
|
|
r37.__closure = {
|
|
isScrolled: sharedValue
|
|
};
|
|
r37.__workletHash = 16758626276795;
|
|
r37.__initData = __initData;
|
|
const callback = useCallback(r37, [sharedValue]);
|
|
const r48 = useContext(ControlsGestureScrollLock)({
|
|
onScrollHandlerWorkletized: callback
|
|
});
|
|
const onScroll = r48.onScroll;
|
|
gestureRef = r48.gestureRef;
|
|
scrollerRef = r48.scrollerRef;
|
|
const animatedProps = r48.animatedProps;
|
|
const isScreenReaderEnabled = useIsScreenReaderEnabled();
|
|
useEffect(() => {
|
|
let r2 = isVisible;
|
|
if (isVisible) {
|
|
r2 = scrollerRef != null;
|
|
}
|
|
if (r2) {
|
|
const current = scrollerRef.current;
|
|
if (current != null) {
|
|
current.scrollTo({
|
|
x: 0,
|
|
y: 0,
|
|
animated: false
|
|
});
|
|
}
|
|
}
|
|
}, [isVisible, scrollerRef]);
|
|
return <>
|
|
<GestureDetector gesture={useMemo(() => {
|
|
const r15 = Gesture.Native().enabled(!isMetaQuest());
|
|
return gestureRef != null ? r15.simultaneousWithExternalGesture(gestureRef) : r15;
|
|
}, [gestureRef])}>
|
|
<AnimatedComponent style={isScreenReaderEnabled ? styles.scrollViewScreenReader : styles.scrollView} ref={scrollerRef} onScroll={onScroll} animatedProps={animatedProps} onMomentumScrollEnd={NOOP} scrollEventThrottle={8.333333333333334} scrollIndicatorInsets={scrollIndicatorInsets}>
|
|
{isScreenReaderEnabled ? !isScreenReaderEnabled : <NativeView style={styles.blurRegion} />}
|
|
{stateFromStores != null && <Component channel={stateFromStores} openTab={openTab} />}
|
|
<SafeAreaPaddingView bottom />
|
|
</AnimatedComponent>
|
|
</GestureDetector>
|
|
{isScreenReaderEnabled ? !isScreenReaderEnabled : <VoicePanelHeaderGlassBlur shown={sharedValue} style={styles.blurRegion} />}
|
|
</>;
|
|
});
|
|
export default r56;
|