This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,94 @@
// 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);
}
@@ -0,0 +1,9 @@
// Metro module 10573 (f10574).
const r9 = {
PREMIUM: 0,
0: "PREMIUM",
BASIC: 1,
1: "BASIC"
};
export { r9 as VoiceChannelEffectAnimationType };
export const EMOJI_SIZE = 32;
@@ -0,0 +1,27 @@
// Metro module 10779 (f10780).
import { VoiceChannelEffectAnimationType } from "./VoiceChannelEffectsConstants";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let PREMIUM;
class VoiceChannelEffectsPersistedStore extends Module589.PersistedStore {
static displayName = "VoiceChannelEffectsPersistedStore";
static persistKey = "VoiceChannelEffectsPersistedStore";
initialize(a0) {
let r4 = a0?.animationType;
if (r4 == null) {
r4 = VoiceChannelEffectAnimationType.PREMIUM;
}
PREMIUM = r4;
}
getState() {
return {
animationType: PREMIUM
};
}
}
const voiceChannelEffectsPersistedStore = new VoiceChannelEffectsPersistedStore(Dispatcher, {
VOICE_CHANNEL_EFFECT_TOGGLE_ANIMATION_TYPE: function handleToggleAnimationType() {
PREMIUM = PREMIUM === VoiceChannelEffectAnimationType.BASIC ? VoiceChannelEffectAnimationType.PREMIUM : VoiceChannelEffectAnimationType.BASIC;
}
});
export default voiceChannelEffectsPersistedStore;
@@ -0,0 +1,89 @@
// Metro module 10571 (f10572).
import { EMOJI_PICKER_EMOJI_TO_SHOW_COUNT } from "../calls/CallConstants";
import Dispatcher from "../../Dispatcher";
import Durations from "../../utils/Durations";
import { debounce, uniqBy } from "../../_bundle/Module12";
import { getEffectAnnouncement } from "./VoiceChannelEffectsUtils";
import { AccessibilityAnnouncer } from "../../design/shared";
import Module589 from "../../_bundle/Module589";
let c7106_3;
let c7106_5 = [];
let c7106_6 = {};
let c7106_7 = [];
let c7106_8 = [];
let c7106_9 = 10 * Durations.Millis.SECOND;
let c7106_10 = debounce(() => {
AccessibilityAnnouncer.announce(getEffectAnnouncement(c7106_7), "polite");
c7106_7 = [];
}, 500);
class VoiceChannelEffectsStore extends Module589.Store {
static displayName = "VoiceChannelEffectsStore";
get recentlyUsedEmojis() {
return c7106_5;
}
get isOnCooldown() {
return c7106_3 != null && new Date() < c7106_3;
}
get effectCooldownEndTime() {
return c7106_3;
}
getEffectForUserId(a0) {
return c7106_6[a0];
}
}
const voiceChannelEffectsStore = new VoiceChannelEffectsStore(Dispatcher, {
VOICE_CHANNEL_EFFECT_CLEAR: function handleClearVoiceChannelEffect({ userId }) {
if (c7106_6[userId] != null) {
delete c7106_6[userId];
}
},
VOICE_CHANNEL_EFFECT_RECENT_EMOJI: function handleAddRecentlyUsedEmojis({ emoji }) {
if (emoji != null) {
c7106_5.unshift(emoji);
const r16 = uniqBy(c7106_5, "name");
c7106_5 = r16;
if (r16.length > EMOJI_PICKER_EMOJI_TO_SHOW_COUNT + 1) {
c7106_5.pop();
}
}
},
VOICE_CHANNEL_EFFECT_SEND: function handleReceivedVoiceChannelEffect({ emoji, userId, animationType }) {
if (emoji != null && animationType != null) {
c7106_6[userId] = {
emoji,
sentAt: Date.now(),
animationType
};
c7106_7 = [...c7106_7, {
emojiName: emoji.name,
userId
}];
c7106_10();
}
},
VOICE_CHANNEL_EFFECT_SENT_LOCAL: function handleVoiceChannelEffectSentLocal() {
const date = new Date();
const r18 = [date, ...c7106_8].slice(0, 20);
c7106_8 = r18;
if (r18.length >= 20) {
const r20 = c7106_8;
const r9 = r20[r20.length - 1];
const r27 = date.getTime() - r9.getTime();
if (r27 < c7106_9) {
c7106_3 = new Date(date.getTime() + c7106_9 - r27);
}
}
},
VOICE_CHANNEL_EFFECT_UPDATE_TIME_STAMP: function handleTimestampUpdate({ cooldownEndsAtMs }) {
c7106_3 = new Date(Date.now() + cooldownEndsAtMs);
}
});
export default voiceChannelEffectsStore;
export function clearVoiceChannelEffectForUser(a0) {
if (a0 != null) {
Dispatcher.dispatch({
type: "VOICE_CHANNEL_EFFECT_CLEAR",
userId: a0
});
}
}
@@ -0,0 +1,137 @@
// Metro module 10572 (f10573).
import UserStore from "../../stores/UserStore";
import { EMOJI_SIZE, VoiceChannelEffectAnimationType } from "./VoiceChannelEffectsConstants";
import Module10574 from "../../_bundle/Module10574";
import Module10575 from "../../_bundle/Module10575";
import Module10576 from "../../_bundle/Module10576";
import Module10577 from "../../_bundle/Module10577";
import Module10578 from "../../_bundle/Module10578";
import Module10579 from "../../_bundle/Module10579";
import Module10580 from "../../_bundle/Module10580";
import Module10581 from "../../_bundle/Module10581";
import Module10582 from "../../_bundle/Module10582";
import Module10583 from "../../_bundle/Module10583";
import Module10584 from "../../_bundle/Module10584";
import Module10585 from "../../_bundle/Module10585";
import Module10586 from "../../_bundle/Module10586";
import Module10587 from "../../_bundle/Module10587";
import Module10588 from "../../_bundle/Module10588";
import Module10589 from "../../_bundle/Module10589";
import Module10590 from "../../_bundle/Module10590";
import Module10591 from "../../_bundle/Module10591";
import Module10592 from "../../_bundle/Module10592";
import Module10593 from "../../_bundle/Module10593";
import Module10594 from "../../_bundle/Module10594";
import Module10595 from "../../_bundle/Module10595";
import Module12 from "../../_bundle/Module12";
import { getDevicePixelRatio } from "../image_upload/ImageLoaderUtils";
import AvatarUtils from "../../utils/AvatarUtils";
import UnicodeEmojis from "../emojis/UnicodeEmojis";
import EmojiUtils from "../../utils/EmojiUtils";
import { intl, t } from "../../intl/index.native";
function $mk85113($env) {
return (a0) => {
let r4 = a0[$env[0]];
if (r4 == null) {
r4 = null;
}
return r4;
};
}
function $mk85114() {
return (a0) => a0 != null;
}
const r10 = [Module10574];
const r23 = [Module10575, Module10576, Module10577, Module10578, Module10579, Module10580, Module10581, Module10582, Module10583, Module10584, Module10585, Module10586, Module10587, Module10588, Module10589, Module10590, Module10591, Module10592, Module10593, Module10594, Module10595];
const r64 = {};
r64[VoiceChannelEffectAnimationType.BASIC] = r10;
r64[VoiceChannelEffectAnimationType.PREMIUM] = r23;
let c7107_6 = r64;
const r71 = Module12.memoize((src) => new Promise((c26709_0) => {
const image = new Image();
let c26709_1 = image;
image.src = src;
image.crossOrigin = "Anonymous";
image.onload = () => {
const width = EMOJI_SIZE * getDevicePixelRatio();
if (c26709_1.width === width && c26709_1.height === width) {
c26709_0(src);
} else {
const element = document.createElement("canvas");
element.width = width;
element.height = width;
const context = element.getContext("2d");
if (context != null) {
context.drawImage(c26709_1, 0, 0);
}
c26709_0(element.toDataURL("image/png"));
}
};
}));
export const CUSTOM_CALL_SOUND_ANIMATION_RANGE = {
start: 10,
end: 15
};
export { c7107_6 as AnimationTypeToAnimations };
export { r71 as getResizedEmojiData };
export function sampleAnimationId(a0, a1) {
const r8 = c7107_6[a0];
if (a1 != null && a0 === VoiceChannelEffectAnimationType.PREMIUM) {
const r19 = a1.end + 1;
return Math.floor(Math.random() * (a1.start - r19) + r19);
}
return Math.floor(Math.random() * r8.length);
}
export function getEffectUrl(a0, size = EMOJI_SIZE) {
if (a0.id != null) {
let animated = a0.animated;
if (animated == null) {
animated = false;
}
return AvatarUtils.getEmojiURL({
id: a0.id,
animated,
size
});
}
const byName = UnicodeEmojis.getByName(UnicodeEmojis.convertSurrogateToName(a0.name, false));
return byName != null ? EmojiUtils.getURL(byName.surrogates) : "";
}
export function getEffectAnnouncement(a0) {
let emojiNames;
if (a0.length < 1) {
return "";
}
let env18138;
let env18139;
const r18 = env18138 = {};
env18138[0] = "userId";
const r30 = Module12(a0).map($mk85113(r18)).filter($mk85114()).uniq().value();
const r31 = env18139 = {};
env18139[0] = "emojiName";
const r45 = Module12(a0).map($mk85113(r31)).filter($mk85114()).uniq().value();
if (r45.length < 2) {
let r49 = r45 == null ? void 0 : r45[0];
if (r49 == null) {
r49 = "";
}
emojiNames = r49;
} else {
emojiNames = r45.join(", ");
}
const r51 = r30.length < 1;
const r52 = r51 ? "" : r30.length === 1 ? intl.formatToPlainString(t.yZYxzF, {
firstUsername: UserStore.getUser(r30[0])?.username,
emojiNames
}) : r30.length === 2 ? intl.formatToPlainString(t["8rmtbd"], {
firstUsername: UserStore.getUser(r30[0])?.username,
secondUsername: UserStore.getUser(r30[1])?.username,
emojiNames
}) : intl.formatToPlainString(t["/okjv0"], {
firstUsername: UserStore.getUser(r30[0])?.username,
secondUsername: UserStore.getUser(r30[1])?.username,
count: r30.length - 2,
emojiNames
});
return r52;
}
@@ -0,0 +1,138 @@
// Metro module 10600 (f10601).
import { useEffect } from "react";
import { View } from "react-native";
import AccessibilityStore from "../../a11y/AccessibilityStore";
import Durations from "../../../utils/Durations";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import FastImage from "../../../components_native/common/FastImage";
import * as _native from "../../../design/void/native";
import { LegacyText, generateBoxShadowStyle, EIGHT_DP_ELEVATION_SHADOW_PARAMS } from "../../../design/void/native";
import { useStateFromStores } from "../../../_bundle/Module589";
import * as _ReanimatedRexport from "../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useAnimatedStyle } from "../../reanimated/ReanimatedRexport";
import * as _timing from "../../../design/animation/reanimated/timing/timing";
import { getEffectUrl } from "../VoiceChannelEffectsUtils";
let c7109_7, c7109_8, useStyles, __initData;
const Emoji = function Emoji(props) {
const { url, surrogates } = props;
const styles = useStyles();
return url !== "" ? <FastImage resizeMode="contain" style={[styles.imageEmoji]} source={{
uri: url
}} /> : <LegacyText style={[styles.textEmoji]} allowFontScaling={false}>{surrogates}</LegacyText>;
};
c7109_7 = 6 * Durations.Millis.SECOND;
c7109_8 = 2 * Durations.Millis.SECOND;
useStyles = createStyles({
voiceChannelEffectEmojiContainer: {
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
borderRadius: Module712.radii.round,
position: "absolute",
right: 16,
top: 16
},
voiceChannelEffectEmojiContainerTileNotch: {
right: "auto",
left: 16
},
voiceChannelEffectEmoji: {
padding: 12
},
textEmoji: {
fontSize: 32,
lineHeight: 38,
alignContent: "center",
justifyContent: "center",
display: "flex",
width: 32,
height: 32
},
imageEmoji: {
width: 32,
height: 32
}
});
__initData = {
code: "function AnimatedEffectEmojiTsx1(){const{withSequence,withTiming,ANIMATION_ROTATION_DEG,withDelay,useReducedMotion,STANDARD_EASING}=this.__closure;const rotate=withSequence(withTiming(ANIMATION_ROTATION_DEG+\"deg\",{duration:0}),withDelay(100,withTiming('0deg',{duration:useReducedMotion?0:300,easing:STANDARD_EASING})));const scale=withSequence(withTiming(0,{duration:0}),withDelay(100,withTiming(1,{duration:useReducedMotion?0:300,easing:STANDARD_EASING})));return{transform:[{scale:scale},{rotate:rotate}]};}"
};
export default function AnimatedEffectEmoji(props) {
const { userId, voiceChannelEffect } = props;
let hasNotch = props.hasNotch;
if (hasNotch === void 0) {
hasNotch = false;
}
const onComplete = props.onComplete;
const styles = useStyles();
const { emoji, sentAt } = voiceChannelEffect;
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
useEffect(() => {
let c26710_0;
if (Date.now() - sentAt >= c7109_8) {
if (onComplete != null) {
onComplete();
}
} else {
c26710_0 = setTimeout(() => {
if (onComplete != null) {
onComplete();
}
}, c7109_7);
}
return () => {
if (c26710_0 != null) {
clearTimeout(c26710_0);
}
};
}, [sentAt, userId, onComplete]);
const N = function N() {
const r20 = _timing.withTiming("-120deg", {
duration: 0
});
let duration = 300;
const rotate = _ReanimatedRexport.withSequence(r20, _ReanimatedRexport.withDelay(100, _timing.withTiming("0deg", {
duration: stateFromStores ? 0 : 300,
easing: _native.STANDARD_EASING
})));
const r41 = _timing.withTiming(0, {
duration: 0
});
if (stateFromStores) {
duration = 0;
}
return {
transform: [{
scale: _ReanimatedRexport.withSequence(r41, _ReanimatedRexport.withDelay(100, _timing.withTiming(1, {
duration,
easing: _native.STANDARD_EASING
})))
}, {
rotate
}]
};
};
N.__closure = {
withSequence: _ReanimatedRexport.withSequence,
withTiming: _timing.withTiming,
ANIMATION_ROTATION_DEG: -120,
withDelay: _ReanimatedRexport.withDelay,
useReducedMotion: stateFromStores,
STANDARD_EASING: _native.STANDARD_EASING
};
N.__workletHash = 75069010226;
N.__initData = __initData;
const animatedStyle = useAnimatedStyle(N);
let r47 = null;
if (emoji != null) {
const style = [styles.voiceChannelEffectEmojiContainer, generateBoxShadowStyle(EIGHT_DP_ELEVATION_SHADOW_PARAMS), animatedStyle, ,];
if (hasNotch) {
hasNotch = styles.voiceChannelEffectEmojiContainerTileNotch;
}
style[3] = hasNotch;
r47 = <ReanimatedRexport.View style={style}>
<View style={styles.voiceChannelEffectEmoji}>
<Emoji url={getEffectUrl(emoji)} surrogates={emoji.name} />
</View>
</ReanimatedRexport.View>;
}
return r47;
};