/* Metro module 4491; source: modules/go_live/native/VoiceEngineStreamingManager.tsx; dependencies: [6, 7, 15, 17, 18, 99, 100, 5, 27, 4492, 1379, 1934, 661, 4237, 3, 4041, 3829, 694, 507, 4285, 8913, 4261, 44, 7712, 1478, 10794, 10741, 1244, 4561, 2] */ import Logger from '../../debug/Logger.tsx'; /* Metro dependency 3 */ import Module00005 from '../../../by-id/module-00005.js'; /* Metro dependency 5 */ import ClassCallCheck from '../../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */ import CreateClass from '../../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */ import PossibleConstructorReturn from '../../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */ import Module00017 from '../../../by-id/module-00017.js'; /* Metro dependency 17 */ import Inherits from '../../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */ import Module00044 from '../../../by-id/module-00044.js'; /* Metro dependency 44 */ import Module00099 from '../../../by-id/module-00099.js'; /* Metro dependency 99 */ import Module00100 from '../../../by-id/module-00100.js'; /* Metro dependency 100 */ import Dispatcher from '../../../Dispatcher.tsx'; /* Metro dependency 694 */ import ChannelStore from '../../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */ import SelectedChannelStore from '../../../stores/SelectedChannelStore.tsx'; /* Metro dependency 1934 */ import ApplicationStreamingStore from '../../../stores/ApplicationStreamingStore.tsx'; /* Metro dependency 4492 */ import PushNotification from '../../../lib/pushnotification/PushNotification.tsx'; /* Metro dependency 10741 */ 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 ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */ import * as UseWindowDimensionsNativeModule from '../../screen/useWindowDimensions.native.tsx'; /* Metro dependency 1478 */ import * as TimersModule from '../../../external/discord_common/js/packages/timers/Timers.tsx'; /* Metro dependency 4041 */ import * as ConstantsModule2 from '../../activities/Constants.tsx'; /* Metro dependency 4237 */ import * as InjectModule from '../../../external/discord_common/js/packages/media-engine/native/inject.tsx'; /* Metro dependency 4261 */ import * as StreamKeyUtilsModule from '../utils/StreamKeyUtils.tsx'; /* Metro dependency 4285 */ import * as UseScreenshareUtilsModule from '../../video_calls/native/useScreenshareUtils.tsx'; /* Metro dependency 10794 */ function _fun38261(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#38261, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4669:6, offset: 0x010bb011, size: 596 bytes, params: 8, frame: 22 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = Module00100; const value5 = Object.create(Logger.prototype, {constructor: {value: Logger}}); const logger2 = new Logger('VoiceEngineStreamingManager'); (logger2 instanceof Object ? logger2 : value5).enableNativeLogger(true); const Timeout = (TimersModule).Timeout; let timeout = new Timeout(); timeout = new Timeout(); const env0_23 = []; const env0_24 = _fun38265(); const env0_25 = SelectedChannelStore.getVoiceChannelId(); const env0_26 = value('handleVoiceChannelSelect'); value = importDefault(4561) /* metro dependency 4561: LifecycleManager */; value = _fun38270(value); value = new value(); (FileImportTrackerModule).fileFinishedImporting('modules/go_live/native/VoiceEngineStreamingManager.tsx'); exports.default = value; function _isNativeReflectConstruct_38262() { // fn#38262, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4669:336, offset: 0x010bb265, size: 94 bytes, params: 1, frame: 18 var Boolean; var prototype; var valueOf; var call; var Reflect; var construct; var closure; var value; var error; try { Boolean = global.Boolean; prototype = Boolean.prototype; valueOf = prototype.valueOf; call = valueOf.call; Reflect = global.Reflect; construct = Reflect.construct; Boolean = global.Boolean; closure = function() { }; value = Reflect.apply(construct, Reflect, [Boolean, [], closure]); value = Reflect.apply(call, valueOf, [value]); var result = !value; } catch (error) { } return (_isNativeReflectConstruct_38262_isNativeReflectConstruct = function() { return !!result; })(); } function _fun38265() { // fn#38265, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4669:666, offset: 0x010bb2c3, size: 32 bytes, params: 1, frame: 12 const env0_0 = Module00005(_fun38267); return _fun38269; function* _fun38267(a0, a1) { // fn#38267, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4669:686, offset: 0x010bb2ec, size: 334 bytes, params: 3, frame: 20 var environment; var binding; var DisableStreamPreviews; var getSetting; var stop; var HermesInternal; var concat; var value3; var value4; var dispatch; var object; var binding2; var property; var value5; var HTTP; var post; var STREAM_PREVIEW; var value6; var object2; var value7; var value8; var value9; var error; var error2; var start; if (true) { reduciblePort28: while (true) { exceptionLanding27: while (true) { var env0_0 = a0; var env0_1 = a1; value = environment.__proto__.__proto__; binding = env2_0; DisableStreamPreviews = binding(env2_2[16]).DisableStreamPreviews; getSetting = DisableStreamPreviews.getSetting; if (Reflect.apply(getSetting, DisableStreamPreviews, [])) { break reduciblePort28; } binding = env2_21; stop = binding.stop; Reflect.apply(stop, binding, []); binding = env2_14; HermesInternal = global.HermesInternal; concat = HermesInternal.concat; value3 = '' + binding + a1; binding = env2_1; value4 = binding(env2_2[17]); dispatch = value4.dispatch; Reflect.apply(dispatch, value4, [{type: 'STREAM_PREVIEW_FETCH_SUCCESS', streamKey: a0, previewURL: value3}]); try { binding = env2_0; } catch (error) { break exceptionLanding27; } try { binding2 = env2_2; } catch (error) { break exceptionLanding27; } try { property = binding2[18]; } catch (error) { break exceptionLanding27; } try { value5 = binding(property); } catch (error) { break exceptionLanding27; } try { HTTP = value5.HTTP; } catch (error) { break exceptionLanding27; } try { post = HTTP.post; } catch (error) { break exceptionLanding27; } try { object = {}; } catch (error) { break exceptionLanding27; } try { binding = env2_15; } catch (error) { break exceptionLanding27; } try { STREAM_PREVIEW = binding.STREAM_PREVIEW; } catch (error) { break exceptionLanding27; } try { value6 = Reflect.apply(STREAM_PREVIEW, binding, [a0]); } catch (error) { break exceptionLanding27; } try { object.url = value6; } catch (error) { break exceptionLanding27; } try { object2 = {}; } catch (error) { break exceptionLanding27; } try { object2.thumbnail = value3; } catch (error) { break exceptionLanding27; } try { object.body = object2; } catch (error) { break exceptionLanding27; } try { object.oldFormErrors = true; } catch (error) { break exceptionLanding27; } try { object.rejectWithError = false; } catch (error) { break exceptionLanding27; } try { value7 = Reflect.apply(post, HTTP, [object]); } catch (error) { break exceptionLanding27; } yield value7; try { value8 = undefined; value9 = false; } catch (error) { break exceptionLanding27; } if (value9) { return value8; } break reduciblePort28; } binding = env2_19; error2 = binding.error; Reflect.apply(error2, binding, ['Failed to post stream preview', error]); binding = env2_21; start = binding.start; Reflect.apply(start, binding, [60000, _fun38268]); break reduciblePort28; } } function _fun38268() { // fn#38268, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4669:1034, offset: 0x010bb43a, size: 28 bytes, params: 1, frame: 13 return env3_24(env0_0, require); } } function _fun38269() { // fn#38269, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4669:1059, offset: 0x00c3945f, size: 30 bytes, params: 1, frame: 13 return env0_0.apply(this, arguments); } } function _fun38270(a0) { // fn#38270, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4669:1167, offset: 0x010bb456, size: 116 bytes, params: 2, frame: 16 const VoiceEngineStreamingManager2 = VoiceEngineStreamingManager; Inherits(VoiceEngineStreamingManager2, a0); return CreateClass(VoiceEngineStreamingManager2, [{key: '_initialize', value: value_38274}, {key: '_terminate', value: value_38281}, {key: 'getApplicationNames', value: value_38282}]); function VoiceEngineStreamingManager(a0) { // fn#38271, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4669:1179, offset: 0x010bb4ca, size: 170 bytes, params: 2, frame: 20 var r0; var Reflect; let value = copyRestArgs(0, undefined); let binding = env1_3; binding(this, VoiceEngineStreamingManager); const items2 = []; arraySpread(items2, value, 0, items2); value = env1_6(VoiceEngineStreamingManager); binding = env1_5; if (_isNativeReflectConstruct_38262()) { Reflect = global.Reflect; value = Reflect.construct(value, items2, env1_6(this).constructor); r0 = value; } else { value = value.apply(this, items2); r0 = value; } value = binding(this, r0); const Object = global.Object; Object.defineProperty(value, env1_26, {writable: true, value: value_38272}); return value; function VoiceEngineStreamingManagerValue({channelId}) { // fn#38272, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4669:1491, owner: VoiceEngineStreamingManager.value, offset: 0x010bb574, size: 82 bytes, params: 2, frame: 13 var binding; if (env2_25 !== channelId) { binding = env2_20; if (binding != null) { binding.stopBroadcast(); } ApplicationStreamingStore.getAllActiveStreams().forEach(_fun38273); } function _fun38273(a0) { // fn#38273, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4669:1587, offset: 0x010bb5c6, size: 85 bytes, params: 2, frame: 15 const channelId2 = a0.channelId; var value; if (channelId2 !== channelId) { value = environment.__proto__.__proto__.__proto__; value = require(4285) /* metro dependency 4285: StreamKeyUtils */; value = value.encodeStreamKey(a0); (require(8913) /* metro dependency 8913: StreamActionCreators */).stopStream(value, false); } } } } function value_38274() { // fn#38274, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4669:1781, offset: 0x010bb61b, size: 172 bytes, params: 1, frame: 16 const voiceEngine = (InjectModule).getVoiceEngine(); voiceEngine2 = voiceEngine; voiceEngine.setBroadcastRequestCallback(_fun38275); let binding = voiceEngine2; binding.setBroadcastFinishedCallback(_fun38278); voiceEngine2.setBroadcastAnnotatedCallback(_fun38279); voiceEngine2.setBroadcastBlockedCallback(_fun38280); const defaultImport = Dispatcher; const subscribe = defaultImport.subscribe; binding = env1_8; const binding2 = env1_26; Reflect.apply(subscribe, defaultImport, ['VOICE_CHANNEL_SELECT', binding(this, binding2)[binding2]]); function _fun38275() { // fn#38275, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4669:1851, offset: 0x010bb6c7, size: 385 bytes, params: 1, frame: 22 var guildId; var moduleValue; var startStream; var id; var currentUserActiveStream; var defaultImport2; var selectParticipant; var moduleValue2; env2_19.log('Broadcast Requested'); (Module00044)(env2_20 != null, 'Voice Engine should be initialized in callback'); env2_23 = []; const channel = ChannelStore.getChannel(SelectedChannelStore.getVoiceChannelId()); const currentAppIntent = ApplicationStreamingStore.getCurrentAppIntent(); if (channel != null) { guildId = channel.getGuildId(); moduleValue = require(8913) /* metro dependency 8913: StreamActionCreators */; startStream = moduleValue.startStream; id = channel.id; Reflect.apply(startStream, moduleValue, [guildId, id, {sourceId: 'screen:0'}]); currentUserActiveStream = ApplicationStreamingStore.getCurrentUserActiveStream(); if (currentUserActiveStream != null) { defaultImport2 = importDefault(7712) /* metro dependency 7712: ChannelRTCActionCreators */; selectParticipant = defaultImport2.selectParticipant; id = channel.id; moduleValue2 = require(4285) /* metro dependency 4285: StreamKeyUtils */; Reflect.apply(selectParticipant, defaultImport2, [id, moduleValue2.encodeStreamKey(currentUserActiveStream)]); if (env2_20.platform === 'android') { env2_22.start(15000, _fun38276); } if (currentAppIntent != null) { Linking.openURL(getAppIntentScheme(currentAppIntent)); } } } else { env2_20.stopBroadcastWithError(-1, 'Not currently in a voice channel'); } function _fun38276() { // fn#38276, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4669:2260, offset: 0x010bb848, size: 172 bytes, params: 1, frame: 18 (Module00044)(env3_20 != null, 'Voice Engine should be initialized in callback'); const windowDimensions = (UseWindowDimensionsNativeModule).getWindowDimensions(); const value3 = 512 / windowDimensions.width; const value4 = 288 / windowDimensions.height; const Math = global.Math; const value5 = Math.min(value3, value4); env3_20.setBroadcastThumbnailCallback(windowDimensions.width * value5, windowDimensions.height * value5, 300, _fun38277); function _fun38277(a0) { // fn#38277, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4669:2480, offset: 0x010bb8f4, size: 85 bytes, params: 2, frame: 15 const binding = env4_19; binding.log('Broadcast thumbnail of size:', a0.length); env4_24((StreamKeyUtilsModule).encodeStreamKey(env1_0), a0); } } } function _fun38278() { // fn#38278, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4669:2707, offset: 0x010bb949, size: 86 bytes, params: 1, frame: 12 const value = environment.__proto__.__proto__; env2_19.log('Broadcast Finished'); env2_21.stop(); env2_22.stop(); (UseScreenshareUtilsModule).handleCloseScreenshare(); } function _fun38279(a0) { // fn#38279, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4669:2828, offset: 0x010bb99f, size: 101 bytes, params: 2, frame: 15 var value2; let binding = env2_19; binding.log('Broadcast Annotated:', a0); if (a0 !== IOS_BUNDLE_ID) { binding = env2_23; value2 = binding.indexOf(a0, 0); if (value2 > -1) { env2_23.splice(value2, 1); } binding = env2_23; binding.push(a0); } } function _fun38280() { // fn#38280, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4669:2960, offset: 0x010bba04, size: 119 bytes, params: 1, frame: 17 env2_19.log('Broadcast Blocked'); const defaultImport = PushNotification; const presentLocalNotification = defaultImport.presentLocalNotification; const object = {}; const intl = (require(1244) /* metro dependency 1244: indexNative */).intl; object.alertBody = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.iYQlwv); Reflect.apply(presentLocalNotification, defaultImport, [object]); } } function value_38281() { // fn#38281, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4669:3164, offset: 0x010bba7b, size: 176 bytes, params: 1, frame: 15 const voiceEngine = (InjectModule).getVoiceEngine(); if (voiceEngine != null) { voiceEngine.setBroadcastRequestCallback(NOOP_NULL); voiceEngine.setBroadcastFinishedCallback(NOOP_NULL); voiceEngine.setBroadcastAnnotatedCallback(NOOP_NULL); voiceEngine.setBroadcastBlockedCallback(NOOP_NULL); } let binding = env1_21; binding.stop(); env1_22.stop(); const defaultImport = Dispatcher; const unsubscribe = defaultImport.unsubscribe; binding = env1_8; const binding2 = env1_26; Reflect.apply(unsubscribe, defaultImport, ['VOICE_CHANNEL_SELECT', binding(this, binding2)[binding2]]); } function value_38282() { // fn#38282, offset: 0x00df3ac4, size: 9 bytes, params: 1, frame: 1 return env1_23; } } } global.__d(_fun38261, 4491, [6, 7, 15, 17, 18, 99, 100, 5, 27, 4492, 1379, 1934, 661, 4237, 3, 4041, 3829, 694, 507, 4285, 8913, 4261, 44, 7712, 1478, 10794, 10741, 1244, 4561, 2]) /* metro module 4491, dependencies: [6, 7, 15, 17, 18, 99, 100, 5, 27, 4492, 1379, 1934, 661, 4237, 3, 4041, 3829, 694, 507, 4285, 8913, 4261, 44, 7712, 1478, 10794, 10741, 1244, 4561, 2] */;