/* Metro module 10794; source: modules/video_calls/native/useScreenshareUtils.tsx; dependencies: [31, 27, 4492, 661, 4092, 7145, 4261, 9228, 8913, 4285, 8899, 9235, 10795, 10600, 1581, 10806, 10807, 10808, 10809, 10801, 566, 6771, 1244, 2] */ import ApplicationStreamingStore from '../../../stores/ApplicationStreamingStore.tsx'; /* Metro dependency 4492 */ import AudioActionCreators from '../../../actions/AudioActionCreators.tsx'; /* Metro dependency 8899 */ import UseHasVideoPermission from '../useHasVideoPermission.tsx'; /* Metro dependency 10600 */ import MobileGoLiveUpsellExperiment from '../../go_live/native/MobileGoLiveUpsellExperiment.tsx'; /* Metro dependency 10801 */ 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 ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */ import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */ import * as DeviceUtilsModule from '../../../utils/native/DeviceUtils.tsx'; /* Metro dependency 4092 */ import * as InjectModule from '../../../external/discord_common/js/packages/media-engine/native/inject.tsx'; /* Metro dependency 4261 */ import * as CallsUtilsModule from '../../voice_calls/native/CallsUtils.tsx'; /* Metro dependency 9228 */ function _fun82906(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#82906, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10980:6, offset: 0x01f05b65, size: 326 bytes, params: 8, frame: 22 const env0_0 = require; const startStream_829072 = startStream_82907; const getOSRequirement2 = getOSRequirement; const getStreamPressHandler2 = getStreamPressHandler; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const NativeModules = (ReactNativeModule).NativeModules; const env0_6 = (DeviceUtilsModule).getSystemVersionMajor(); const env0_7 = NativeModules.BroadcastUploadManager; const handleCloseScreenshare2 = handleCloseScreenshare; const closure5 = function() { require(dependencyMap[6]).getVoiceEngine().stopBroadcast(); handleCloseScreenshare(); }; (FileImportTrackerModule).fileFinishedImporting('modules/video_calls/native/useScreenshareUtils.tsx'); exports.default = _default_82916; exports.handleCloseScreenshare = handleCloseScreenshare2; exports.stopScreenshare = closure5; exports.startStream = startStream_829072; exports.getOSRequirement = getOSRequirement2; exports.getStreamPressHandler = getStreamPressHandler2; exports.tryStartScreenShare = function(a0) { if (getOSRequirement() && require(dependencyMap[13]).getVideoPermission(a0)) { startStream_82907(); } }; function startStream_82907() { // fn#82907, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10980:476, offset: 0x01f05cab, size: 109 bytes, params: 1, frame: 12 const getVoiceEngine = InjectModule.getVoiceEngine; if (Reflect.apply(getVoiceEngine, InjectModule, []).platform === 'android') { (importDefault(7145) /* metro dependency 7145: ForegroundServiceManagerAndroid */).isForegroundServiceRunning(_fun82908); } else { BroadcastUploadManager.showPicker(); } function _fun82908(a0) { // fn#82908, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10980:581, offset: 0x01f05d18, size: 83 bytes, params: 2, frame: 12 let value = environment.__proto__; if (a0) { value = require(4261) /* metro dependency 4261: inject */; value = value.getVoiceEngine(); value.startBroadcast(); } else { (require(9228) /* metro dependency 9228: CallsUtils */).showScreenshareDisabledAlert(); } } } function getOSRequirement() { // fn#82909, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10980:686, offset: 0x01f05d6b, size: 16 bytes, params: 1, frame: 2 return env0_6 >= 12; } function getStreamPressHandler({channel, hasPermission, isActive, osRequirement, showMobileGoLiveUpsell, analyticsLocations}) { // fn#82910, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10980:727, offset: 0x01f05d7b, size: 130 bytes, params: 2, frame: 18 showMobileGoLiveUpsell = !(showMobileGoLiveUpsell === undefined) && showMobileGoLiveUpsell; return osRequirement ? hasPermission ? showMobileGoLiveUpsell ? getStreamPressHandlerS : isActive ? stopScreenshare : startStream_82907 : (require(9228) /* metro dependency 9228: CallsUtils */).showScreenshareDisabledAlert : getStreamPressHandlerS_82912; function getStreamPressHandlerS() { // fn#82911, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10980:896, owner: getStreamPressHandler.S, offset: 0x01f05dfd, size: 45 bytes, params: 1, frame: 11 let value = environment.__proto__; value = require(10795) /* metro dependency 10795: MobileGoLiveActionSheet */; return value.showMobileGoLiveActionSheet(analyticsLocations); } function getStreamPressHandlerS_82912() { // fn#82912, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10980:1004, owner: getStreamPressHandler.S, offset: 0x01f05e2a, size: 103 bytes, params: 1, frame: 15 let value = environment.__proto__; value = require(9235) /* metro dependency 9235: AVError */; const reportAVError = value.reportAVError; const AVError = (require(9235) /* metro dependency 9235: AVError */).AVError; const SCREENSHARE_OS_NOT_SUPPORTED = AVError.SCREENSHARE_OS_NOT_SUPPORTED; Reflect.apply(reportAVError, value, [{type: SCREENSHARE_OS_NOT_SUPPORTED, channelId: channel.id}]); (CallsUtilsModule).showMinOSScreenshareRequirementAlert(); } } function handleCloseScreenshare() { // fn#82913, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10980:258, offset: 0x01f05e91, size: 114 bytes, params: 1, frame: 17 var moduleValue; var stopStream; var moduleValue2; const currentUserActiveStream = ApplicationStreamingStore.getCurrentUserActiveStream(); if (currentUserActiveStream != null) { moduleValue = require(8913) /* metro dependency 8913: StreamActionCreators */; stopStream = moduleValue.stopStream; moduleValue2 = require(4285) /* metro dependency 4285: StreamKeyUtils */; Reflect.apply(stopStream, moduleValue, [moduleValue2.encodeStreamKey(currentUserActiveStream)]); } (AudioActionCreators).setGoLiveSource(null); } function getShareIcon(a0, a1) { // fn#82915, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10980:1168, offset: 0x01f05f3a, size: 116 bytes, params: 3, frame: 14 var r0; if (require(dependencyMap[14]).isMetaQuest()) { r0 = importDefault(a0 ? dependencyMap[15] : dependencyMap[16]); } else { r0 = a1 ? dependencyMap[17] : a0 ? dependencyMap[18] : dependencyMap[17]; r0 = importDefault(r0); } return r0; } function _default_82916(a0) { // fn#82916, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10980:1249, offset: 0x01f05fae, size: 228 bytes, params: 2, frame: 22 const env0_0 = a0; const value2 = (UseHasVideoPermission)(a0); const oSRequirement = getOSRequirement(); const defaultImport = MobileGoLiveUpsellExperiment; const useConfig = defaultImport.useConfig; const showMobileGoLiveUpsell = Reflect.apply(useConfig, defaultImport, [{location: 'useScreenshareUtils'}]).showMobileGoLiveUpsell; return showMobileGoLiveUpsell.useMemo(_fun82918, [(require(566) /* metro dependency 566: flux */).useStateFromStores([ApplicationStreamingStore], function() { return ApplicationStreamingStore.getCurrentUserActiveStream(); }), a0, value2, oSRequirement, showMobileGoLiveUpsell, (importDefault(6771) /* metro dependency 6771: useAnalyticsLocations */)().analyticsLocations]); function _fun82918() { // fn#82918, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10980:1492, offset: 0x01f060a5, size: 287 bytes, params: 1, frame: 19 const intl = (IndexNativeModule).intl; const t = (IndexNativeModule).t; const r4 = currentUserActiveStream != null && currentUserActiveStream.state === ApplicationStreamStates.ACTIVE; const object = {}; object.isFeatureEnabled = env0_1 && env0_2; object.isActive = r4; object.text = showMobileGoLiveUpsell ? intl.string(t.fjBNo1) : r4 ? intl.string(t.CpkXwZ) : intl.string(t.fjBNo1); const getStreamPressHandlerBinding = getStreamPressHandler; showMobileGoLiveUpsellBinding = showMobileGoLiveUpsell; object.onPress = getStreamPressHandlerBinding({channel: env0_0, hasPermission: env0_1, isActive: r4, osRequirement: env0_2, showMobileGoLiveUpsell: showMobileGoLiveUpsellBinding, analyticsLocations: analyticsLocations}); object.imgSource = getShareIcon(r4, showMobileGoLiveUpsellBinding); return object; } } } global.__d(_fun82906, 10794, [31, 27, 4492, 661, 4092, 7145, 4261, 9228, 8913, 4285, 8899, 9235, 10795, 10600, 1581, 10806, 10807, 10808, 10809, 10801, 566, 6771, 1244, 2]) /* metro module 10794, dependencies: [31, 27, 4492, 661, 4092, 7145, 4261, 9228, 8913, 4285, 8899, 9235, 10795, 10600, 1581, 10806, 10807, 10808, 10809, 10801, 566, 6771, 1244, 2] */;