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,47 @@
// Metro module 16693 (f16694).
import ApplicationStreamingSettingsStore from "../../../stores/ApplicationStreamingSettingsStore";
import { ApplicationStreamPresets } from "../StreamSettingsConstants";
import { MediaEngineContextTypes } from "../../../_bundle/Module4250";
import Logger from "../../debug/Logger";
import ApplicationStreamingManager2 from "../ApplicationStreamingManager";
import AlertActionCreators from "../../../actions/native/AlertActionCreators";
import MobileGoLiveUpsellExperiment from "./MobileGoLiveUpsellExperiment";
import AudioActionCreators from "../../../actions/AudioActionCreators";
let c12027_7 = new Logger("ApplicationStreamingManager");
c12027_7.enableNativeLogger(true);
class ApplicationStreamingManager extends ApplicationStreamingManager2 {
platformShowStreamFull() {
AlertActionCreators.openLazy({
importer: () => import("../../../components_native/calls/stream/StreamFullAlert").then(({ default: Component }) => (a0) => <Component {...a0} />)
});
}
platformHandleStreamStart({ sourceId }) {
if (sourceId != null) {
const r27 = MobileGoLiveUpsellExperiment.getConfig({
location: "platformHandleStreamStart"
}).showMobileGoLiveUpsell ? ApplicationStreamingSettingsStore.getState() : {
preset: ApplicationStreamPresets.PRESET_CUSTOM,
resolution: 720,
fps: 30,
soundshareEnabled: true
};
AudioActionCreators.setGoLiveSource({
desktopSettings: {
sourceId,
sound: r27.soundshareEnabled
},
qualityOptions: {
preset: r27.preset,
resolution: r27.resolution,
frameRate: r27.fps
},
context: MediaEngineContextTypes.STREAM
});
} else {
c12027_7.warn(`invalid start_stream: both application + display modes were specified (source-id: ${sourceId})`);
}
}
platformHandleVoiceStateUpdate() {}
}
const applicationStreamingManager = new ApplicationStreamingManager();
export default applicationStreamingManager;
@@ -0,0 +1,271 @@
// Metro module 10746 (f10747).
import { memo, useCallback, useState } from "react";
import ApplicationStreamingSettingsStore from "../../../stores/ApplicationStreamingSettingsStore";
import ApplicationStreamingStore from "../../../stores/ApplicationStreamingStore";
import ChannelStore from "../../../stores/ChannelStore";
import GuildStore from "../../../stores/GuildStore";
import SelectedChannelStore from "../../../stores/SelectedChannelStore";
import UserStore from "../../../stores/UserStore";
import { ApplicationStreamPresets } from "../StreamSettingsConstants";
import { ApplicationStreamStates } from "../../../Constants";
import { MediaEngineContextTypes } from "../../../_bundle/Module4250";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { isIOS } from "../../../_bundle/Module501";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { ImpressionNames } from "../../../_bundle/Module503";
import { useStateFromStoresObject } from "../../../_bundle/Module589";
import getStreamSettingsForPreset, { canStreamWithPreset, getMaxSettingsForPreset } from "../utils/getStreamSettingsForPreset";
import MobileGoLiveUpsellExperiment from "./MobileGoLiveUpsellExperiment";
import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
import { useSharedValue } from "../../reanimated/ReanimatedRexport";
import { updateStreamSettings } from "../../../actions/StreamActionCreators";
import AudioActionCreators from "../../../actions/AudioActionCreators";
import { MobilePhoneIcon } from "../../../design/components/Icon/native/redesign/generated/MobilePhoneIcon";
import { intl } from "../../../intl/index.native";
import MobileGoLiveActionSheet_messages from "../MobileGoLiveActionSheet.messages";
import { SpeedometerIcon } from "../../../design/components/Icon/native/redesign/generated/SpeedometerIcon";
import { ImageSparkleIcon } from "../../../design/components/Icon/native/redesign/generated/ImageSparkleIcon";
import NativeView from "../../core/native/NativeView";
import { Text } from "../../../design/components/Text/native/Text";
import { BaseIconImage } from "../../../design/components/Icon/native/BaseIconImage";
import Module9406 from "../../../_bundle/Module9406";
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
import { BottomSheetScrollView } from "../../../_bundle/Module5245";
import { SafeAreaPaddingView } from "../../../components_native/common/SafeAreaView";
import { TableRowGroup } from "../../../design/components/TableRow/native/TableRowGroup.native";
import { TableRadioGroup } from "../../../design/components/TableRow/native/TableRadioGroup.native";
import PremiumUpsellUtils from "../../../utils/native/PremiumUpsellUtils";
import { UpsellTypes } from "../../../ConstantsIOS";
import { TableRadioRow } from "../../../design/components/TableRow/native/TableRadioRow.native";
import PremiumFeatureUpsell from "../../premium/roadblocks/native/views/PremiumFeatureUpsell";
import { EntitlementFeatureNames } from "../../../_bundle/Module6201";
import NitroUpsellButton from "../../premium/components/native/NitroUpsellButton";
import { TableSwitchRow } from "../../../design/components/TableRow/native/TableSwitchRow.native";
import { Button } from "../../../design/components/Button/native/Button.native";
import { stopScreenshare, startStream } from "../../video_calls/native/useScreenshareUtils";
import { HermesBuiltin } from "../../../_hermes/prelude";
const useStyles = createStyles({
wrapper: {
gap: Module712.space.PX_24
},
header: {
textAlign: "center"
},
section: {
marginHorizontal: Module712.space.PX_16
},
highQualityLabel: {
flexDirection: "row",
alignItems: "center",
gap: Module712.space.PX_4
}
});
let c7223_17 = "MobileGoLiveActionSheet";
let c7223_18 = [{
preset: ApplicationStreamPresets.PRESET_MOBILE_DEFAULT,
enabled: true
}, {
preset: ApplicationStreamPresets.PRESET_MOBILE_PERFORMANCE,
enabled: !isIOS()
}, {
preset: ApplicationStreamPresets.PRESET_MOBILE_HIGH_QUALITY,
enabled: true
}].filter((item) => item.enabled).map((item) => item.preset);
const r84 = memo(function MobileGoLiveActionSheet() {
let user, guildPremiumTier, callback, isStreaming, activeSourceId, analyticsLocations, styles, callback2;
const stateFromStoresObject = useStateFromStoresObject([ApplicationStreamingSettingsStore], () => ApplicationStreamingSettingsStore.getState());
let preset = stateFromStoresObject.preset;
const soundshareEnabled = stateFromStoresObject.soundshareEnabled;
const stateFromStoresObject2 = useStateFromStoresObject([UserStore, SelectedChannelStore, ChannelStore, GuildStore], () => {
const currentUser = UserStore.getCurrentUser();
const channel = ChannelStore.getChannel(SelectedChannelStore.getVoiceChannelId());
return {
user: currentUser,
guildPremiumTier: GuildStore.getGuild(channel == null ? void 0 : channel.getGuildId())?.premiumTier
};
});
user = stateFromStoresObject2.user;
guildPremiumTier = stateFromStoresObject2.guildPremiumTier;
callback = useCallback((a0) => canStreamWithPreset(a0, user, guildPremiumTier), [user, guildPremiumTier]);
const stateFromStoresObject3 = useStateFromStoresObject([ApplicationStreamingStore], () => {
const currentUserActiveStream = ApplicationStreamingStore.getCurrentUserActiveStream();
const isStreaming2 = currentUserActiveStream != null && currentUserActiveStream.state === ApplicationStreamStates.ACTIVE;
let activeSourceId2 = ApplicationStreamingStore.getStreamerActiveStreamMetadata()?.sourceId;
if (activeSourceId2 == null) {
activeSourceId2 = null;
}
return {
isStreaming: isStreaming2,
activeSourceId: activeSourceId2
};
});
isStreaming = stateFromStoresObject3.isStreaming;
activeSourceId = stateFromStoresObject3.activeSourceId;
const goLiveUpsellVariant = MobileGoLiveUpsellExperiment.useConfig({
location: "MobileGoLiveActionSheet"
}).goLiveUpsellVariant;
analyticsLocations = useAnalyticsLocations(AnalyticsLocation.MOBILE_GO_LIVE_ACTION_SHEET).analyticsLocations;
styles = useStyles();
if (!((preset === ApplicationStreamPresets.PRESET_MOBILE_DEFAULT || preset === ApplicationStreamPresets.PRESET_MOBILE_PERFORMANCE || preset === ApplicationStreamPresets.PRESET_MOBILE_HIGH_QUALITY) && (c7223_18.includes(preset) && callback(preset)))) {
preset = ApplicationStreamPresets.PRESET_MOBILE_DEFAULT;
}
const [state, setState] = useState(preset);
const [state2, setState2] = useState(soundshareEnabled);
const sharedValue = useSharedValue(!callback(ApplicationStreamPresets.PRESET_MOBILE_HIGH_QUALITY));
callback2 = useCallback((a0, a1) => {
let r15 = getStreamSettingsForPreset(a0, user, guildPremiumTier);
if (r15 == null) {
r15 = [];
}
const [resolution, frameRate] = r15;
if (resolution != null && frameRate != null) {
updateStreamSettings({
preset: a0,
resolution,
frameRate,
soundshareEnabled: a1
});
if (isStreaming) {
const r28 = {
qualityOptions: {
preset: a0,
resolution,
frameRate
},
context: MediaEngineContextTypes.STREAM
};
if (activeSourceId != null) {
r28.desktopSettings = {
sourceId: activeSourceId,
sound: a1
};
}
AudioActionCreators.setGoLiveSource(r28);
}
}
}, [user, guildPremiumTier, activeSourceId, isStreaming]);
return <AnalyticsLocationProvider value={analyticsLocations}>
<BottomSheet startExpanded>
<BottomSheetScrollView>
<SafeAreaPaddingView bottom style={styles.wrapper}>
<Text style={styles.header} variant="redesign/heading-18/bold" color="text-strong" accessibilityRole="header">
{intl.string(MobileGoLiveActionSheet_messages.CrNjqp)}
</Text>
<NativeView style={styles.section}>
<TableRowGroup title={intl.string(MobileGoLiveActionSheet_messages["/XSr8v"])} hasIcons={false}>
<TableRadioGroup value={state} onChange={(event) => {
if (callback(event)) {
setState(event);
callback2(event, state2);
if (isStreaming) {
ActionSheetActionCreators.hideActionSheet(c7223_17);
}
} else {
PremiumUpsellUtils.handleShowUpsellAlert({
initialUpsellKey: UpsellTypes.STREAM_HIGH_QUALITY,
analyticsLocations
});
}
}} hasIcons>
{c7223_18.map((item) => {
const maxSettingsForPreset2 = getMaxSettingsForPreset(ApplicationStreamPresets.PRESET_MOBILE_DEFAULT);
const maxSettingsForPreset3 = getMaxSettingsForPreset(ApplicationStreamPresets.PRESET_MOBILE_PERFORMANCE);
const maxSettingsForPreset = getMaxSettingsForPreset(ApplicationStreamPresets.PRESET_MOBILE_HIGH_QUALITY);
const r37 = {
value: item
};
const PRESET_MOBILE_DEFAULT = ApplicationStreamPresets.PRESET_MOBILE_DEFAULT;
const r42 = {
icon: <MobilePhoneIcon />,
label: intl.string(MobileGoLiveActionSheet_messages["2qmQ8N"]),
subLabel: null
};
const r2 = maxSettingsForPreset2 != null;
let subLabel = "";
const subLabel2 = r2 ? intl.formatToPlainString(MobileGoLiveActionSheet_messages.ibH7vy, maxSettingsForPreset2) : "";
const r57 = {};
r42.subLabel = subLabel2;
r57[PRESET_MOBILE_DEFAULT] = r42;
r57[ApplicationStreamPresets.PRESET_MOBILE_PERFORMANCE] = {
icon: <SpeedometerIcon />,
label: intl.string(MobileGoLiveActionSheet_messages["5eO4/m"]),
subLabel: maxSettingsForPreset3 != null ? intl.formatToPlainString(MobileGoLiveActionSheet_messages.fN0UQY, maxSettingsForPreset3) : ""
};
const PRESET_MOBILE_HIGH_QUALITY = ApplicationStreamPresets.PRESET_MOBILE_HIGH_QUALITY;
const r89 = {
icon: <ImageSparkleIcon />,
label: <NativeView style={styles.highQualityLabel}>
<Text variant="text-md/semibold" color="text-strong">
{intl.string(MobileGoLiveActionSheet_messages.nMcXo1)}
</Text>
<BaseIconImage source={Module9406} size="xs" />
</NativeView>,
subLabel: null
};
if (maxSettingsForPreset != null) {
subLabel = intl.formatToPlainString(MobileGoLiveActionSheet_messages.q4gYBi, maxSettingsForPreset);
}
const props = {};
r89.subLabel = subLabel;
r57[PRESET_MOBILE_HIGH_QUALITY] = r89;
HermesBuiltin.copyDataProperties(r37, r57[item]);
HermesBuiltin.copyDataProperties(props, r37);
return <TableRadioRow key={item} {...props} />;
})}
</TableRadioGroup>
</TableRowGroup>
</NativeView>
{goLiveUpsellVariant === "one-step" && sharedValue.get() && <NativeView style={styles.section}>
<PremiumFeatureUpsell featureName={EntitlementFeatureNames.STREAM_HIGH_QUALITY} shouldShow={sharedValue} />
</NativeView>}
{goLiveUpsellVariant === "two-step" && sharedValue.get() && <NativeView style={styles.section}>
<NitroUpsellButton text={intl.string(MobileGoLiveActionSheet_messages.u72Prd)} onPress={() => {
PremiumUpsellUtils.handleShowUpsellAlert({
initialUpsellKey: UpsellTypes.STREAM_HIGH_QUALITY,
analyticsLocations
});
}} />
</NativeView>}
<NativeView style={styles.section}>
<TableRowGroup title={intl.string(MobileGoLiveActionSheet_messages["j+eAMQ"])} hasIcons={false}>
<TableSwitchRow label={intl.string(MobileGoLiveActionSheet_messages.uwMBDo)} value={state2} onValueChange={(value) => {
setState2(value);
callback2(state, value);
}} />
</TableRowGroup>
</NativeView>
<NativeView style={styles.section}>
<Button {...isStreaming ? {
size: "lg",
variant: "destructive",
text: intl.string(MobileGoLiveActionSheet_messages.OsS9Ll),
onPress: () => {
stopScreenshare();
ActionSheetActionCreators.hideActionSheet(c7223_17);
}
} : {
size: "lg",
variant: "primary",
text: intl.string(MobileGoLiveActionSheet_messages["3wwZ/Q"]),
onPress: () => {
ActionSheetActionCreators.hideActionSheet(c7223_17);
startStream();
}
}} />
</NativeView>
</SafeAreaPaddingView>
</BottomSheetScrollView>
</BottomSheet>
</AnalyticsLocationProvider>;
});
export default r84;
export function showMobileGoLiveActionSheet(a0) {
ActionSheetActionCreators.openLazy(import("./MobileGoLiveActionSheet"), c7223_17, {
impressionName: ImpressionNames.MOBILE_GO_LIVE_ACTION_SHEET,
impressionProperties: {
location_stack: a0
}
});
}
@@ -0,0 +1,20 @@
// Metro module 10752 (f10753).
import { createApexExperiment } from "../../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2026-04-mobile-go-live-upsell",
kind: "user",
defaultConfig: {
showMobileGoLiveUpsell: false
},
variations: {
1: {
showMobileGoLiveUpsell: true,
goLiveUpsellVariant: "one-step"
},
2: {
showMobileGoLiveUpsell: true,
goLiveUpsellVariant: "two-step"
}
}
});
export default apexExperiment;
@@ -0,0 +1,166 @@
// Metro module 10567 (f10568).
import { useContext, useRef, useEffect, useCallback } from "react";
import { View } from "react-native";
import { AnalyticEvents } from "../../../Constants";
import { PremiumTypes, PremiumUpsellTypes } from "../../premium/PremiumConstants";
import { ResolutionTypes } from "../../../_bundle/Module4250";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { RevealContext } from "../../video_calls/native/components/RevealProvider";
import { useAnalyticsContext } from "../../../hooks/analytics";
import useAnalyticsLocations from "../../app_analytics/useAnalyticsLocations";
import ReanimatedRexport, { useAnimatedStyle } from "../../reanimated/ReanimatedRexport";
import * as _timing from "../../../design/animation/reanimated/timing/timing";
import * as _native from "../../../design/void/native";
import { LegacyText, LiveTag } from "../../../design/void/native";
import * as _StreamQualityUtils from "../../../utils/StreamQualityUtils";
import { useMaxQuality, getResolutionText, getFPSText } from "../../../utils/StreamQualityUtils";
import useStreamError from "../useStreamError";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import openPremiumModal from "../../../components_native/premium/openPremiumModal";
import { PremiumFeatureCardOrder } from "../../user_settings/premium/native/PremiumFeaturesCards";
import PremiumUtils from "../../../utils/PremiumUtils";
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
import FastImage from "../../../components_native/common/FastImage";
import Module9377 from "../../../_bundle/Module9377";
const useStyles = createStyles({
liveIndicator: {
flexDirection: "row",
alignItems: "center",
height: 18
},
liveTag: {
borderBottomLeftRadius: Module712.radii.none,
borderTopLeftRadius: Module712.radii.none,
height: 18,
textAlign: "center"
},
qualityTag: {
borderBottomLeftRadius: Module712.radii.sm,
borderTopLeftRadius: Module712.radii.sm,
backgroundColor: Module712.unsafe_rawColors.PRIMARY_800,
opacity: 0.8,
paddingLeft: 8,
paddingRight: 4,
flexDirection: "row",
alignItems: "center",
height: 18
},
qualityTagText: {
color: "#fff",
textAlign: "center",
fontWeight: "700"
},
reducedQualityTagText: {
color: Module712.unsafe_rawColors.PRIMARY_300
},
nitroWheel: {
width: 20,
marginLeft: -4
}
});
const __initData = {
code: "function StreamQualityLiveIndicatorTsx1(){const{withTiming,reveal,STANDARD_EASING}=this.__closure;return{opacity:withTiming(reveal?1:0,{easing:STANDARD_EASING,duration:250})};}"
};
export default function StreamQualityLiveIndicator(props) {
let r59, r65, pointerEvents;
let isPremiumFPS, isPremiumResolution, c18132_6;
const { participant, style } = props;
isPremiumFPS = void 0;
isPremiumResolution = void 0;
c18132_6 = void 0;
const styles = useStyles();
const reveal = useContext(RevealContext).reveal;
const location2 = useAnalyticsContext().location;
const analyticsLocations = useAnalyticsLocations().analyticsLocations;
const ref = useRef(false);
const f = function f() {
return {
opacity: _timing.withTiming(reveal ? 1 : 0, {
easing: _native.STANDARD_EASING,
duration: 250
})
};
};
f.__closure = {
withTiming: _timing.withTiming,
reveal,
STANDARD_EASING: _native.STANDARD_EASING
};
f.__workletHash = 14676679064575;
f.__initData = __initData;
const animatedStyle = useAnimatedStyle(f);
const maxQuality = useMaxQuality(participant);
const r54 = useStreamError(participant) != null;
try {
const isPremiumFPS2 = _StreamQualityUtils.isPremiumFPS(maxQuality);
r59 = isPremiumFPS2;
isPremiumFPS = isPremiumFPS2;
} catch ($e) {
r59 = false;
isPremiumFPS = false;
}
try {
const isPremiumResolution2 = _StreamQualityUtils.isPremiumResolution(maxQuality);
r65 = isPremiumResolution2;
isPremiumResolution = isPremiumResolution2;
} catch ($e) {
r65 = false;
isPremiumResolution = false;
}
let r67 = r59 || r65;
c18132_6 = r67;
useEffect(() => {
const current = ref.current;
if (current ? !current : c18132_6) {
AnalyticsUtils.track(AnalyticEvents.PREMIUM_UPSELL_VIEWED, {
type: PremiumUpsellTypes.STREAM_QUALITY_INDICATOR,
has_premium_stream_fps: isPremiumFPS,
has_premium_stream_resolution: isPremiumResolution,
location_stack: analyticsLocations
});
ref.current = true;
}
}, [analyticsLocations, r67, r59, r65]);
const callback = useCallback(() => {
openPremiumModal({
analyticsLocation: location2,
analyticsLocations,
premiumFeatureCardOrder: PremiumFeatureCardOrder.TIER_0_LEADING
});
}, [location2, analyticsLocations]);
const isPremium = PremiumUtils.isPremium(participant.user, PremiumTypes.TIER_1);
const r83 = isPremium ? !isPremium : !PremiumUtils.canStreamQuality(PremiumUtils.StreamQuality.MID, participant.user);
const r98 = PremiumUtils.isPremiumExactly(participant.user, PremiumTypes.TIER_1) && (maxQuality == null ? void 0 : maxQuality.maxResolution.type) === ResolutionTypes.SOURCE && !PremiumUtils.canStreamQuality(PremiumUtils.StreamQuality.HIGH);
const r112 = maxQuality == null;
let r113 = null;
if (!r112) {
L20: {
pointerEvents = "none";
if (r67) {
if (!r83) {
pointerEvents = "none";
if (!r98) {
break L20;
}
}
pointerEvents = "auto";
}
}
if (r67) {
r67 = <FastImage source={Module9377} style={styles.nitroWheel} resizeMode="contain" />;
}
r113 = <ReanimatedRexport.View pointerEvents={pointerEvents} style={[style, animatedStyle]}>
<PressableOpacity accessibilityRole="button" style={[styles.liveIndicator, style]} onPress={callback}>
<View style={styles.qualityTag}>
{r67}
<LegacyText style={[styles.qualityTagText, r54 ? styles.reducedQualityTagText : null]}>
{`${getResolutionText(maxQuality.maxResolution)} ${getFPSText(maxQuality.maxFrameRate)}`}
</LegacyText>
</View>
<LiveTag style={styles.liveTag} />
</PressableOpacity>
</ReanimatedRexport.View>;
}
return r113;
};
@@ -0,0 +1,203 @@
// Metro module 4367 (f4368).
import { Linking } from "react-native";
import ApplicationStreamingStore from "../../../stores/ApplicationStreamingStore";
import ChannelStore from "../../../stores/ChannelStore";
import SelectedChannelStore from "../../../stores/SelectedChannelStore";
import { Base64JPEGPrefix, Endpoints, IOS_BUNDLE_ID, NOOP_NULL } from "../../../Constants";
import { getAppIntentScheme } from "../../activities/Constants";
import Logger from "../../debug/Logger";
import { Timeout } from "../../../_bundle/Timeout";
import { DisableStreamPreviews } from "../../user_settings/UserSettings";
import Dispatcher from "../../../Dispatcher";
import { HTTP } from "../../../_bundle/sendRequest";
import LifecycleManager from "../../../lib/LifecycleManager";
import { getVoiceEngine } from "../../../_bundle/Module4238";
import Module38 from "../../../_bundle/Module38";
import { stopStream, startStream } from "../../../actions/StreamActionCreators";
import ChannelRTCActionCreators from "../../../actions/ChannelRTCActionCreators";
import { encodeStreamKey } from "../utils/StreamKeyUtils";
import { getWindowDimensions } from "../../screen/useWindowDimensions.native";
import { handleCloseScreenshare } from "../../video_calls/native/useScreenshareUtils";
import PushNotification from "../../../lib/pushnotification/PushNotification";
import { intl, t } from "../../../intl/index.native";
import { HermesBuiltin } from "../../../_hermes/prelude";
function $mk114513($env) {
return () => {
const r1 = $env;
return (0, handleThumbnailUpload)(r1[0], r1[1]);
};
}
let c2586_13, c2586_14, c2586_15, c2586_21, c2586_22;
let env2586 = {};
const handleThumbnailUpload = async function handleThumbnailUpload(streamKey, c25057_1) {
let c25057_2, c25057_3, c25057_4;
let c25057_5 = 0;
const r12 = env2586;
L13: {
L12: {
try {
let env29318;
c25057_3 = r12;
const r33 = env29318 = {
$parent: r12
};
c25057_2 = r33;
env29318[0] = streamKey;
env29318[1] = c25057_1;
if (DisableStreamPreviews.getSetting()) {
break L13;
}
c2586_14.stop();
const previewURL = `${Base64JPEGPrefix}${c25057_1}`;
Dispatcher.dispatch({
type: "STREAM_PREVIEW_FETCH_SUCCESS",
streamKey,
previewURL
});
c25057_5 = 1;
await HTTP.post({
url: Endpoints.STREAM_PREVIEW(streamKey),
body: {
thumbnail: previewURL
},
oldFormErrors: true,
rejectWithError: false
});
c25057_5 = 0;
} catch ($e) {
const r31 = $e;
let r8 = r31;
c25057_4 = r31;
if (c25057_5 !== 0) {
while (true) {
try {
const r86 = c25057_2;
const r88 = c25057_4;
c25057_5 = 0;
env29318[2] = r88;
c2586_13.error("Failed to post stream preview", env29318[2]);
c2586_14.start(60000, $mk114513(r86));
break L12;
} catch (r84) {
r8 = r84;
c25057_4 = r84;
if (c25057_5 === 0) {
break;
}
}
}
}
throw r8;
}
}
return void 0;
}
};
const logger = new Logger("VoiceEngineStreamingManager");
c2586_13 = logger;
logger.enableNativeLogger(true);
c2586_14 = new Timeout();
c2586_15 = new Timeout();
env2586[16] = [];
env2586[20] = SelectedChannelStore.getVoiceChannelId();
c2586_21 = Symbol("#e");
class VoiceEngineStreamingManager extends LifecycleManager {
constructor() {
super(...arguments);
if (Object.prototype.hasOwnProperty.call(this, c2586_21)) {
HermesBuiltin.throwTypeError("Cannot initialize private field twice.");
throw new Error("unreachable");
}
this[c2586_21] = ({ channelId }) => {
if (env2586[20] !== channelId) {
const r5 = env2586[19];
if (r5 != null) {
r5.stopBroadcast();
}
ApplicationStreamingStore.getAllActiveStreams().forEach((item) => {
if (item.channelId !== channelId) {
stopStream(encodeStreamKey(item), false);
}
});
}
env2586[20] = channelId;
};
}
_initialize() {
const voiceEngine = getVoiceEngine();
env2586[19] = voiceEngine;
voiceEngine.setBroadcastRequestCallback(() => {
c2586_13.log("Broadcast Requested");
Module38(env2586[19] != null, "Voice Engine should be initialized in callback");
env2586[16] = [];
const channel = ChannelStore.getChannel(SelectedChannelStore.getVoiceChannelId());
const currentAppIntent = ApplicationStreamingStore.getCurrentAppIntent();
if (channel != null) {
startStream(channel.getGuildId(), channel.id, {
sourceId: "screen:0"
});
const currentUserActiveStream = ApplicationStreamingStore.getCurrentUserActiveStream();
if (currentUserActiveStream != null) {
ChannelRTCActionCreators.selectParticipant(channel.id, encodeStreamKey(currentUserActiveStream));
if (env2586[19].platform === "android") {
c2586_15.start(15000, () => {
Module38(env2586[19] != null, "Voice Engine should be initialized in callback");
const windowDimensions = getWindowDimensions();
const r31 = Math.min(512 / windowDimensions.width, 288 / windowDimensions.height);
env2586[19].setBroadcastThumbnailCallback(windowDimensions.width * r31, windowDimensions.height * r31, 300, (a0) => {
c2586_13.log("Broadcast thumbnail of size:", a0.length);
handleThumbnailUpload(encodeStreamKey(currentUserActiveStream), a0);
});
});
}
if (currentAppIntent != null) {
Linking.openURL((0, getAppIntentScheme)(currentAppIntent));
}
}
} else {
env2586[19].stopBroadcastWithError(-1, "Not currently in a voice channel");
}
});
env2586[19].setBroadcastFinishedCallback(() => {
c2586_13.log("Broadcast Finished");
c2586_14.stop();
c2586_15.stop();
handleCloseScreenshare();
});
env2586[19].setBroadcastAnnotatedCallback((a0) => {
c2586_13.log("Broadcast Annotated:", a0);
if (a0 !== IOS_BUNDLE_ID) {
const r11 = env2586[16].indexOf(a0, 0);
if (r11 > -1) {
env2586[16].splice(r11, 1);
}
env2586[16].push(a0);
}
});
env2586[19].setBroadcastBlockedCallback(() => {
c2586_13.log("Broadcast Blocked");
PushNotification.presentLocalNotification({
alertBody: intl.string(t.iYQlwv)
});
});
Dispatcher.subscribe("VOICE_CHANNEL_SELECT", this[c2586_21]);
}
_terminate() {
const voiceEngine = getVoiceEngine();
if (voiceEngine != null) {
voiceEngine.setBroadcastRequestCallback(NOOP_NULL);
voiceEngine.setBroadcastFinishedCallback(NOOP_NULL);
voiceEngine.setBroadcastAnnotatedCallback(NOOP_NULL);
voiceEngine.setBroadcastBlockedCallback(NOOP_NULL);
}
c2586_14.stop();
c2586_15.stop();
Dispatcher.unsubscribe("VOICE_CHANNEL_SELECT", this[c2586_21]);
}
getApplicationNames() {
return env2586[16];
}
}
c2586_22 = VoiceEngineStreamingManager;
const r76 = new VoiceEngineStreamingManager();
export default r76;