This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,56 @@
// Metro module 10258 (f10259).
import { NativeEventEmitter, NativeModules } from "react-native";
const ExternalPip2 = NativeModules.ExternalPip;
class ExternalPip {
constructor() {
const r7 = {
__proto__: new.target.prototype,
_enabled: false,
_isInPipMode: false
};
r7.eventEmitter = new NativeEventEmitter(NativeModules.PipAndroid);
return r7;
}
addOnPipModeChangedListener(c17813_0) {
return this.eventEmitter.addListener("onPipModeChanged", ({ isInPipMode: isInPipMode2 }) => {
this._isInPipMode = isInPipMode2;
c17813_0(isInPipMode2);
});
}
addOnPipModeWillChangeListener(a0) {
return this.eventEmitter.addListener("onPipModeWillChange", a0);
}
setSelectedStream() {}
setFocusedStream() {}
setMirrored() {}
setPipAspectRatio(a0, a1) {
ExternalPip2.setPipAspectRatio(a0, a1);
}
refreshPipUi() {
ExternalPip2.refreshPipUi();
}
updateSourceTrackingView() {}
setEnabled(a0) {
this._enabled = a0;
ExternalPip2.setEnabled(this._enabled);
}
setActive(a0) {
return ExternalPip2.setActive(a0);
}
isEnabled() {
return this._enabled;
}
isSupported() {
return ExternalPip2.isSupported === true;
}
isInPipMode() {
return this._isInPipMode;
}
}
const r50 = {
__proto__: ExternalPip.prototype,
_enabled: false,
_isInPipMode: false
};
r50.eventEmitter = new NativeEventEmitter(NativeModules.PipAndroid);
export default r50;
@@ -0,0 +1,6 @@
// Metro module 15828 (f15829).
export const DEFAULT_STATE = {
externalPipEnabled: false,
selectedStreamId: null,
focusedStreamId: null
};
@@ -0,0 +1,66 @@
// Metro module 15826 (f15827).
import { useRef, useCallback, useEffect, useState } from "react";
import AppFreezeStore from "../panels/morphable/AppFreezeStore";
import useExternalPipEnabler_android from "./useExternalPipEnabler.android";
import ExternalPip_android from "./ExternalPip.android";
import ExternalPipViewVideo_android from "./ExternalPipViewVideo.android";
const FreezeAfterLayoutPipView = function FreezeAfterLayoutPipView() {
const ref = useRef(false);
const callback2 = useCallback(() => {
if (!ref.current) {
ref.current = true;
AppFreezeStore.getState().requestFreezeLock({
lockEnabled: true,
key: "external-pip"
});
}
}, []);
useEffect(() => () => {
if (ref.current) {
AppFreezeStore.getState().requestFreezeLock({
lockEnabled: false,
key: "external-pip"
});
}
}, []);
return <ExternalPipViewVideo_android onLayout={callback2} />;
};
export default function ExternalPipView() {
let callback;
const externalPipEnabled = useExternalPipEnabler_android({
disabled: !ExternalPip_android.isSupported()
}).externalPipEnabled;
const [state, setState] = useState(false);
const callback2 = useCallback((a0) => {
setState(a0);
if (!a0) {
AppFreezeStore.getState().requestFreezeLock({
lockEnabled: false,
key: "external-pip"
});
}
}, []);
useEffect(() => () => {
AppFreezeStore.getState().requestFreezeLock({
lockEnabled: false,
key: "external-pip"
});
}, []);
callback = callback2;
useEffect(() => {
ExternalPip_android.setEnabled(externalPipEnabled);
}, [externalPipEnabled]);
useEffect(() => {
let c28161_0 = ExternalPip_android.addOnPipModeChangedListener((a0) => {
callback(a0);
});
return () => c28161_0 == null ? void 0 : c28161_0.remove();
}, [callback]);
useEffect(() => {
let c28162_0 = ExternalPip_android.addOnPipModeWillChangeListener(() => {
callback(true);
});
return () => c28162_0 == null ? void 0 : c28162_0.remove();
}, [callback]);
return state ? <FreezeAfterLayoutPipView /> : null;
};
@@ -0,0 +1,156 @@
// Metro module 15829 (f15830).
import * as Module19 from "react";
import { useState, useCallback, useEffect, useMemo } from "react";
import { ActivityIndicator, PixelRatio, View, StyleSheet } from "react-native";
import ChannelStore from "../../stores/ChannelStore";
import UserStore from "../../stores/UserStore";
import { ParticipantTypes } from "../calls/CallConstants";
import { createStyles } from "../../design/components/Styles/native/createStyles";
import Module712 from "../../_bundle/Module712";
import { StreamEnded } from "../../design/components/Illustration/native/redesign/generated/StreamEnded";
import { CircleInformationIcon } from "../../design/components/Icon/native/redesign/generated/CircleInformationIcon";
import { Text } from "../../design/components/Text/native/Text";
import { intl, t } from "../../intl/index.native";
import { useStateFromStores } from "../../_bundle/Module589";
import { Avatar, AvatarSizes } from "../../design/void/native";
import { useSurfaceDirectRendererExperiment } from "../video_calls/native/SurfaceDirectRendererExperiment";
import { useToken } from "../../design/tokens/native/useToken";
import { updateVideoSize } from "../media/VideoActionCreators";
import DCDVideoRenderer from "../video_calls/native/components/DCDVideoRenderer";
import useExternalPipParticipant_android from "./useExternalPipParticipant.android";
import ExternalPip_android from "./ExternalPip.android";
let useStyles, ExternalPipViewVideoUser, ExternalPipViewVideoStream;
const ExternalPipViewVideoUnavailable = function ExternalPipViewVideoUnavailable(props) {
const wasStream = props.wasStream;
const styles2 = useStyles();
return <View style={styles2.unavailable}>
{wasStream ? <StreamEnded style={styles2.unavaiableImage} /> : <CircleInformationIcon />}
<Text variant="text-md/semibold" style={styles2.unavailableText} lineClamp={1}>
{wasStream ? intl.formatToMarkdownString(t["1Ww0Hi"], {}) : intl.string(t.Nzo5nz)}
</Text>
</View>;
};
ExternalPipViewVideoUser = function ExternalPipViewVideoUser(props) {
const { userId, channelId, speaking } = props;
const styles2 = useStyles();
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getUser(userId));
const stateFromStores2 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId)?.guild_id);
return <View style={styles2.user}>
{stateFromStores != null ? <Avatar user={stateFromStores} avatarDecoration={stateFromStores.avatarDecoration} guildId={stateFromStores2} size={AvatarSizes.XXLARGE} animate={speaking} speaking={speaking} /> : null}
</View>;
};
ExternalPipViewVideoStream = function ExternalPipViewVideoStream(props) {
let state, styles, c22490_3;
const { streamId, userId: userId2 } = props;
state = void 0;
styles = void 0;
c22490_3 = void 0;
const surfaceDirectRendererExperiment = useSurfaceDirectRendererExperiment(userId2, {
location: "ExternalPipViewVideoStream"
});
const streamId2 = streamId;
let c22491_1 = 300;
const [state2, setState] = useState(void 0);
const [state3, setState2] = useState(false);
const callback = useCallback(() => setState(streamId2), [streamId]);
useEffect(() => {
if (state2 == null) {
let c30922_0 = setTimeout(() => {
setState2(true);
}, c22491_1);
return () => {
clearTimeout(c30922_0);
};
}
setState2(false);
}, [state2, 300]);
state = state2;
styles = useStyles();
const memo = useMemo(() => [styles.video, {
opacity: state == null ? 0 : 1
}], [styles, state2]);
const token = useToken(Module712.colors.TEXT_FEEDBACK_INFO);
const r20 = PixelRatio.get();
c22490_3 = r20;
return <>
<DCDVideoRenderer useSurfaceDirectRenderer={surfaceDirectRendererExperiment} style={memo} streamId={streamId} onReady={callback} onLayout={useCallback((a0) => {
if (streamId != null) {
const layout = a0.nativeEvent.layout;
const { width, height } = layout;
updateVideoSize(streamId, {
width: width * c22490_3,
height: height * c22490_3
}, 1);
}
}, [streamId, r20])} />
{state2 == null ? state3 ? <View style={styles.videoUnavailableWrap}>
<ActivityIndicator style={styles.videoUnavailableSpinner} size="large" color={token} />
</View> : null : null}
</>;
};
useStyles = createStyles({
container: {
...StyleSheet.absoluteFillObject,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
},
video: {
...StyleSheet.absoluteFillObject
},
videoUnavailableWrap: {
...StyleSheet.absoluteFillObject,
margin: Module712.space.PX_16,
borderRadius: Module712.radii.sm,
justifyContent: "center",
alignContent: "center",
flexDirection: "row",
alignItems: "center",
flexWrap: "wrap",
flex: 1
},
videoUnavailableSpinner: {
marginTop: Module712.space.PX_16
},
unavailable: {
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
borderRadius: Module712.radii.sm,
padding: Module712.space.PX_8,
margin: Module712.space.PX_8,
justifyContent: "center",
alignContent: "center",
alignItems: "center",
flexDirection: "row",
flexWrap: "wrap",
flex: 1
},
unavailableText: {
marginLeft: Module712.space.PX_4,
textAlign: "center"
},
unavaiableImage: {
marginBottom: Module712.space.PX_8,
resizeMode: "contain",
aspectRatio: 2.5,
width: "80%"
},
user: {
...StyleSheet.absoluteFillObject,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST,
borderRadius: Module712.radii.sm,
margin: Module712.space.PX_8,
alignItems: "center",
justifyContent: "center"
}
});
const r122 = Module19.memo(function ExternalPipViewVideo(props) {
const onLayout = props.onLayout;
const styles2 = useStyles();
const externalPipParticipant_android = useExternalPipParticipant_android();
const { channelId: channelId2, selectedParticipantStreamId, selectedParticipantUserId, selectedParticipantSpeaking, focusedParticipantType } = externalPipParticipant_android;
useEffect(() => {
ExternalPip_android.refreshPipUi();
}, [selectedParticipantStreamId, selectedParticipantUserId, focusedParticipantType]);
return <View style={styles2.container} onLayout={onLayout}>
{selectedParticipantStreamId != null ? <ExternalPipViewVideoStream streamId={selectedParticipantStreamId} userId={selectedParticipantUserId} /> : selectedParticipantUserId != null ? <ExternalPipViewVideoUser userId={selectedParticipantUserId} channelId={channelId2} speaking={selectedParticipantSpeaking} /> : <ExternalPipViewVideoUnavailable wasStream={focusedParticipantType === ParticipantTypes.STREAM || focusedParticipantType === ParticipantTypes.HIDDEN_STREAM} />}
</View>;
});
export default r122;
@@ -0,0 +1,25 @@
// Metro module 15915 (f15916).
import { useRef, useInsertionEffect, useEffect } from "react";
import ExternalPip_android from "./ExternalPip.android";
export default function useExternalPipAspectRatioUpdater(a0, a1, a2) {
const current = a2;
const ref = useRef(a2);
useInsertionEffect(() => {
ref.current = current;
});
useEffect(() => {
const targetDimensions = a1.getTargetDimensions(ref.current);
ExternalPip_android.setPipAspectRatio(targetDimensions.width, targetDimensions.height);
return a1.subscribeFromItem(() => {
const targetDimensions2 = a1.getTargetDimensions(ref.current);
const { width, height } = targetDimensions2;
if (!(width === targetDimensions.width && height === targetDimensions.height)) {
targetDimensions = {
width,
height
};
ExternalPip_android.setPipAspectRatio(width, height);
}
});
}, [a1]);
};
@@ -0,0 +1,18 @@
// Metro module 15827 (f15828).
import ChannelRTCStore from "../calls/ChannelRTCStore";
import AuthenticationStore from "../../stores/AuthenticationStore";
import RTCConnectionStore from "../../stores/RTCConnectionStore";
import { useStateFromStoresObject } from "../../_bundle/Module589";
import { DEFAULT_STATE } from "./ExternalPipEnablerState";
export default function useExternalPIPEnabler({ disabled }) {
return useStateFromStoresObject([ChannelRTCStore, RTCConnectionStore, AuthenticationStore], () => {
const channelId = RTCConnectionStore.getChannelId();
if (channelId != null && !disabled) {
return {
...DEFAULT_STATE,
externalPipEnabled: ChannelRTCStore.getVideoParticipants(channelId).filter((item) => !item.localVideoDisabled).length > 0 || ChannelRTCStore.getStreamParticipants(channelId).filter((item) => item.user.id !== AuthenticationStore.getId()).find((item) => item.streamId != null) != null
};
}
return DEFAULT_STATE;
}, [disabled]);
};
@@ -0,0 +1,214 @@
// Metro module 15831 (f15832).
import { useRef, useState, useEffect } from "react";
import ChannelRTCStore from "../calls/ChannelRTCStore";
import AuthenticationStore from "../../stores/AuthenticationStore";
import MediaEngineStore from "../../stores/MediaEngineStore";
import RTCConnectionStore from "../../stores/RTCConnectionStore";
import { ParticipantTypes } from "../calls/CallConstants";
import { useStateFromStores, useStateFromStoresObject } from "../../_bundle/Module589";
export default function useExternalPipParticipant() {
let channelId = useStateFromStores([RTCConnectionStore], () => RTCConnectionStore.getChannelId());
if (channelId == null) {
channelId = void 0;
}
let c22493_0, focusedParticipantStreamId, stateFromStores, setState, stateFromStoresObject;
let c22492_0 = channelId;
const ref = useRef(void 0);
const ref2 = useRef(void 0);
const stateFromStoresObject2 = useStateFromStoresObject([ChannelRTCStore], () => {
let r34;
const r7 = c22492_0 != null ? ChannelRTCStore.getSelectedParticipantId(c22492_0) : null;
const r10 = r7 != null;
let r6 = null;
if (r10) {
const r11 = c22492_0 != null;
r6 = null;
if (r11) {
let r15 = ChannelRTCStore.getParticipant(c22492_0, r7);
if (r15 == null) {
r15 = null;
}
r6 = r15;
}
}
if (ref.current === void 0) {
ref.current = r6?.id;
ref2.current = r6?.type;
}
if (ref.current !== r6?.id) {
r34 = {
focusedParticipantStreamId: void 0,
focusedParticipantUserId: void 0,
focusedParticipantType: ref2.current
};
} else {
const type = r6?.type;
const ACTIVITY = ParticipantTypes.ACTIVITY;
let focusedParticipantStreamId2 = void 0;
if (type !== ACTIVITY) {
let r33 = r6?.streamId;
if (r33 == null) {
r33 = void 0;
}
focusedParticipantStreamId2 = r33;
}
const type2 = r6?.type;
const ACTIVITY2 = ParticipantTypes.ACTIVITY;
let focusedParticipantUserId = void 0;
if (type2 !== ACTIVITY2) {
let r40 = r6 == null ? void 0 : r6.user?.id;
if (r40 == null) {
r40 = void 0;
}
focusedParticipantUserId = r40;
}
let focusedParticipantType = r6?.type;
if (focusedParticipantType == null) {
focusedParticipantType = void 0;
}
r34 = {
focusedParticipantStreamId: focusedParticipantStreamId2,
focusedParticipantUserId,
focusedParticipantType
};
}
return r34;
});
const { focusedParticipantStreamId: focusedParticipantStreamId2, focusedParticipantUserId, focusedParticipantType } = stateFromStoresObject2;
c22493_0 = channelId;
focusedParticipantStreamId = focusedParticipantStreamId2;
stateFromStores = void 0;
setState = void 0;
stateFromStoresObject = void 0;
stateFromStores = useStateFromStores([AuthenticationStore], () => AuthenticationStore.getId());
let state;
[state, setState] = useState(0);
stateFromStoresObject = useStateFromStoresObject([ChannelRTCStore], () => {
let selectedStreamId;
if (c22493_0 != null && focusedParticipantStreamId == null) {
const r12 = Date.now();
let r33 = void 0;
let r34 = void 0;
let r35 = void 0;
let r36 = void 0;
const participants = ChannelRTCStore.getParticipants(c22493_0);
const r10 = (function hasOnlySelfParticipant(a0, a1) {
if (3 < a0.length) {
return false;
}
for (const item of a0) {
if (item.type === ParticipantTypes.ACTIVITY) {
continue;
}
if (item.user?.id === a1) {
continue;
}
return false;
}
return true;
})(participants, stateFromStores);
for (const item of participants) {
if (!r10 && item.type === ParticipantTypes.USER) {
if (item.user?.id === stateFromStores) {
continue;
}
}
const type = item.type;
if (ParticipantTypes.USER === type) {
if ((item.speaking || r12 - item.lastSpoke < 1000) && r33 == null) {
r33 = item;
}
let r74 = item.voiceState?.selfVideo;
if (r74 == null) {
r74 = false;
}
if (r74) {
r74 = r34 == null || r34.lastSpoke < item.lastSpoke;
}
if (r74) {
r34 = item;
}
if (r36 == null || r36.lastSpoke < item.lastSpoke) {
r36 = item;
}
} else if (ParticipantTypes.STREAM === type && r35 == null && item.streamId != null) {
r35 = item;
}
}
const r87 = r33;
let selectedParticipantUserId = r87 == null ? void 0 : r87.user?.id;
if (selectedParticipantUserId == null) {
const r94 = r34;
selectedParticipantUserId = r94 == null ? void 0 : r94.user?.id;
}
if (selectedParticipantUserId == null) {
const r99 = r36;
selectedParticipantUserId = r99 == null ? void 0 : r99.user?.id;
}
if (r33 != null) {
let streamId = r33.streamId;
if (streamId == null) {
streamId = void 0;
}
selectedStreamId = streamId;
} else {
selectedStreamId = r35?.streamId;
if (selectedStreamId == null) {
selectedStreamId = r34?.streamId;
}
if (selectedStreamId == null) {
selectedStreamId = void 0;
}
}
return {
selectedParticipantSpeaking: r87 != null,
selectedParticipantUserId,
selectedStreamId
};
}
return {
selectedParticipantSpeaking: false,
selectedParticipantUserId: void 0,
selectedStreamId: void 0
};
}, [channelId, focusedParticipantStreamId, stateFromStores, state]);
useEffect(() => {
if (stateFromStoresObject.selectedParticipantSpeaking) {
let c28163_0 = setTimeout(() => {
setState((prevState) => prevState + 1);
}, 3000);
return () => {
clearTimeout(c28163_0);
};
}
}, [stateFromStoresObject.selectedParticipantSpeaking]);
const selectedStreamId = stateFromStoresObject.selectedStreamId;
let selectedParticipantUserId = stateFromStoresObject.selectedParticipantUserId;
const selectedParticipantSpeaking = stateFromStoresObject.selectedParticipantSpeaking;
let selectedParticipantStreamId = focusedParticipantStreamId == null ? selectedStreamId : focusedParticipantStreamId;
if (selectedParticipantStreamId == null) {
selectedParticipantStreamId = void 0;
}
if (focusedParticipantStreamId != null) {
selectedParticipantUserId = focusedParticipantUserId;
}
let c22494_0 = selectedParticipantStreamId;
useEffect(() => {
let c30923_1;
let c30923_0 = c22494_0;
if (c22494_0 != null) {
c30923_1 = "useExternalPipParticipant";
MediaEngineStore.getMediaEngine().eachConnection((a0) => a0.setHasActiveVideoOutputSink(c30923_0, true, c30923_1));
return () => {
MediaEngineStore.getMediaEngine().eachConnection((a0) => a0.setHasActiveVideoOutputSink(c30923_0, false, c30923_1));
};
}
}, [selectedParticipantStreamId]);
return {
channelId,
selectedParticipantStreamId,
selectedParticipantUserId,
selectedParticipantSpeaking,
focusedParticipantType
};
};