34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
// Metro module 12035 (f12036).
|
|
import PresenceStore from "../../../stores/PresenceStore";
|
|
import VoiceStateStore from "../../../stores/VoiceStateStore";
|
|
import isEmbeddedActivity from "../../activities/utils/isEmbeddedActivity";
|
|
import useUserVoiceActivity from "../../activity_status/useUserVoiceActivity";
|
|
import { useStateFromStores } from "../../../_bundle/Module589";
|
|
export default function useUserProfileVoiceActivity({ userId, guildId }) {
|
|
const userVoiceActivity = useUserVoiceActivity({
|
|
userId,
|
|
guildId
|
|
});
|
|
const { voiceState, voiceChannel } = userVoiceActivity;
|
|
const id = voiceChannel?.id;
|
|
return {
|
|
voiceState,
|
|
voiceChannel,
|
|
voiceActivity: useStateFromStores([PresenceStore, VoiceStateStore], () => {
|
|
if (userId != null && id != null) {
|
|
let r9 = PresenceStore.findActivity(userId, (a0) => {
|
|
const voiceStateForSession = VoiceStateStore.getVoiceStateForSession(userId, a0.session_id);
|
|
return isEmbeddedActivity(a0) && voiceStateForSession?.channelId === id;
|
|
});
|
|
if (r9 == null) {
|
|
r9 = void 0;
|
|
}
|
|
return r9;
|
|
}
|
|
})
|
|
};
|
|
};
|
|
export function isUserProfileVoiceActivityForChannel({ activity, voiceChannelId, voiceStateForSession }) {
|
|
return isEmbeddedActivity(activity) && voiceStateForSession?.channelId === voiceChannelId;
|
|
}
|