189 lines
9.1 KiB
TypeScript
189 lines
9.1 KiB
TypeScript
// Metro module 10848 (f10849).
|
|
import * as Module19 from "react";
|
|
import { useContext, useCallback, useMemo } from "react";
|
|
import { StyleSheet, View } from "react-native";
|
|
import ApplicationStreamingStore from "../../../../stores/ApplicationStreamingStore";
|
|
import UserStore from "../../../../stores/UserStore";
|
|
import { resetFocus, toggleFocus } from "../ChannelCallStore";
|
|
import { ParticipantTypes, VoicePlatforms, isStreamParticipant } from "../../../calls/CallConstants";
|
|
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
|
|
import { hexOpacityToRgba } from "../../../../utils/ColorUtils";
|
|
import Module712 from "../../../../_bundle/Module712";
|
|
import useAnalyticsLocations from "../../../app_analytics/useAnalyticsLocations";
|
|
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
|
|
import { useStateFromStoresObject, useStateFromStores } from "../../../../_bundle/Module589";
|
|
import ChannelRTCActionCreators from "../../../../actions/ChannelRTCActionCreators";
|
|
import showUserProfileActionSheet from "../../../user_profile/native/showUserProfileActionSheet";
|
|
import StreamTile from "./StreamTile";
|
|
import ScreenshareParticipant from "./ScreenshareParticipant";
|
|
import UserTile from "./UserTile";
|
|
import ActivityTile from "./ActivityTile";
|
|
import TouchableStreamPreview from "../../../../components_native/TouchableStreamPreview";
|
|
import Module10854 from "../../../../_bundle/Module10854";
|
|
import Module10855 from "../../../../_bundle/Module10855";
|
|
import Module9033 from "../../../../_bundle/Module9033";
|
|
import Module9054 from "../../../../_bundle/Module9054";
|
|
import Module10856 from "../../../../_bundle/Module10856";
|
|
import * as _native from "../../../../design/void/native";
|
|
import { Icon, LiveTag } from "../../../../design/void/native";
|
|
import { RevealContext } from "./RevealProvider";
|
|
import ReanimatedRexport, { useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
|
|
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
|
|
import ParticipantTitle from "./ParticipantTitle";
|
|
let useStyles, ParticipantIcon, __initData, TileOverlay;
|
|
const StreamPreviewTile = function StreamPreviewTile(props) {
|
|
const { participant: participant2, style } = props;
|
|
return <View style={[useStyles().streamPreview, style]}>
|
|
<TouchableStreamPreview guildId={participant2.stream.guildId} userId={participant2.user.id} style={{
|
|
aspectRatio: void 0,
|
|
borderRadius: 0
|
|
}} disableTransition onPress={() => resetFocus()} />
|
|
</View>;
|
|
};
|
|
ParticipantIcon = function ParticipantIcon(props) {
|
|
let source;
|
|
const participant2 = props.participant;
|
|
const styles = useStyles();
|
|
if (participant2.type === ParticipantTypes.STREAM) {
|
|
source = Module10854;
|
|
} else {
|
|
const type = participant2.type;
|
|
const USER = ParticipantTypes.USER;
|
|
source = void 0;
|
|
if (type === USER) {
|
|
const voicePlatform = participant2.voicePlatform;
|
|
source = VoicePlatforms.MOBILE === voicePlatform ? Module10855 : VoicePlatforms.XBOX === voicePlatform ? Module9033 : VoicePlatforms.PLAYSTATION === voicePlatform ? Module9054 : VoicePlatforms.QUEST === voicePlatform ? Module10856 : void 0;
|
|
}
|
|
}
|
|
return source != null ? <Icon source={source} size={Icon.Sizes.REFRESH_SMALL_16} color={Module712.unsafe_rawColors.WHITE} style={styles.titleIcon} /> : null;
|
|
};
|
|
TileOverlay = function TileOverlay(props) {
|
|
const participant2 = props.participant;
|
|
let isActiveStream = props.isActiveStream;
|
|
const { channel: channel2, hasLeftSafeArea, hasRightSafeArea: hasRightSafeArea2, hasBottomSafeArea: hasBottomSafeArea2, hasTopSafeArea } = props;
|
|
const styles = useStyles();
|
|
const safeAreaInsets_native = useSafeAreaInsets_native();
|
|
const { bottom: bottom2, left, top, right: right2 } = safeAreaInsets_native;
|
|
const reveal = useContext(RevealContext).reveal;
|
|
const T = function T() {
|
|
return {
|
|
opacity: _timing.withTiming(reveal ? 1 : 0, {
|
|
easing: _native.STANDARD_EASING,
|
|
duration: 250
|
|
})
|
|
};
|
|
};
|
|
T.__closure = {
|
|
withTiming: _timing.withTiming,
|
|
reveal,
|
|
STANDARD_EASING: _native.STANDARD_EASING
|
|
};
|
|
T.__workletHash = 15640123774063;
|
|
T.__initData = __initData;
|
|
const animatedStyle = useAnimatedStyle(T);
|
|
const r45 = {
|
|
bottom: hasBottomSafeArea2 ? bottom2 : 0,
|
|
right: hasRightSafeArea2 ? right2 : 0,
|
|
left: hasLeftSafeArea ? left : 0,
|
|
top: hasTopSafeArea ? top : 0
|
|
};
|
|
if (isActiveStream) {
|
|
isActiveStream = <View style={styles.liveContainer}>
|
|
<LiveTag />
|
|
</View>;
|
|
}
|
|
return <ReanimatedRexport.View pointerEvents="none" style={[StyleSheet.absoluteFill, r45, animatedStyle]}>
|
|
{isActiveStream}
|
|
<View style={styles.usernamePosition}>
|
|
<View style={styles.usernameContainer}>
|
|
<ParticipantIcon participant={participant2} />
|
|
<ParticipantTitle channel={channel2} participant={participant2} />
|
|
</View>
|
|
</View>
|
|
</ReanimatedRexport.View>;
|
|
};
|
|
useStyles = createStyles({
|
|
liveContainer: {
|
|
position: "absolute",
|
|
top: 8,
|
|
right: 8
|
|
},
|
|
titleIcon: {
|
|
marginRight: 6
|
|
},
|
|
usernameContainer: {
|
|
flexDirection: "row",
|
|
alignItems: "center",
|
|
alignSelf: "flex-start",
|
|
backgroundColor: hexOpacityToRgba(Module712.unsafe_rawColors.PRIMARY_700, 0.5),
|
|
borderRadius: Module712.radii.sm,
|
|
paddingHorizontal: 8,
|
|
paddingVertical: 4
|
|
},
|
|
usernamePosition: {
|
|
overflow: "hidden",
|
|
position: "absolute",
|
|
bottom: 8,
|
|
left: 8,
|
|
right: 40,
|
|
borderRadius: Module712.radii.sm
|
|
},
|
|
streamPreview: {
|
|
flex: 1,
|
|
width: "100%",
|
|
backgroundColor: Module712.unsafe_rawColors.PRIMARY_600
|
|
},
|
|
screenshareContainer: {
|
|
flex: 1,
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
overflow: "hidden",
|
|
width: "100%",
|
|
backgroundColor: Module712.colors.BLACK
|
|
},
|
|
stageStreamContainer: {
|
|
backgroundColor: Module712.colors.BLACK
|
|
}
|
|
});
|
|
const r83 = Module19.memo(function({ participant, avatarSize, channel, hasTopSafeArea, hasLeftSafeArea, hasRightSafeArea, hasBottomSafeArea, shrinkStreamEmptyState, contentStyle, hasNotch = false, resizeMode }) {
|
|
const styles = useStyles();
|
|
const analyticsLocations = useAnalyticsLocations().analyticsLocations;
|
|
const safeAreaInsets_native = useSafeAreaInsets_native();
|
|
const { bottom, right } = safeAreaInsets_native;
|
|
const stateFromStoresObject = useStateFromStoresObject([ApplicationStreamingStore], () => ({
|
|
stream: isStreamParticipant(participant) ? ApplicationStreamingStore.getStreamForUser(participant.user.id, participant.stream.guildId) : null,
|
|
activeStream: isStreamParticipant(participant) ? ApplicationStreamingStore.getActiveStreamForUser(participant.user.id, participant.stream.guildId) : null
|
|
}));
|
|
const { stream, activeStream } = stateFromStoresObject;
|
|
const callback = useCallback(() => {
|
|
resetFocus();
|
|
ChannelRTCActionCreators.selectParticipant(channel.id, participant.id);
|
|
}, [channel.id, participant.id]);
|
|
const callback2 = useCallback((a0) => {
|
|
showUserProfileActionSheet({
|
|
userId: a0.user.id,
|
|
channelId: channel.id,
|
|
isVoiceContext: true,
|
|
sourceAnalyticsLocations: analyticsLocations
|
|
});
|
|
}, [channel.id, analyticsLocations]);
|
|
const memo = useMemo(() => ({
|
|
bottom: hasBottomSafeArea ? 8 + bottom : 8,
|
|
right: hasRightSafeArea ? 8 + right : 8
|
|
}), [hasBottomSafeArea, hasRightSafeArea, bottom, right]);
|
|
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
|
|
const type = participant.type;
|
|
return <>
|
|
{ParticipantTypes.HIDDEN_STREAM === type ? <StreamPreviewTile participant={participant} style={contentStyle} /> : ParticipantTypes.STREAM === type ? activeStream != null ? activeStream.ownerId !== stateFromStores?.id ? <StreamTile participant={participant} onSingleTap={toggleFocus} onDoubleTap={callback} removeEmptyStateImage={shrinkStreamEmptyState} onFullScreen={callback} fullscreenIconStyle={memo} style={contentStyle} /> : <View style={styles.screenshareContainer}>
|
|
<ScreenshareParticipant participant={participant} onSingleTap={toggleFocus} onDoubleTap={callback} containerStyle={channel.isGuildStageVoice() ? styles.stageStreamContainer : void 0} />
|
|
</View> : stream != null ? <StreamPreviewTile participant={participant} style={contentStyle} /> : null : ParticipantTypes.USER === type ? <UserTile participant={participant} avatarSize={avatarSize} onSingleTap={toggleFocus} onDoubleTap={callback} onLongPress={callback2} statusStyle={memo} hasNotch={hasNotch} resizeMode={resizeMode} style={contentStyle} /> : ParticipantTypes.ACTIVITY === type ? <ActivityTile participant={participant} style={contentStyle} channel={channel} onSingleTap={toggleFocus} /> : null}
|
|
{participant.type !== ParticipantTypes.ACTIVITY ? <TileOverlay participant={participant} isActiveStream={activeStream != null} channel={channel} hasTopSafeArea={hasTopSafeArea} hasLeftSafeArea={hasLeftSafeArea} hasRightSafeArea={hasRightSafeArea} hasBottomSafeArea={hasBottomSafeArea} /> : null}
|
|
</>;
|
|
});
|
|
__initData = {
|
|
code: "function CallTileTsx1(){const{withTiming,reveal,STANDARD_EASING}=this.__closure;return{opacity:withTiming(reveal?1:0,{easing:STANDARD_EASING,duration:250})};}"
|
|
};
|
|
export default r83;
|
|
export { StreamPreviewTile };
|
|
export { TileOverlay };
|