95 lines
3.0 KiB
TypeScript
95 lines
3.0 KiB
TypeScript
// Metro module 10778 (f10779).
|
|
import EmojiStore from "../emojis/EmojiStore";
|
|
import "../../stores/SelectedChannelStore";
|
|
import VoiceChannelEffectsPersistedStore from "./VoiceChannelEffectsPersistedStore";
|
|
import { VoiceChannelEffectAnimationType } from "./VoiceChannelEffectsConstants";
|
|
import { Endpoints, NOOP_NULL } from "../../Constants";
|
|
import { DEFAULT_SOUND_GUILD_ID } from "../soundboard/SoundboardConstants";
|
|
import { throttle } from "../../_bundle/Module12";
|
|
import { sampleAnimationId, CUSTOM_CALL_SOUND_ANIMATION_RANGE } from "./VoiceChannelEffectsUtils";
|
|
import { HTTP } from "../../_bundle/sendRequest";
|
|
import trackSoundPlayed from "../soundboard/trackSoundPlayed";
|
|
import AnalyticsLocation from "../app_analytics/AnalyticsLocation";
|
|
import { AnalyticsSoundType } from "../soundboard/SoundboardTypes";
|
|
function $mk85518($env) {
|
|
return () => {
|
|
const r1 = $env;
|
|
if ($env.$parent[4].getVoiceChannelId() !== r1[0]) {
|
|
r1[1].abort();
|
|
}
|
|
};
|
|
}
|
|
let env7241 = {};
|
|
const r28 = {
|
|
EMOJI_PICKER: "emoji_picker",
|
|
EFFECT_BAR: "effect_bar"
|
|
};
|
|
export { r28 as VoiceChannelEffectSentLocation };
|
|
export function sendVoiceChannelCustomCallSoundEffect(a0, a1, a2) {
|
|
let env18260;
|
|
const r6 = env18260 = {
|
|
$parent: env7241
|
|
};
|
|
env18260[0] = a0;
|
|
const abortController = new AbortController();
|
|
env18260[1] = abortController;
|
|
const onRequestProgress = throttle($mk85518(r6), 1000);
|
|
let c18259_0 = abortController;
|
|
let animationType = VoiceChannelEffectsPersistedStore.getState().animationType;
|
|
if (animationType == null) {
|
|
animationType = VoiceChannelEffectAnimationType.BASIC;
|
|
}
|
|
const body = {
|
|
animation_type: animationType,
|
|
animation_id: sampleAnimationId(animationType, CUSTOM_CALL_SOUND_ANIMATION_RANGE)
|
|
};
|
|
HTTP.post({
|
|
url: Endpoints.CUSTOM_CALL_SOUNDS(a0),
|
|
body,
|
|
signal: abortController.signal,
|
|
onRequestProgress,
|
|
rejectWithError: true
|
|
}).then(NOOP_NULL, () => {
|
|
c18259_0.signal.aborted;
|
|
});
|
|
trackSoundPlayed([AnalyticsLocation.CHANNEL_CALL], a2, a1, AnalyticsSoundType.ENTRY);
|
|
}
|
|
export function sendVoiceChannelSoundboardEffect(a0, a1, a2, a3, a4) {
|
|
const r11 = a1.emojiId != null ? EmojiStore.getCustomEmojiById(a1.emojiId) : null;
|
|
let env18262;
|
|
const r27 = env18262 = {
|
|
$parent: env7241
|
|
};
|
|
env18262[0] = a0;
|
|
const abortController = new AbortController();
|
|
env18262[1] = abortController;
|
|
const onRequestProgress = throttle($mk85518(r27), 1000);
|
|
let c18261_0 = abortController;
|
|
let emojiName = a1.emojiName;
|
|
if (emojiName == null) {
|
|
emojiName = r11?.name;
|
|
}
|
|
const body = {
|
|
sound_id: a1.soundId,
|
|
emoji_id: a1.emojiId,
|
|
emoji_name: emojiName
|
|
};
|
|
if (a1.guildId !== DEFAULT_SOUND_GUILD_ID) {
|
|
body.source_guild_id = a1.guildId;
|
|
}
|
|
let r43 = a3;
|
|
HTTP.post({
|
|
url: Endpoints.SEND_SOUNDBOARD_SOUND(a0),
|
|
body,
|
|
signal: abortController.signal,
|
|
onRequestProgress,
|
|
rejectWithError: true
|
|
}).then(NOOP_NULL, () => {
|
|
c18261_0.signal.aborted;
|
|
});
|
|
if (a3 == null) {
|
|
r43 = [];
|
|
}
|
|
trackSoundPlayed(r43, a2, a1, AnalyticsSoundType.DEFAULT, a4);
|
|
}
|