Files
discord-decomp/sources/modules/external_pip/ExternalPipViewVideo.android.tsx
2026-07-28 01:06:53 +03:00

260 lines
16 KiB
TypeScript

/* Metro module 15356; source: modules/external_pip/ExternalPipViewVideo.android.tsx; dependencies: [57, 31, 27, 1379, 1878, 4299, 33, 4501, 697, 10674, 4068, 4573, 1244, 566, 1305, 10678, 3860, 15357, 10687, 15358, 10684, 2] */
import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */
import Native from '../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */
import ExternalPipAndroid from './ExternalPip.android.tsx'; /* Metro dependency 10684 */
import UseExternalPipParticipantAndroid from './useExternalPipParticipant.android.tsx'; /* Metro dependency 15358 */
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 UseTokenModule from '../../design/tokens/native/useToken.tsx'; /* Metro dependency 3860 */
import * as CallConstantsModule from '../calls/CallConstants.tsx'; /* Metro dependency 4299 */
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 */
import * as SurfaceDirectRendererExperimentModule from '../video_calls/native/SurfaceDirectRendererExperiment.tsx'; /* Metro dependency 10678 */
function _fun117377(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#117377, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15553:6, offset: 0x024b0aae, size: 904 bytes, params: 8, frame: 33
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactModule;
const StyleSheet = ReactNativeModule.StyleSheet;
const createStyles = CreateStylesModule.createStyles;
object = {};
const object2 = {};
copyDataProperties(object2, StyleSheet.absoluteFillObject, undefined);
let BACKGROUND_SURFACE_HIGH = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
object2['backgroundColor'] = BACKGROUND_SURFACE_HIGH;
object.container = object2;
const object3 = {};
copyDataProperties(object3, StyleSheet.absoluteFillObject, undefined);
object.video = object3;
const object4 = {};
copyDataProperties(object4, StyleSheet.absoluteFillObject, undefined);
let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object4['margin'] = PX_16;
object4['borderRadius'] = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object4['justifyContent'] = 'center';
object4['alignContent'] = 'center';
object4['flexDirection'] = 'row';
object4['alignItems'] = 'center';
object4['flexWrap'] = 'wrap';
object4['flex'] = 1;
object.videoUnavailableWrap = object4;
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object.videoUnavailableSpinner = {marginTop: PX_16};
const object6 = {};
BACKGROUND_SURFACE_HIGH = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
object6.backgroundColor = BACKGROUND_SURFACE_HIGH;
object6.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
let PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object6.padding = PX_8;
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object6.margin = PX_8;
object6.justifyContent = 'center';
object6.alignContent = 'center';
object6.alignItems = 'center';
object6.flexDirection = 'row';
object6.flexWrap = 'wrap';
object6.flex = 1;
object.unavailable = object6;
const PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4;
object.unavailableText = {marginLeft: PX_4, textAlign: 'center'};
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object.unavaiableImage = {'marginBottom': null, 'resizeMode': 'contain', 'aspectRatio': 2.5, 'width': '80%',
marginBottom: PX_8};
const object9 = {};
copyDataProperties(object9, StyleSheet.absoluteFillObject, undefined);
const BACKGROUND_BASE_LOWEST = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWEST;
object9['backgroundColor'] = BACKGROUND_BASE_LOWEST;
object9['borderRadius'] = (importDefault(697) /* metro dependency 697: native */).radii.sm;
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object9['margin'] = PX_8;
object9['alignItems'] = 'center';
object9['justifyContent'] = 'center';
object.user = object9;
const env0_14 = Reflect.apply(createStyles, CreateStylesModule, [object]);
value = value.memo(ExternalPipViewVideo);
(FileImportTrackerModule).fileFinishedImporting('modules/external_pip/ExternalPipViewVideo.android.tsx');
exports.default = value;
function ExternalPipViewVideoUnavailable({wasStream}) { // fn#117378, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15553:1304, offset: 0x024b0e36, size: 306 bytes, params: 2, frame: 23
const styles = useStyles();
const r5 = (
wasStream
? ((StreamEnded) => <StreamEnded style={styles.unavaiableImage} />)((require(10674) /* metro dependency 10674: StreamEnded */).StreamEnded)
: ((CircleInformationIcon) => <CircleInformationIcon />)((require(4068) /* metro dependency 4068: CircleInformationIcon */).CircleInformationIcon)
);
const Text = (TextModule).Text;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
return (
<View style={styles.unavailable}>
{r5}
<Text
variant="text-md/semibold"
style={styles.unavailableText}
lineClamp={1}
>
{wasStream ? intl.formatToMarkdownString((require(1244) /* metro dependency 1244: indexNative */).t['1Ww0Hi'],
{}) : intl.string((require(1244) /* metro dependency 1244: indexNative */).t.Nzo5nz)}
</Text>
</View>
);
}
function ExternalPipViewVideoUser({userId, channelId, speaking}) { // fn#117379, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15553:1698, offset: 0x024b0f68, size: 263 bytes, params: 2, frame: 24
const styles = useStyles();
const user = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserStore], function() {
return UserStore.getUser(userId);
});
return (
<View style={styles.user}>
{
user != null
? ((Avatar) => <Avatar user={user} avatarDecoration={user.avatarDecoration} guildId={(require(566) /* metro dependency 566: flux */).useStateFromStores([ChannelStore],
_fun117381)} size={(require(1305) /* metro dependency 1305: native */).AvatarSizes.XXLARGE} animate={speaking} speaking={speaking} />)((require(1305) /* metro dependency 1305: native */).Avatar)
: null
}
</View>
);
function _fun117381() { // fn#117381, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15553:1866, offset: 0x024b106f, size: 42 bytes, params: 1, frame: 11
const value = environment.__proto__;
return ChannelStore.getChannel(channelId)?.guild_id;
}
}
function ExternalPipViewVideoStream({streamId, userId}) { // fn#117382, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15553:2109, offset: 0x024b1099, size: 416 bytes, params: 2, frame: 27
const value2 = (SurfaceDirectRendererExperimentModule).useSurfaceDirectRendererExperiment(userId,
{location: 'ExternalPipViewVideoStream'});
const {streamReady, streamReadLongTime, streamReadyCallback} = useStreamReady(streamId);
const styles = useStyles();
const value4 = env0_4.useMemo(_fun117388, [styles, streamReady]);
const useToken = UseTokenModule.useToken;
const TEXT_FEEDBACK_INFO = (Native).colors.TEXT_FEEDBACK_INFO;
return (
<>
{((Component) => <Component useSurfaceDirectRenderer={value2} style={value4} streamId={streamId} onReady={streamReadyCallback} onLayout={env0_4.useCallback(_fun117389,
[streamId, PixelRatio.get()])} />)(importDefault(10687) /* metro dependency 10687: DCDVideoRenderer */)}
{
streamReady == null && streamReadLongTime
? (
<View style={styles.videoUnavailableWrap}>
<ActivityIndicator
style={styles.videoUnavailableSpinner}
size="large"
color={Reflect.apply(useToken, UseTokenModule, [TEXT_FEEDBACK_INFO])}
/>
</View>
)
: null
}
</>
);
function useStreamReady(a0) { // fn#117383, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15553:2263, owner: ExternalPipViewVideoStream.useStreamReady, offset: 0x024b1239, size: 211 bytes, params: 2, frame: 21
const env0_0 = a0;
undefined !== undefined;
const [property, env0_3] = env1_3(env1_4.useState(undefined), 2);
const [property2, env0_4] = env1_3(env1_4.useState(false), 2);
const value6 = env1_4.useCallback(_fun117384, [a0]);
env1_4.useEffect(_fun117385, [property, 300]);
return {streamReady: property, streamReadLongTime: property2, streamReadyCallback: value6};
function _fun117384() { // fn#117384, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15553:2401, offset: 0x01c39198, size: 20 bytes, params: 1, frame: 11
return env0_3(env0_0);
}
function _fun117385() { // fn#117385, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15553:2436, offset: 0x024b130c, size: 70 bytes, params: 1, frame: 14
if (env0_2 == null) {
var env0_0 = global.setTimeout(_fun117386, env0_1);
return _fun117387;
}
env0_4(false);
function _fun117386() { // fn#117386, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15553:2471, offset: 0x01eff6dd, size: 18 bytes, params: 1, frame: 11
env1_4(true);
}
function _fun117387() { // fn#117387, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15553:2493, offset: 0x00e59c84, size: 24 bytes, params: 1, frame: 11
global.clearTimeout(env0_0);
}
}
}
function _fun117388() { // fn#117388, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15553:2675, offset: 0x024b1352, size: 51 bytes, params: 1, frame: 4
return [styles.video, {opacity: streamReady == null ? 0 : 1}];
}
function _fun117389(a0) { // fn#117389, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15553:2801, offset: 0x024b1385, size: 109 bytes, params: 2, frame: 17
var layout;
var width;
var height;
var value2;
var moduleValue;
var updateVideoSize;
var binding;
let streamIdBinding = streamId;
if (streamIdBinding != null) {
layout = a0.nativeEvent.layout;
width = layout.width;
height = layout.height;
value2 = environment.__proto__;
moduleValue = require(15357) /* metro dependency 15357: VideoActionCreators */;
updateVideoSize = moduleValue.updateVideoSize;
streamIdBinding = streamId;
binding = Module00057;
Reflect.apply(updateVideoSize, moduleValue, [streamIdBinding, {width: width * binding,
height: height * binding},
1]);
}
}
}
function ExternalPipViewVideo({onLayout}) { // fn#117390, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15553:3169, offset: 0x024b13f2, size: 271 bytes, params: 2, frame: 24
const styles = useStyles();
const {channelId, selectedParticipantStreamId, selectedParticipantUserId, selectedParticipantSpeaking,
focusedParticipantType} = (UseExternalPipParticipantAndroid)();
env0_4.useEffect(_fun117391, [selectedParticipantStreamId, selectedParticipantUserId, focusedParticipantType]);
return (
<View style={styles.container} onLayout={onLayout}>
{
selectedParticipantStreamId != null
? (
<ExternalPipViewVideoStream
streamId={selectedParticipantStreamId}
userId={selectedParticipantUserId}
/>
)
: (
selectedParticipantUserId != null
? (
<ExternalPipViewVideoUser
userId={selectedParticipantUserId}
channelId={channelId}
speaking={selectedParticipantSpeaking}
/>
)
: (
<ExternalPipViewVideoUnavailable
wasStream={focusedParticipantType === ParticipantTypes.STREAM || focusedParticipantType === ParticipantTypes.HIDDEN_STREAM}
/>
)
)
}
</View>
);
function _fun117391() { // fn#117391, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15553:3391, offset: 0x024b1501, size: 37 bytes, params: 1, frame: 11
const value = environment.__proto__;
(ExternalPipAndroid).refreshPipUi();
}
}
}
global.__d(_fun117377, 15356, [57, 31, 27, 1379, 1878, 4299, 33, 4501, 697, 10674, 4068, 4573, 1244, 566, 1305,
10678, 3860, 15357, 10687, 15358, 10684,
2]) /* metro module 15356, dependencies: [57, 31, 27, 1379, 1878, 4299, 33, 4501, 697, 10674, 4068, 4573, 1244, 566, 1305, 10678, 3860, 15357, 10687, 15358, 10684, 2] */;