Files
discord-decomp/modules/voice_panel/native/hooks/useSoundboardConfig.tsx
T
2026-11-01 12:12:55 +02:00

33 lines
1.5 KiB
TypeScript

// Metro module 16020 (f16021).
import { useCallback, useMemo } from "react";
import ChannelStore from "../../../../stores/ChannelStore";
import useIsConnectedToVoiceChannel from "./useIsConnectedToVoiceChannel";
import { useIsDismissibleContentDismissed_UNSAFE } from "../../../dismissible_content/DismissibleContentUnsafeUtils";
import { DismissibleContent } from "../../../../_bundle/Module1358";
import { showSoundboardSoundPickerActionSheet } from "../../../soundboard/native/SoundboardActionCreators";
import canChannelUseSoundboard from "../../../soundboard/canChannelUseSoundboard";
let c11487_5 = {
VOICE_CONTROLS: "call control drawer",
VOICE_PANEL_CONTROLS: "voice panel controls"
};
export default function useSoundboardConfig(a0, a1) {
const analyticsSource = a1;
const isConnectedToVoiceChannel = useIsConnectedToVoiceChannel(a0);
const showIndicator = !useIsDismissibleContentDismissed_UNSAFE(DismissibleContent.SOUNDBOARD_MOBILE_NEW_BADGE);
return {
visible: isConnectedToVoiceChannel && (c11487_5.VOICE_CONTROLS !== a1 ? c11487_5.VOICE_PANEL_CONTROLS === a1 ? true : false : true),
handlePress: useCallback(() => {
const channel = ChannelStore.getChannel(a0);
if (channel != null) {
showSoundboardSoundPickerActionSheet({
channel,
analyticsSource
});
}
}, [a0, a1]),
disabled: useMemo(() => !canChannelUseSoundboard(ChannelStore.getChannel(a0)), [a0]),
showIndicator
};
};
export { c11487_5 as SoundboardButtonLocation };