Files
discord-decomp/sources/modules/home_drawer/native/HomeDrawerGuildVoiceState.tsx
T
2026-07-28 01:06:53 +03:00

211 lines
12 KiB
TypeScript

/* Metro module 14431; source: modules/home_drawer/native/HomeDrawerGuildVoiceState.tsx; dependencies: [31, 27, 1935, 3793, 4300, 661, 33, 4501, 697, 10251, 1305, 477, 4573, 1244, 10271, 5475, 566, 22, 14420, 2] */
import GuildChannelStore from '../../../stores/GuildChannelStore.tsx'; /* Metro dependency 1935 */
import RelationshipStore from '../../../stores/RelationshipStore.tsx'; /* Metro dependency 3793 */
import SortedVoiceStateStore from '../../../stores/views/SortedVoiceStateStore.tsx'; /* Metro dependency 4300 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as PlatformUtilsModule from '../../../utils/PlatformUtils.tsx'; /* Metro dependency 477 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as NativeModule from '../../../design/void/native.tsx'; /* Metro dependency 1305 */
import * as GuildChannelStoreModule from '../../../stores/GuildChannelStore.tsx'; /* Metro dependency 1935 */
import * as CreateStylesModule from '../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
function _fun109215(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#109215, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14628:6, offset: 0x02341e85, size: 560 bytes, params: 8, frame: 25
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const value = 0;
const env0_3 = importAll(dependencyMap[value]);
let createStyles = CreateStylesModule.createStyles;
const object2 = {'width': 72, 'height': 44, 'borderRadius': null, 'overflow': 'hidden'};
object2.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
const env0_12 = Reflect.apply(createStyles, CreateStylesModule, [{voiceContainer: {'paddingRight': 8, 'height': 40,
'gap': 4, 'justifyContent': 'center'}, streamPreview: object2}]);
createStyles = CreateStylesModule.createStyles;
object = {};
const object3 = {'paddingHorizontal': 5, 'paddingVertical': 1, 'borderBottomRightRadius': null,
'overflow': 'hidden', 'justifyContent': 'center', 'alignItems': 'center', 'backgroundColor': null,
'position': 'absolute', 'top': 0, 'left': 0};
object3.borderBottomRightRadius = (importDefault(697) /* metro dependency 697: native */).radii.xs;
const RED_400 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.RED_400;
object3.backgroundColor = RED_400;
object.tag = object3;
const object4 = {textAlign: 'center'};
const WHITE = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.WHITE;
object4.color = WHITE;
object4.marginTop = PlatformUtilsModule.isAndroid() ? -2 : value;
object.tagText = object4;
const env0_13 = Reflect.apply(createStyles, CreateStylesModule, [object]);
(FileImportTrackerModule).fileFinishedImporting('modules/home_drawer/native/HomeDrawerGuildVoiceState.tsx');
exports.GuildVoiceState = GuildVoiceState;
exports.useVoiceUsers = useVoiceUsers;
function VoiceUsers({voiceUsers, guildId}) { // fn#109216, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14628:417, offset: 0x023420b5, size: 227 bytes, params: 2, frame: 23
const r10 = voiceUsers.length > 3 ? voiceUsers.slice(0, 3) : voiceUsers;
return (
voiceUsers.length === 0
? null
: (
<View style={{'flexDirection': 'row', 'alignItems': 'center', 'gap': 4}}>
{((AvatarPile) => <AvatarPile size={(require(1305) /* metro dependency 1305: native */).AvatarSizes.XSMALL} names={r10.map(function(a0) {
return a0.username;
})} totalCount={voiceUsers.length}>{r10.map(_fun109218)}</AvatarPile>)((require(10251) /* metro dependency 10251: AvatarPileNative */).AvatarPile)}
</View>
)
);
function _fun109218(a0) { // fn#109218, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14628:708, offset: 0x02342198, size: 101 bytes, params: 2, frame: 18
const Avatar = (NativeModule).Avatar;
const AvatarSizes = (NativeModule).AvatarSizes;
const XSMALL = AvatarSizes.XSMALL;
return (
<Avatar
size={XSMALL}
user={a0}
guildId={guildId}
animate={false}
key={a0.id}
/>
);
}
}
function LiveTag_109219() { // fn#109219, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14628:1165, offset: 0x023421fd, size: 166 bytes, params: 1, frame: 21
const styles = useStyles();
const Text = (TextModule).Text;
const intl = (IndexNativeModule).intl;
return (
<View style={styles.tag}>
<Text
variant="text-xs/bold"
style={styles.tagText}
lineClamp={1}
>
{intl.string((IndexNativeModule).t.dI3q4h).toUpperCase()}
</Text>
</View>
);
}
function GuildVoiceState({voiceUsers, streamingChannelId, streamingUser, guildId}) { // fn#109220, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14628:1471, offset: 0x023422a3, size: 323 bytes, params: 2, frame: 27
var r5;
var r0;
var object2;
var object;
var streamPreview;
var FastImage;
const styles = useStyles();
const value3 = voiceUsers.length > 0;
const previewUrl = (importDefault(10271) /* metro dependency 10271: useFetchStreamPreview */)(guildId,
streamingChannelId ?? undefined, streamingUser?.id).previewUrl;
if (value3) {
var viewProps = {style: [styles.voiceContainer, {height: streamingUser != null ? 48 : 32}]};
if (previewUrl == null) {
r5 = <VoiceUsers voiceUsers={voiceUsers} guildId={guildId} />;
} else {
object = {};
streamPreview = styles.streamPreview;
object.style = streamPreview;
FastImage = importDefault(5475) /* metro dependency 5475: FastImage */;
streamPreview = styles.streamPreview;
r5 = (
<View {...object}>
<FastImage style={streamPreview} source={{uri: previewUrl}} />
<LiveTag_109219 />
</View>
);
}
r0 = (
<View {...viewProps}>
{r5}
</View>
);
} else {
r0 = null;
}
return r0;
}
function useVoiceUsers(a0) { // fn#109221, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14628:1891, offset: 0x023423e6, size: 302 bytes, params: 2, frame: 23
const env0_0 = a0;
const id = a0.id;
const value2 = (require(566) /* metro dependency 566: flux */).useStateFromStoresArray([GuildChannelStore],
_fun109222, [id]);
const value3 = (require(566) /* metro dependency 566: flux */).useStateFromStores([SortedVoiceStateStore],
function() {
return SortedVoiceStateStore.getVoiceStates(id);
}, [id]);
const env0_3 = value3;
const value4 = (require(566) /* metro dependency 566: flux */).useStateFromStoresArray([RelationshipStore],
function() {
return RelationshipStore.getBlockedOrIgnoredIDs();
});
const binding = env0_3;
const value = binding.useMemo(_fun109227, [value2, value3, a0.afkChannelId, value4]);
const value5 = binding.useMemo(_fun109230, [value3, a0.afkChannelId, value2]);
return {voiceUsers: value, streamingUser: value5.streamingUser, streamingChannelId: value5.streamingChannelId};
function _fun109222() { // fn#109222, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14628:1968, offset: 0x02342514, size: 71 bytes, params: 1, frame: 13
var environment;
const value = environment.__proto__;
const guildChannelStoreBinding = GuildChannelStore;
const getChannels = guildChannelStoreBinding.getChannels;
return Reflect.apply(getChannels, guildChannelStoreBinding, [id])[GUILD_VOCAL_CHANNELS_KEY].filter(function(a0) {
return a0.channel.type === ChannelTypes.GUILD_VOICE;
}).map(function(a0) {
return a0.channel.id;
});
}
function _fun109227() { // fn#109227, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14628:2224, offset: 0x023425a9, size: 55 bytes, params: 1, frame: 13
var environment;
let value = environment.__proto__;
value = importDefault(22) /* metro dependency 22 */;
return value.flatMap(env0_2, _fun109228);
function _fun109228(a0) { // fn#109228, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14628:2248, offset: 0x023425e0, size: 106 bytes, params: 2, frame: 14
if (a0 === env1_0.afkChannelId) {
return [];
}
return (require(14420) /* metro dependency 14420: BlockedUserUtils */).filterOutBlockedOrIgnoredUsers((env1_3[a0] ?? []).map(function(a0) {
return a0.user;
}), env1_4);
}
}
function _fun109230() { // fn#109230, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14628:2431, offset: 0x0234264a, size: 76 bytes, params: 1, frame: 12
const env0_0 = null;
const env0_1 = null;
const Object = global.Object;
Object.keys(env0_3).forEach(_fun109231);
return {streamingUser: env0_0, streamingChannelId: env0_1};
function _fun109231(a0) { // fn#109231, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14628:2485, offset: 0x02342696, size: 116 bytes, params: 2, frame: 13
var environment;
var binding;
var user;
let value = environment.__proto__;
if (a0 !== env1_0.afkChannelId) {
binding = env1_2;
if (binding.includes(a0)) {
value = (env1_3[a0] ?? []).find(function(a0) {
return a0.voiceState.selfStream;
});
if (value != null && env0_0 == null) {
user = value.user;
env0_1 = a0;
}
}
}
}
}
}
}
global.__d(_fun109215, 14431, [31, 27, 1935, 3793, 4300, 661, 33, 4501, 697, 10251, 1305, 477, 4573, 1244, 10271,
5475, 566, 22, 14420,
2]) /* metro module 14431, dependencies: [31, 27, 1935, 3793, 4300, 661, 33, 4501, 697, 10251, 1305, 477, 4573, 1244, 10271, 5475, 566, 22, 14420, 2] */;