129 lines
6.5 KiB
TypeScript
129 lines
6.5 KiB
TypeScript
// Metro module 15111 (f15112).
|
|
import { memo } from "react";
|
|
import { View } from "react-native";
|
|
import AccessibilityStore from "../../a11y/AccessibilityStore";
|
|
import { AvatarSizes, Avatar, Icon, LiveTag, AVATAR_SIZE_MAP } from "../../../design/void/native";
|
|
import { scaleTextLineHeight } from "../../screen/native/useScaledTextLineHeight.android";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import { makeSizeStyle } from "../../main_tabs_v2/native/shared_components/guild_channels/layouts/ChannelListLayout";
|
|
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 AvatarUtils from "../../../utils/AvatarUtils";
|
|
import VoiceUserNameItem from "./VoiceUserNameItem";
|
|
import { MicrophoneDenyIcon } from "../../../design/components/Icon/native/redesign/generated/MicrophoneDenyIcon";
|
|
import { MicrophoneSlashIcon } from "../../../design/components/Icon/native/redesign/generated/MicrophoneSlashIcon";
|
|
import { HeadphonesDenyIcon } from "../../../design/components/Icon/native/redesign/generated/HeadphonesDenyIcon";
|
|
import { HeadphonesSlashIcon } from "../../../design/components/Icon/native/redesign/generated/HeadphonesSlashIcon";
|
|
import { VideoIcon } from "../../../design/components/Icon/native/redesign/generated/VideoIcon";
|
|
import Module6614 from "../../../_bundle/Module6614";
|
|
import getConsoleIcon, { getConsoleIconForVoicePlatform } from "../../game_console/native/getConsoleIcon";
|
|
const variant = "text-sm/medium";
|
|
const color = "redesign-channel-name-muted-text";
|
|
const XSMALL_20 = AvatarSizes.XSMALL_20;
|
|
const useStyles = createStyles({
|
|
voiceState: {
|
|
flex: 1,
|
|
flexDirection: "row",
|
|
alignItems: "center",
|
|
paddingVertical: 5
|
|
},
|
|
disabled: {
|
|
opacity: 0.5
|
|
},
|
|
voiceStateCollapsed: {
|
|
marginTop: 4,
|
|
marginRight: 8,
|
|
width: 32,
|
|
height: 32,
|
|
borderRadius: Module712.radii.lg,
|
|
borderWidth: 4,
|
|
borderColor: Module712.colors.BACKGROUND_BASE_LOW,
|
|
alignItems: "center",
|
|
overflow: "hidden"
|
|
},
|
|
voiceStateIcon: {
|
|
marginLeft: 6,
|
|
...makeSizeStyle(14)
|
|
},
|
|
legacyVoiceStateIcon: {
|
|
tintColor: Module712.colors.REDESIGN_CHANNEL_NAME_MUTED_TEXT,
|
|
marginLeft: 6
|
|
}
|
|
});
|
|
const __initData = {
|
|
code: "function VoiceUserItemTsx1(){const{ringing,shouldAnimate,PULSE_ENDING_OPACITY,withRepeat,withSequence,withDelay,INNER_PULSE_DELAY,withTiming,PULSE_DURATION,Easing,PULSE_STARTING_OPACITY,FADE_DURATION}=this.__closure;if(!ringing){return{opacity:1.0};}else if(!shouldAnimate){return{opacity:PULSE_ENDING_OPACITY};}return{opacity:withRepeat(withSequence(withDelay(INNER_PULSE_DELAY,withTiming(PULSE_ENDING_OPACITY,{duration:PULSE_DURATION,easing:Easing.bezier(0.4,0.0,1,1)})),withDelay(PULSE_DURATION,withTiming(PULSE_STARTING_OPACITY,{duration:FADE_DURATION}))),-1)};}"
|
|
};
|
|
const r63 = memo(function VoiceUserItem(props) {
|
|
let r154;
|
|
let member, user, guildId, ringing, stateFromStores;
|
|
const getSource = function getSource() {
|
|
return member != null && member.avatar != null ? AvatarUtils.getGuildMemberAvatarSource(member, user) : user.getAvatarSource(guildId);
|
|
};
|
|
member = props.member;
|
|
user = props.user;
|
|
guildId = props.guildId;
|
|
const { collapsed, stream, serverMute, serverDeaf, mute, deaf, localMute, video, disabled } = props;
|
|
let platform2 = props.platform;
|
|
const { isInEmbeddedActivity, voicePlatform } = props;
|
|
ringing = props.ringing;
|
|
const styles = useStyles();
|
|
stateFromStores = useStateFromStores([AccessibilityStore], () => !AccessibilityStore.useReducedMotion);
|
|
const c = function c() {
|
|
return ringing ? stateFromStores ? {
|
|
opacity: _ReanimatedRexport.withRepeat(_ReanimatedRexport.withSequence(_ReanimatedRexport.withDelay(100, _timing.withTiming(0.4, {
|
|
duration: 250,
|
|
easing: _ReanimatedRexport.Easing.bezier(0.4, 0, 1, 1)
|
|
})), _ReanimatedRexport.withDelay(250, _timing.withTiming(0.1, {
|
|
duration: 500
|
|
}))), -1)
|
|
} : {
|
|
opacity: 0.4
|
|
} : {
|
|
opacity: 1
|
|
};
|
|
};
|
|
c.__closure = {
|
|
ringing,
|
|
shouldAnimate: stateFromStores,
|
|
PULSE_ENDING_OPACITY: 0.4,
|
|
withRepeat: _ReanimatedRexport.withRepeat,
|
|
withSequence: _ReanimatedRexport.withSequence,
|
|
withDelay: _ReanimatedRexport.withDelay,
|
|
INNER_PULSE_DELAY: 100,
|
|
withTiming: _timing.withTiming,
|
|
PULSE_DURATION: 250,
|
|
Easing: _ReanimatedRexport.Easing,
|
|
PULSE_STARTING_OPACITY: 0.1,
|
|
FADE_DURATION: 500
|
|
};
|
|
c.__workletHash = 9430639809025;
|
|
c.__initData = __initData;
|
|
const animatedStyle = useAnimatedStyle(c);
|
|
if (collapsed) {
|
|
r154 = <View style={styles.voiceStateCollapsed}>
|
|
<Avatar source={getSource} size={XSMALL_20} />
|
|
</View>;
|
|
} else {
|
|
const style = [styles.voiceState, disabled && styles.disabled, animatedStyle];
|
|
const r75 = [<Avatar source={getSource} size={XSMALL_20} />, <VoiceUserNameItem variant={variant} color={color} {...props} />, disabled ? null : serverMute ? <MicrophoneDenyIcon style={styles.voiceStateIcon} color="text-feedback-critical" size="custom" /> : localMute ? <MicrophoneDenyIcon style={styles.voiceStateIcon} size="custom" color={color} /> : mute ? <MicrophoneSlashIcon style={styles.voiceStateIcon} size="custom" color={color} /> : null, disabled ? null : serverDeaf ? <HeadphonesDenyIcon style={styles.voiceStateIcon} color="text-feedback-critical" size="custom" /> : deaf ? <HeadphonesSlashIcon style={styles.voiceStateIcon} size="custom" color={color} /> : null, video ? disabled ? null : <VideoIcon size="custom" color={color} style={styles.voiceStateIcon} /> : null, isInEmbeddedActivity ? <Icon source={Module6614} size={Icon.Sizes.REFRESH_SMALL_16} style={styles.legacyVoiceStateIcon} /> : null, , ,];
|
|
if (platform2 == null) {
|
|
platform2 = "";
|
|
}
|
|
let source = getConsoleIcon(platform2);
|
|
if (source == null) {
|
|
source = getConsoleIconForVoicePlatform(voicePlatform);
|
|
}
|
|
r75[6] = source != null ? <Icon source={source} size={Icon.Sizes.REFRESH_SMALL_16} style={styles.legacyVoiceStateIcon} /> : null;
|
|
r75[7] = stream ? <LiveTag style={styles.legacyVoiceStateIcon} /> : null;
|
|
r154 = <ReanimatedRexport.View style={style}>{r75}</ReanimatedRexport.View>;
|
|
}
|
|
return r154;
|
|
});
|
|
export default r63;
|
|
export function getVoiceUserHeight(a0) {
|
|
return Math.max(scaleTextLineHeight(variant, a0), AVATAR_SIZE_MAP[XSMALL_20]) + 10;
|
|
}
|