Files
discord-decomp/modules/video_calls/native/components/ChannelCallHeaderButtons.tsx
T
2026-11-01 12:12:55 +02:00

34 lines
1.9 KiB
TypeScript

// Metro module 10826 (f10827).
import MediaEngineStore from "../../../../stores/MediaEngineStore";
import { useStateFromStoresObject } from "../../../../_bundle/Module589";
import ChannelCallNavigatorIcon from "./ChannelCallNavigatorIcon";
import { intl, t } from "../../../../intl/index.native";
import Module10827 from "../../../../_bundle/Module10827";
import AudioActionCreators from "../../../../actions/AudioActionCreators";
import useIsPrivateAudioOnlyCall from "../useIsPrivateAudioOnlyCall";
import useSelectedParticipant from "../../useSelectedParticipant";
import Module10828 from "../../../../_bundle/Module10828";
import ChannelRTCActionCreators from "../../../../actions/ChannelRTCActionCreators";
export function CameraButton() {
let videoDeviceId, videoDevices;
const stateFromStoresObject = useStateFromStoresObject([MediaEngineStore], () => ({
isVideoEnabled: MediaEngineStore.isVideoEnabled(),
videoDeviceId: MediaEngineStore.getVideoDeviceId(),
videoDevices: MediaEngineStore.getVideoDevices()
}));
const isVideoEnabled = stateFromStoresObject.isVideoEnabled;
videoDeviceId = stateFromStoresObject.videoDeviceId;
videoDevices = stateFromStoresObject.videoDevices;
return isVideoEnabled ? <ChannelCallNavigatorIcon accessibilityLabel={intl.string(t["t9eQ/g"])} source={Module10827} onPress={function onPress() {
const r9 = Object.keys(videoDevices).find((item) => item !== videoDeviceId);
if (r9 != null) {
AudioActionCreators.setVideoDevice(r9);
}
}} disableBackground /> : null;
}
export function GridButton(props) {
const channel = props.channel;
const isPrivateAudioOnlyCall = useIsPrivateAudioOnlyCall(channel);
return useSelectedParticipant(channel) == null ? null : isPrivateAudioOnlyCall ? null : <ChannelCallNavigatorIcon accessibilityLabel={intl.string(t.HK4JIu)} source={Module10828} onPress={() => ChannelRTCActionCreators.selectParticipant(channel.id, null)} disableBackground />;
}