Files
discord-decomp/sources/components_native/TouchableStreamPreview.tsx
T
2026-07-28 01:06:53 +03:00

215 lines
12 KiB
TypeScript

/* Metro module 10885; source: components_native/TouchableStreamPreview.tsx; dependencies: [31, 27, 4295, 4492, 1226, 1379, 1867, 3784, 4297, 661, 33, 4501, 4000, 697, 4800, 566, 1244, 4796, 8913, 8915, 7712, 4285, 4594, 10886, 4573, 2] */
import Native from '../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
import AuthenticationStore from '../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */
import ChannelStore from '../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import GuildStore from '../stores/GuildStore.tsx'; /* Metro dependency 1867 */
import PermissionStore from '../stores/PermissionStore.tsx'; /* Metro dependency 3784 */
import GameConsoleStore from '../modules/game_console/GameConsoleStore.tsx'; /* Metro dependency 4295 */
import VoiceStateStore from '../stores/VoiceStateStore.tsx'; /* Metro dependency 4297 */
import ApplicationStreamingStore from '../stores/ApplicationStreamingStore.tsx'; /* Metro dependency 4492 */
import UseMountEffect from '../hooks/useMountEffect.tsx'; /* Metro dependency 4594 */
import SelectedChannelActionCreators from '../actions/SelectedChannelActionCreators.tsx'; /* Metro dependency 4796 */
import StreamPreview from './StreamPreview.tsx'; /* Metro dependency 10886 */
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 ReactModule from '../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as JsxRuntimeModule from '../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as FluxModule from '../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */
import * as ColorUtilsModule from '../utils/ColorUtils.tsx'; /* Metro dependency 4000 */
import * as TextModule from '../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
import * as ChannelUtilsModule from '../utils/ChannelUtils.tsx'; /* Metro dependency 4800 */
import * as StreamActionCreatorsModule from '../actions/StreamActionCreators.tsx'; /* Metro dependency 8913 */
function _fun83378(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#83378, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11071:6, offset: 0x01f1809d, size: 525 bytes, params: 8, frame: 25
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactNativeModule;
const StyleSheet = value.StyleSheet;
const env0_4 = value.View;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object = {touchable: {'borderRadius': 5, 'overflow': 'hidden'}};
const object2 = {};
copyDataProperties(object2, StyleSheet.absoluteFillObject, undefined);
object2['alignItems'] = 'center';
object2['justifyContent'] = 'center';
const hexWithOpacity = ColorUtilsModule.hexWithOpacity;
const PRIMARY_700 = (Native).unsafe_rawColors.PRIMARY_700;
object2['backgroundColor'] = Reflect.apply(hexWithOpacity, ColorUtilsModule, [PRIMARY_700, 0.7]);
object.ctaWrapper = object2;
const PRIMARY_500 = (Native).unsafe_rawColors.PRIMARY_500;
object.ctaBackground = {'height': 40, 'paddingHorizontal': 16, 'borderRadius': 20, 'backgroundColor': null,
'justifyContent': 'center', 'alignItems': 'center', backgroundColor: PRIMARY_500};
object.ctaText = {lineHeight: 20};
const env0_14 = Reflect.apply(createStyles, value, [object]);
(FileImportTrackerModule).fileFinishedImporting('components_native/TouchableStreamPreview.tsx');
exports.default = VoiceChannelSettingsStreamPreview;
function StreamPreviewContainer({style, disableTransition, onPress, stream, channel}) { // fn#83379, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11071:667, offset: 0x01f182aa, size: 809 bytes, params: 2, frame: 29
var r15;
var r2;
var r5;
var r4;
var r13;
var value7;
var value8;
var value10;
var value12;
const channel2 = channel;
const styles = useStyles();
const isChannelFull2 = ChannelUtilsModule.isChannelFull(channel, VoiceStateStore, GuildStore);
const value2 = (require(566) /* metro dependency 566: flux */).useStateFromStores([GameConsoleStore], _fun83380);
const value3 = (require(566) /* metro dependency 566: flux */).useStateFromStores([PermissionStore], function() {
var permissionStoreBinding = PermissionStore;
var CONNECT = Permissions.CONNECT;
return !permissionStoreBinding.can(CONNECT, channel);
});
const value4 = (require(566) /* metro dependency 566: flux */).useStateFromStores([VoiceStateStore], function() {
return VoiceStateStore.isInChannel(channel.id);
});
const value5 = (require(566) /* metro dependency 566: flux */).useStateFromStores([ApplicationStreamingStore,
AuthenticationStore], _fun83383, [channel.id, stream.ownerId]);
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const value6 = intl.string((require(1244) /* metro dependency 1244: indexNative */).t['7Xq/nV']);
if (value2) {
value12 = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.gcnYT2);
r4 = true;
r13 = value12;
} else {
r15 = value4 || value5;
value7 = false;
if (r15) {
r4 = value7;
r13 = value6;
} else {
if (isChannelFull2) {
value10 = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.rZfiNq);
r2 = true;
r5 = value10;
} else if (value3) {
value8 = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.TVBCKZ);
r2 = true;
r5 = value8;
} else {
r2 = value7;
r5 = value6;
}
r4 = r2;
r13 = r5;
}
}
const value14 = channel2.useCallback(_fun83384, [stream, disableTransition, onPress]);
(UseMountEffect)(_fun83385);
const items2 = [styles.touchable, style];
const Text = (TextModule).Text;
return (
<StreamPreview
stream={stream}
ctaText={r13}
style={items2}
onPress={value14}
disabled={r4}
>
<View style={styles.ctaWrapper}>
<View style={styles.ctaBackground}>
<Text
style={styles.ctaText}
variant="text-md/semibold"
color="always-white"
>
{r13}
</Text>
</View>
</View>
</StreamPreview>
);
function _fun83380() { // fn#83380, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11071:836, offset: 0x01f185d3, size: 25 bytes, params: 1, frame: 9
const value = environment.__proto__;
return GameConsoleStore.getRemoteSessionId() != null;
}
function _fun83383() { // fn#83383, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11071:1030, offset: 0x01f18635, size: 63 bytes, params: 1, frame: 13
const ownerId = stream.ownerId;
const authenticationStoreBinding = AuthenticationStore;
const getId = authenticationStoreBinding.getId;
return ownerId === Reflect.apply(getId, authenticationStoreBinding,
[]) && ApplicationStreamingStore.isSelfStreamHidden(channel.id);
}
function _fun83384() { // fn#83384, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11071:1336, offset: 0x01f18674, size: 223 bytes, params: 1, frame: 18
let value = environment.__proto__;
const defaultImport = SelectedChannelActionCreators;
const selectVoiceChannel = defaultImport.selectVoiceChannel;
let streamBinding = stream;
let channelId = streamBinding.channelId;
Reflect.apply(selectVoiceChannel, defaultImport, [channelId]);
(StreamActionCreatorsModule).watchStream(streamBinding);
if (disableTransition) {
(importDefault(7712) /* metro dependency 7712: ChannelRTCActionCreators */).rebuildRTCActiveChannels();
} else {
(importDefault(8915) /* metro dependency 8915: transitionToStreamNative */)(stream);
}
const defaultImport4 = importDefault(7712) /* metro dependency 7712: ChannelRTCActionCreators */;
const selectParticipant = defaultImport4.selectParticipant;
streamBinding = stream;
channelId = streamBinding.channelId;
value = require(4285) /* metro dependency 4285: StreamKeyUtils */;
Reflect.apply(selectParticipant, defaultImport4, [channelId, value.encodeStreamKey(streamBinding)]);
if (onPress != null) {
onPress();
}
}
function _fun83385() { // fn#83385, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11071:1565, offset: 0x01f18753, size: 74 bytes, params: 1, frame: 14
var value2;
var moduleValue;
const channelBinding = channel;
if (channelBinding.isGuildStageVoice()) {
value2 = environment.__proto__;
moduleValue = require(8913) /* metro dependency 8913: StreamActionCreators */;
moduleValue.watchStream(stream, {noFocus: true});
}
}
}
function VoiceChannelSettingsStreamPreview(a0) { // fn#83386, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11071:1891, offset: 0x01f1879d, size: 173 bytes, params: 2, frame: 20
const env0_0 = a0;
const streamForUser = (FluxModule).useStateFromStores([ApplicationStreamingStore],
_fun83387);
const value2 = (FluxModule).useStateFromStores([ChannelStore], _fun83388);
const value3 = null;
return (
value3 == streamForUser || value3 == value2
? value3
: (
<StreamPreviewContainer
{...a0}
{...{['stream']: streamForUser}}
{...{['channel']: value2}}
/>
)
);
function _fun83387() { // fn#83387, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11071:1976, offset: 0x01f1884a, size: 38 bytes, params: 1, frame: 13
const applicationStreamingStoreBinding = ApplicationStreamingStore;
const getStreamForUser = applicationStreamingStoreBinding.getStreamForUser;
const binding = env0_0;
const userId = binding.userId;
return Reflect.apply(getStreamForUser, applicationStreamingStoreBinding, [userId, binding.guildId]);
}
function _fun83388() { // fn#83388, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11071:2056, offset: 0x01f18870, size: 44 bytes, params: 1, frame: 12
const streamForUserBinding = streamForUser;
const value2 = null;
return value2 != streamForUserBinding ? ChannelStore.getChannel(streamForUser.channelId) : value2;
}
}
}
global.__d(_fun83378, 10885, [31, 27, 4295, 4492, 1226, 1379, 1867, 3784, 4297, 661, 33, 4501, 4000, 697, 4800, 566,
1244, 4796, 8913, 8915, 7712, 4285, 4594, 10886, 4573,
2]) /* metro module 10885, dependencies: [31, 27, 4295, 4492, 1226, 1379, 1867, 3784, 4297, 661, 33, 4501, 4000, 697, 4800, 566, 1244, 4796, 8913, 8915, 7712, 4285, 4594, 10886, 4573, 2] */;