// 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 {intl.string(MobileGoLiveActionSheet_messages.CrNjqp)} { 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: , 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: , 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: , label: {intl.string(MobileGoLiveActionSheet_messages.nMcXo1)} , 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 ; })} {goLiveUpsellVariant === "one-step" && sharedValue.get() && } {goLiveUpsellVariant === "two-step" && sharedValue.get() && { PremiumUpsellUtils.handleShowUpsellAlert({ initialUpsellKey: UpsellTypes.STREAM_HIGH_QUALITY, analyticsLocations }); }} /> } { setState2(value); callback2(state, value); }} />