Files
discord-decomp/modules/user_profile/native/UserProfileActivity.tsx
T
2026-11-01 12:12:55 +02:00

636 lines
29 KiB
TypeScript

// Metro module 11989 (f11990).
import { useCallback } from "react";
import { TouchableOpacity, TouchableWithoutFeedback, View } from "react-native";
import ApplicationStore from "../../applications/ApplicationStore";
import ApplicationStreamingStore from "../../../stores/ApplicationStreamingStore";
import ChannelStore from "../../../stores/ChannelStore";
import GuildStore from "../../../stores/GuildStore";
import PermissionStore from "../../../stores/PermissionStore";
import PresenceStore from "../../../stores/PresenceStore";
import SelfPresenceStore from "../../../stores/SelfPresenceStore";
import VoiceStateStore from "../../../stores/VoiceStateStore";
import UserProfileStore from "../UserProfileStore";
import { CARD_PADDING } from "./Constants";
import { ActivityTypes, Permissions, PlatformTypes, StatusTypes } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { isAndroid } from "../../../utils/PlatformUtils";
import { Text } from "../../../design/components/Text/native/Text";
import { handleClick } from "../../../utils/MaskedLinkUtils";
import { useImageForActivity } from "../../content_inventory/ContentInventoryActivityImageUtils";
import { useThemeContext } from "../../../_bundle/Module3901";
import isListeningOnSpotify from "../../activities/utils/isListeningOnSpotify";
import { intl, t } from "../../../intl/index.native";
import { openAlbum, SpotifyTrack, SpotifyArtists } from "../../now_playing/native/UserActivitySpotify";
import FastImage from "../../../components_native/common/FastImage";
import { makeSource } from "../../../utils/AvatarUtils";
import isCrunchyrollActivity from "../../activities/utils/isCrunchyrollActivity";
import { UnknownGameIcon } from "../../../design/components/Icon/native/redesign/generated/UnknownGameIcon";
import { isThemeDark } from "../../../design/shared";
import isGameActivity from "../../activities/utils/isGameActivity";
import isEmbeddedActivity from "../../activities/utils/isEmbeddedActivity";
import UserProfileActivityCardBadges from "./UserProfileActivityCardBadges";
import getActivityHeader from "../utils/getActivityHeader";
import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
import useTrackUserProfileActivityAction from "../hooks/useTrackUserProfileActivityAction";
import useOpenGameProfileModal from "../../game_profile/hooks/useOpenGameProfileModal";
import { GameProfileSources } from "../../game_profile/GameProfileAnalyticUtils";
import useTrackUserProfileActivityView from "../hooks/native/useTrackUserProfileActivityView";
import { useStateFromStores } from "../../../_bundle/Module589";
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
import UserProfileCard from "./UserProfileCard";
import { Icon, IconSizes, LiveTag } from "../../../design/void/native";
import shouldShowActivityTimeBar from "../utils/shouldShowActivityTimeBar";
import UserProfileActivityTimebar from "./UserProfileActivityTimebar";
import UserProfileActivityVoiceChannel from "./UserProfileActivityVoiceChannel";
import isOnXbox from "../../activities/utils/isOnXbox";
import { ConnectPlatformButton, PlayOnSpotifyButton, JoinActivityButton, JoinGameActivityButton, WatchActivityButton, CustomActivityButton, VoiceChannelButtons } from "./UserProfileActivityButtons";
import isOnPlayStation from "../../activities/utils/isOnPlayStation";
import { getCurrentActivityGamePlatform } from "../../activities/utils/isActivityJoinableOnCurrentPlatform";
import isStreaming from "../../activities/utils/isStreaming";
import isOnConsole from "../../activities/utils/isOnConsole";
import useMuteAwareLocalVolume from "../../media_engine/useMuteAwareLocalVolume";
import { MediaEngineContextTypes } from "../../../_bundle/Module4286";
import { useCanWatchStream } from "../../go_live/utils/StreamPermissionUtils";
import MobileAudioOutputExperiment from "../../media_engine/MobileAudioOutputExperiment";
import { VoicePanelStreamPreview } from "../../voice_panel/native/shared/VoicePanelStreamPreview";
import SelectedChannelActionCreators from "../../../actions/SelectedChannelActionCreators";
import { watchStreamAndTransitionToStream } from "../../../actions/StreamActionCreators";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import VolumeSlider from "../../../components_native/common/VolumeSlider";
import usePersonalizedVoiceChannelUsers from "../hooks/usePersonalizedVoiceChannelUsers";
import useChannelName from "../../channel/useChannelName";
import GroupAvatar from "../../main_tabs_v2/native/shared_components/GroupAvatar";
import UserProfileVoiceActivityIcon from "./UserProfileVoiceActivityIcon";
import getChannelA11yLabel from "../../channel/getChannelA11yLabel";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { openGuildVoiceModal } from "../../../utils/native/PrivateChannelCallUtils";
import { transitionToGuild } from "../../routing/transitionToGuild.native";
import closeVoicePanels from "../../voice_panel/native/utils/closeVoicePanels";
import useUserProfileActivity from "../hooks/useUserProfileActivity";
import useUserProfileVoiceActivity from "../hooks/useUserProfileVoiceActivity";
import UserProfileVoiceSettings from "./UserProfileVoiceSettings";
let useStyles, MaybeLink, ActivityCardBody, ActivityCard, StreamActivityCard, VoiceCallActivityCard;
const ActivityCardText = function ActivityCardText(props) {
const { children, ...props2 } = props;
let r6 = children;
if (typeof r6 === "string") {
r6 = children.trim();
}
return r6 == null ? null : r6 !== "" ? <Text {...props2}>{r6}</Text> : null;
};
MaybeLink = function MaybeLink(props) {
const { href, children } = props;
return href != null ? <TouchableOpacity accessibilityRole="link" onPress={() => handleClick({
href
})}>{children}</TouchableOpacity> : children;
};
ActivityCardBody = function ActivityCardBody(props) {
let r63, r152, r183, r204, name;
const { user, activity, application, onAction } = props;
const styles2 = useStyles();
const imageForActivity = useImageForActivity(activity, application, "user_profile_activity_native");
const { largeImage, smallImage } = imageForActivity;
const theme = useThemeContext().theme;
const props2 = {
style: styles2.body,
children: null
};
const bot = user.bot;
let r8 = !bot;
if (!bot) {
if (largeImage != null && isListeningOnSpotify(activity)) {
r63 = <TouchableWithoutFeedback accessibilityRole="button" accessibilityLabel={largeImage.alt} accessibilityHint={intl.string(t.sjjOk2)} onPress={() => {
onAction({
action: "OPEN_SPOTIFY_ALBUM"
});
openAlbum(activity, user.id);
}}>
<View style={[styles2.imageContainer, styles2.imageAspectRatio]}>
<FastImage source={makeSource(largeImage.src)} alt={largeImage.alt} style={styles2.largeImage} />
</View>
</TouchableWithoutFeedback>;
} else if (largeImage != null) {
const style2 = [styles2.imageContainer, isCrunchyrollActivity(activity) ? styles2.crunchyrollImageAspectRatio : styles2.imageAspectRatio];
r63 = <View style={style2}>
<MaybeLink href={activity.assets?.large_url}>
<FastImage source={makeSource(largeImage.src)} alt={largeImage.alt} style={styles2.largeImage} />
</MaybeLink>
{smallImage != null && <View style={styles2.smallImageBackground}>
<MaybeLink href={activity.assets?.small_url}>
<FastImage source={makeSource(smallImage.src)} alt={smallImage.alt} style={styles2.smallImage} />
</MaybeLink>
</View>}
</View>;
} else {
r63 = <View style={[styles2.imageContainer, styles2.imageAspectRatio]}>
<UnknownGameIcon size="custom" style={styles2.largeImage} color={isThemeDark(theme) ? Module712.colors.WHITE : Module712.colors.BLACK} />
</View>;
}
r8 = r63;
}
const children = [r8, ,];
const props3 = {
style: styles2.content,
children: null
};
if (isListeningOnSpotify(activity)) {
r152 = <ActivityCardText variant="text-md/semibold">
<SpotifyTrack text={activity.details} activity={activity} onPress={() => onAction({
action: "OPEN_SPOTIFY_TRACK"
})} />
</ActivityCardText>;
} else {
if (isGameActivity(activity)) {
name = activity.name;
} else {
name = activity.details;
if (name == null) {
name = activity.name;
}
}
r152 = <MaybeLink href={activity.details_url}>
<ActivityCardText variant="text-md/semibold">{name}</ActivityCardText>
</MaybeLink>;
}
const children2 = [r152, , , ,];
if (isListeningOnSpotify(activity)) {
const state = activity.state;
const artists = state == null ? void 0 : state.trim();
r183 = artists == null ? null : artists !== "" ? <ActivityCardText variant="text-xs/medium" lineClamp={1}>
<SpotifyArtists artists={artists} activity={activity} userId={user.id} onPress={() => onAction({
action: "OPEN_SPOTIFY_ARTIST"
})} />
</ActivityCardText> : null;
} else {
let details = activity.details;
if (!(isGameActivity(activity) || activity.state == null)) {
details = activity.state;
}
r183 = <MaybeLink href={activity.state_url}>
<ActivityCardText variant="text-xs/medium" lineClamp={1}>{details}</ActivityCardText>
</MaybeLink>;
}
L62: {
children2[1] = r183;
const isListeningOnSpotify2 = isListeningOnSpotify(activity);
r204 = null;
if (!isListeningOnSpotify2) {
const type = activity.type;
const WATCHING = ActivityTypes.WATCHING;
r204 = null;
if (type !== WATCHING) {
if (isGameActivity(activity) && !isEmbeddedActivity(activity)) {
const r215 = activity.party != null;
r204 = null;
if (r215) {
break L62;
}
}
r204 = isGameActivity(activity) ? <ActivityCardText variant="text-xs/medium" lineClamp={1}>
{[activity.state, activity.party?.size != null && activity.party.size.length >= 2 ? activity.party.size[1] === 0 ? intl.formatToPlainString(t.IM4J4e, {
count: activity.party.size[0]
}) : intl.formatToPlainString(t["u//9By"], {
count: activity.party.size[0],
max: activity.party.size[1]
}) : ""].join(" ")}
</ActivityCardText> : <MaybeLink href={activity.assets?.large_url}>
<ActivityCardText variant="text-xs/medium" lineClamp={1}>
{activity.assets?.large_text}
</ActivityCardText>
</MaybeLink>;
}
}
}
children2[2] = r204;
const bot2 = user.bot;
children2[3] = bot2 ? !bot2 : <UserProfileActivityCardBadges style={styles2.badges} activity={activity} />;
props3.children = children2;
children[1] = <View {...props3} />;
props2.children = children;
return <View {...props2} />;
};
ActivityCard = function ActivityCard(props) {
let r153;
const { user: user2, currentUser: currentUser2, activity: activity2, voiceChannel: voiceChannel2, style: style2 } = props;
const styles2 = useStyles();
const activityHeader = getActivityHeader(activity2);
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.USER_PROFILE_LIVE_ACTIVITY_CARD).analyticsLocations;
const onAction2 = useTrackUserProfileActivityAction({
display: "live",
voiceChannelId: voiceChannel2?.id,
user: user2,
activity: activity2,
analyticsLocations
});
let application_id = activity2.application_id;
if (application_id == null) {
application_id = void 0;
}
const openGameProfileModal = useOpenGameProfileModal({
location: "User Profile Activity Card",
applicationId: application_id,
source: GameProfileSources.UserProfile,
trackEntryPointImpression: true,
sourceUserId: user2.id
});
let c19319_3 = openGameProfileModal;
const callback = useCallback(() => {
if (c19319_3 != null) {
c19319_3();
}
}, [openGameProfileModal]);
useTrackUserProfileActivityView({
userId: user2.id,
onAction: onAction2
});
const stateFromStores5 = useStateFromStores([GuildStore, VoiceStateStore, ChannelStore], () => {
if (isEmbeddedActivity(activity2)) {
const channel2 = ChannelStore.getChannel(VoiceStateStore.getVoiceStateForSession(user2.id, activity2?.session_id)?.channelId);
return GuildStore.getGuild(channel2 == null ? void 0 : channel2.getGuildId());
}
return null;
});
const stateFromStores4 = useStateFromStores([ApplicationStore], () => activity2.application_id != null ? ApplicationStore.getApplication(activity2.application_id) : activity2.name != null ? ApplicationStore.getApplicationByName(activity2.name) : null);
const type = activity2.type;
const CUSTOM_STATUS = ActivityTypes.CUSTOM_STATUS;
let r81 = null;
if (type !== CUSTOM_STATUS) {
const type2 = activity2.type;
const HANG_STATUS = ActivityTypes.HANG_STATUS;
r81 = null;
if (type2 !== HANG_STATUS) {
const props2 = {
value: analyticsLocations,
children: null
};
const props3 = {
onPress: callback,
disabled: openGameProfileModal == null,
accessibilityRole: "button",
accessibilityLabel: intl.formatToPlainString(t["9sZWVp"], {
gameName: activity2.name
}),
children: null
};
const props4 = {
style: [styles2.card, style2],
title: activityHeader.text,
titleStyle: styles2.cardTitle,
titleIcon: activityHeader.platformIcon != null && <Icon style={styles2.cardTitleIcon} source={makeSource(activityHeader.platformIcon?.whitePNG)} size={IconSizes.SMALL_14} disableColor />,
children: null
};
const children = [<ActivityCardBody user={user2} activity={activity2} application={stateFromStores4} onAction={onAction2} />, , , ,];
const shouldShowActivityTimeBar2 = shouldShowActivityTimeBar(activity2);
let r131 = null;
if (shouldShowActivityTimeBar2) {
const timestamps = activity2.timestamps;
r131 = <UserProfileActivityTimebar start={timestamps.start} end={timestamps.end} />;
}
children[1] = r131;
const r139 = voiceChannel2 == null ? null : stateFromStores5 == null ? null : <UserProfileActivityVoiceChannel guild={stateFromStores5} channel={voiceChannel2} onAction={onAction2} style={styles2.voiceChannelDivider} />;
L42: {
children[2] = r139;
if (isOnXbox(activity2)) {
r153 = <ConnectPlatformButton type={PlatformTypes.XBOX} onAction={onAction2} />;
} else if (isOnPlayStation(activity2)) {
r153 = <ConnectPlatformButton type={PlatformTypes.PLAYSTATION} onAction={onAction2} />;
} else {
const id = user2.id;
const id2 = currentUser2.id;
r153 = null;
if (id !== id2) {
if (isListeningOnSpotify(activity2)) {
r153 = <PlayOnSpotifyButton activity={activity2} onAction={onAction2} />;
} else if (isEmbeddedActivity(activity2)) {
r153 = <JoinActivityButton user={user2} currentUser={currentUser2} activity={activity2} application={stateFromStores4} onAction={onAction2} />;
} else {
if (isGameActivity(activity2)) {
const currentActivityGamePlatform = getCurrentActivityGamePlatform();
const r168 = Set;
let supported_platforms = activity2.supported_platforms;
if (supported_platforms == null) {
supported_platforms = [];
}
const r174 = new r168(supported_platforms).has(currentActivityGamePlatform);
const r176 = activity2.party != null;
if (r174 && r176 && stateFromStores4?.deepLinkUri != null && activity2.session_id != null && stateFromStores4 != null) {
r153 = <JoinGameActivityButton user={user2} currentUser={currentUser2} activity={activity2} application={stateFromStores4} onAction={onAction2} />;
break L42;
}
}
r153 = isStreaming(activity2) ? <WatchActivityButton activity={activity2} onAction={onAction2} /> : activity2.buttons != null ? activity2.buttons.length > 0 ? <View style={styles2.customButtons}>
{activity2.buttons.map((button, a1) => <CustomActivityButton key={a1} index={a1} user={user2} activity={activity2} onAction={onAction2} />)}
</View> : null : null;
}
}
}
}
children[3] = r153;
props4.children = children;
props3.children = <UserProfileCard {...props4} />;
props2.children = <PressableOpacity {...props3} />;
r81 = <AnalyticsLocationProvider {...props2} />;
}
}
return r81;
};
StreamActivityCard = function StreamActivityCard(props) {
let c19320_4;
const { user: user3, stream, activity: activity3, style: style2 } = props;
c19320_4 = void 0;
const styles2 = useStyles();
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(stream.channelId));
const stateFromStores5 = useStateFromStores([VoiceStateStore], () => VoiceStateStore.isInChannel(stateFromStores?.id));
const stateFromStores6 = useStateFromStores([GuildStore], () => GuildStore.getGuild(stream.guildId));
const stateFromStores8 = useStateFromStores([PresenceStore], () => PresenceStore.findActivity(user3.id, (a0) => isGameActivity(a0) && !isOnConsole(a0)));
const stateFromStores4 = useStateFromStores([ApplicationStreamingStore], () => ApplicationStreamingStore.getActiveStreamForUser(user3.id, void 0));
const muteAwareLocalVolume = useMuteAwareLocalVolume(stateFromStores4?.ownerId, MediaEngineContextTypes.STREAM);
const { effectiveVolume, handleVolumeChange } = muteAwareLocalVolume;
const stateFromStores7 = useStateFromStores([ApplicationStore], () => activity3?.application_id != null ? ApplicationStore.getApplication(activity3.application_id) : activity3?.name != null ? ApplicationStore.getApplicationByName(activity3.name) : null);
const [r31] = useCanWatchStream(stateFromStores);
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.USER_PROFILE_LIVE_ACTIVITY_CARD).analyticsLocations;
const trackUserProfileActivityAction = useTrackUserProfileActivityAction({
display: "live",
voiceChannelId: stateFromStores?.id,
user: user3,
stream,
analyticsLocations
});
c19320_4 = trackUserProfileActivityAction;
useTrackUserProfileActivityView({
userId: user3.id,
onAction: trackUserProfileActivityAction
});
const nonContextualStreamOutputPresent = MobileAudioOutputExperiment.useConfig({
location: "UserProfileVoiceSettings"
}).nonContextualStreamOutputPresent;
return <AnalyticsLocationProvider value={analyticsLocations}>
<UserProfileCard style={[styles2.card, style2]} title={stateFromStores8 != null ? intl.formatToPlainString(t["4CQq9Q"], {
name: stateFromStores8.name
}) : intl.string(t["Jpkr/q"])} titleStyle={styles2.cardTitle} titleIcon={<LiveTag />}>
<View style={styles2.streamPreview}>
<VoicePanelStreamPreview mode={void 0} stream={stream} disabled={!r31} onPress={function onPress() {
c19320_4({
action: "PRESS_IMAGE"
});
SelectedChannelActionCreators.selectVoiceChannel(stream.channelId);
watchStreamAndTransitionToStream(stream);
ActionSheetActionCreators.hideActionSheet();
}} />
</View>
{stateFromStores4 != null && !nonContextualStreamOutputPresent && <VolumeSlider key="set-stream-volume" value={effectiveVolume} onValueChange={handleVolumeChange} />}
{activity3 != null && isEmbeddedActivity(activity3) && <ActivityCardBody user={user3} activity={activity3} application={stateFromStores7} onAction={trackUserProfileActivityAction} />}
{stateFromStores6 != null && stateFromStores != null && <UserProfileActivityVoiceChannel guild={stateFromStores6} channel={stateFromStores} onAction={trackUserProfileActivityAction} style={styles2.voiceChannelDivider} />}
{stateFromStores != null && <VoiceChannelButtons channel={stateFromStores} isInChannel={stateFromStores5} onAction={trackUserProfileActivityAction} />}
</UserProfileCard>
</AnalyticsLocationProvider>;
};
VoiceCallActivityCard = function VoiceCallActivityCard(props) {
let channelName, isInChannel, personalizedVoiceChannelUsers, props2, stateFromStores4, styles2, title, trackUserProfileActivityAction;
let channel, stateFromStores2, newestAnalyticsLocation, c19321_3;
L7: {
const user5 = props.user;
channel = props.channel;
isInChannel = props.isInChannel;
const style2 = props.style;
stateFromStores2 = void 0;
newestAnalyticsLocation = void 0;
c19321_3 = void 0;
styles2 = useStyles();
personalizedVoiceChannelUsers = usePersonalizedVoiceChannelUsers(channel);
channelName = useChannelName(channel);
stateFromStores2 = useStateFromStores([GuildStore], () => GuildStore.getGuild(channel.guild_id));
stateFromStores4 = useStateFromStores([PermissionStore], () => channel.isPrivate() || PermissionStore.can(Permissions.CONNECT, channel));
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.USER_PROFILE_VOICE_ACTIVITY_CARD);
const analyticsLocations2 = analyticsLocations.analyticsLocations;
newestAnalyticsLocation = analyticsLocations.newestAnalyticsLocation;
trackUserProfileActivityAction = useTrackUserProfileActivityAction({
display: "voice",
activity: {
type: "VOICE"
},
voiceChannelId: channel.id,
user: user5,
analyticsLocations: analyticsLocations2
});
c19321_3 = trackUserProfileActivityAction;
useTrackUserProfileActivityView({
userId: user5.id,
onAction: trackUserProfileActivityAction
});
props2 = {
style: [styles2.card, style2],
title: null,
titleStyle: null,
children: null
};
if (!channel.isDM() && !channel.isGroupDM()) {
if (channel.isGuildStageVoice()) {
title = intl.string(t.QygGCN);
break L7;
}
title = intl.string(t.msxteM);
} else {
title = intl.string(t["9FaEzi"]);
}
}
props2.title = title;
props2.titleStyle = styles2.cardTitle;
props2.children = [<View style={styles2.body}>
<GroupAvatar users={personalizedVoiceChannelUsers} guildId={stateFromStores2?.id} />
<View style={styles2.voiceCallContent}>
{stateFromStores4 ? <PressableOpacity accessibilityRole="button" accessibilityLabel={getChannelA11yLabel({
channel
})} accessibilityHint={intl.string(t["9C444m"])} onPress={() => {
c19321_3({
action: "OPEN_VOICE_CHANNEL"
});
ActionSheetActionCreators.hideActionSheet();
ModalActionCreators.popAll();
openGuildVoiceModal(channel, newestAnalyticsLocation);
}}>
<Text variant="text-md/semibold" color="mobile-text-heading-primary">
<View style={styles2.voiceCallNameIconWrapper}>
<UserProfileVoiceActivityIcon channel={channel} size="sm" color="mobile-text-heading-primary" />
</View>
{channelName}
</Text>
</PressableOpacity> : <Text variant="text-md/semibold" color="mobile-text-heading-primary">
<View style={styles2.voiceCallNameIconWrapper}>
<UserProfileVoiceActivityIcon channel={channel} size="sm" color="mobile-text-heading-primary" />
</View>
{channelName}
</Text>}
{stateFromStores2 == null ? null : <PressableOpacity accessibilityRole="button" accessibilityHint={intl.string(t.KLOhbO)} accessibilityLabel={intl.formatToPlainString(t["hq/Qze"], {
guildName: stateFromStores2.name
})} onPress={() => {
c19321_3({
action: "OPEN_VOICE_GUILD"
});
transitionToGuild(stateFromStores2.id);
closeVoicePanels();
ActionSheetActionCreators.hideActionSheet();
}}>
<Text variant="text-xs/medium">
{intl.format(t["hq/Qze"], {
guildName: stateFromStores2.name
})}
</Text>
</PressableOpacity>}
</View>
</View>, <VoiceChannelButtons channel={channel} isInChannel={isInChannel} onAction={trackUserProfileActivityAction} />];
return <UserProfileCard {...props2} />;
};
useStyles = createStyles({
card: {
gap: 12
},
cardTitle: {
marginBottom: 0
},
cardTitleIcon: {
tintColor: Module712.colors.TEXT_SUBTLE
},
body: {
flexDirection: "row",
alignItems: "center",
gap: 16
},
content: {
flex: 1
},
imageContainer: {
position: "relative"
},
imageAspectRatio: {
width: 60,
maxHeight: 60,
aspectRatio: "1 / 1"
},
crunchyrollImageAspectRatio: {
width: 60,
maxHeight: 100,
aspectRatio: "2 / 3"
},
largeImage: {
borderRadius: Module712.radii.xs,
width: "100%",
height: "100%"
},
smallImageBackground: {
borderRadius: 16,
position: "absolute",
right: -4,
bottom: -4,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
smallImage: {
width: 24,
height: 24,
borderRadius: 12
},
badges: {
marginTop: 4,
flexDirection: "row",
flexWrap: "wrap",
columnGap: 8,
rowGap: 0
},
voiceChannelDivider: {
borderTopWidth: 1,
borderTopColor: Module712.colors.BORDER_SUBTLE,
paddingTop: 12
},
customButtons: {
flexDirection: "column",
gap: 8
},
streamPreview: {
aspectRatio: 1.7777777777777777,
borderRadius: Module712.radii.xs,
overflow: "hidden"
},
voiceActivityCard: {
padding: 0
},
voiceSettings: {
padding: 0,
marginBottom: -16
},
voiceSettingsDivider: {
borderTopWidth: 1,
borderTopColor: Module712.colors.BORDER_SUBTLE,
paddingTop: 16,
marginTop: 4,
marginHorizontal: -CARD_PADDING,
paddingHorizontal: CARD_PADDING
},
voiceCallContent: {
flex: 1,
gap: 4
},
voiceCallNameIconWrapper: {
width: 22,
height: isAndroid() ? 12 : 16,
justifyContent: "center"
}
});
export default function UserProfileActivity(props) {
let c19322_8;
const { user: user4, currentUser, guildId, style } = props;
c19322_8 = void 0;
const styles = useStyles();
const userProfileActivity = useUserProfileActivity(user4.id);
const { live, stream: stream2 } = userProfileActivity;
const userProfileVoiceActivity = useUserProfileVoiceActivity({
userId: user4.id,
guildId
});
const { voiceChannel, voiceActivity } = userProfileVoiceActivity;
const stateFromStores3 = useStateFromStores([VoiceStateStore], () => voiceChannel != null && VoiceStateStore.isInChannel(voiceChannel.id));
c19322_8 = user4.id === currentUser.id;
const stateFromStores4 = useStateFromStores([SelfPresenceStore, PresenceStore], () => {
const r8 = c19322_8 ? SelfPresenceStore.getStatus() : PresenceStore.getStatus(user4.id);
return r8 === StatusTypes.OFFLINE || r8 === StatusTypes.INVISIBLE;
});
const stateFromStores5 = useStateFromStores([UserProfileStore], () => UserProfileStore.getUserProfile(user4.id)?.private === true);
if (!(!stateFromStores4 && !stateFromStores5) && voiceChannel != null && stateFromStores3) {
return <UserProfileCard style={[styles.card, style]}>
<UserProfileVoiceSettings user={user4} currentUser={currentUser} channel={voiceChannel} style={[styles.voiceSettings, styles.voiceSettingsDivider]} />
</UserProfileCard>;
}
if (stateFromStores4) {
return null;
}
const r62 = voiceActivity != null ? live.filter((item) => item !== voiceActivity) : live;
let r67 = stateFromStores5 ? !stateFromStores5 : voiceChannel != null;
if (r67) {
const renderVoiceActivityCard = function renderVoiceActivityCard(a0) {
return stream2 != null && stream2.channelId === a0.id ? <StreamActivityCard user={user4} stream={stream2} activity={voiceActivity} style={styles.voiceActivityCard} /> : voiceActivity != null ? <ActivityCard user={user4} currentUser={currentUser} activity={voiceActivity} voiceChannel={a0} style={styles.voiceActivityCard} /> : <VoiceCallActivityCard user={user4} channel={a0} isInChannel={stateFromStores3} style={styles.voiceActivityCard} />;
};
r67 = stateFromStores3 ? <UserProfileCard style={[styles.card, style]}>
{renderVoiceActivityCard(voiceChannel)}
<UserProfileVoiceSettings user={user4} currentUser={currentUser} channel={voiceChannel} style={[styles.voiceSettings, styles.voiceSettingsDivider]} />
</UserProfileCard> : <UserProfileCard style={[styles.card, style]}>
{renderVoiceActivityCard(voiceChannel)}
</UserProfileCard>;
}
return <>
{[r67, (stateFromStores5 ? !stateFromStores5 : stream2 != null) && stream2.channelId !== voiceChannel?.id && <StreamActivityCard user={user4} stream={stream2} activity={voiceActivity} style={style} />, r62.map((item, index) => {
const props = {
user: user4,
currentUser,
activity: item,
style
};
let application_id = item.application_id;
if (application_id == null) {
application_id = index;
}
return <ActivityCard key={application_id} {...props} />;
})]}
</>;
};