/* Metro module 15666; source: modules/voice_calls/VoicePermissionManager.tsx; dependencies: [6, 7, 15, 17, 18, 4811, 4298, 1226, 1379, 4259, 4294, 661, 4661, 4662, 15667, 4802, 4860, 2] */ 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 AuthenticationStore from '../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */ import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */ import MediaEngineStore from '../../stores/MediaEngineStore.tsx'; /* Metro dependency 4259 */ import RTCConnectionStore from '../../stores/RTCConnectionStore.tsx'; /* Metro dependency 4294 */ import VoiceStateRecord from '../../records/VoiceStateRecord.tsx'; /* Metro dependency 4298 */ import NativePermissionUtils from '../native_permissions/NativePermissionUtils.tsx'; /* Metro dependency 4662 */ import StageChannelRoleStore from '../stage_channels/StageChannelRoleStore.tsx'; /* Metro dependency 4811 */ import AutomaticLifecycleManager from '../../lib/AutomaticLifecycleManager.tsx'; /* Metro dependency 4860 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */ import * as NativePermissionConstantsModule from '../native_permissions/NativePermissionConstants.tsx'; /* Metro dependency 4661 */ function _fun120113(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#120113, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15874:6, offset: 0x025213d0, size: 404 bytes, params: 8, frame: 20 const env0_0 = require; const shouldImmediatelyRequestVoicePermissions2 = shouldImmediatelyRequestVoicePermissions; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = AutomaticLifecycleManager; value = _fun120120(value); value = new value(); (FileImportTrackerModule).fileFinishedImporting('modules/voice_calls/VoicePermissionManager.tsx'); exports.default = value; exports.shouldImmediatelyRequestVoicePermissions = shouldImmediatelyRequestVoicePermissions2; function _isNativeReflectConstruct_120114() { // fn#120114, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15874:264, offset: 0x02521564, size: 98 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_120114_isNativeReflectConstruct = function() { return !!result; })(); } function voicePermissionRequest() { // fn#120117, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15874:468, offset: 0x025215c6, size: 133 bytes, params: 1, frame: 14 var defaultImport2; const defaultImport = NativePermissionUtils; const requestPermission = defaultImport.requestPermission; const AUDIO = NativePermissionTypes.AUDIO; Reflect.apply(requestPermission, defaultImport, [AUDIO]).then(_fun120118); const mode = MediaEngineStore.getMode(); const PUSH_TO_TALK = InputModes.PUSH_TO_TALK; if (mode === PUSH_TO_TALK) { defaultImport2 = defaultImport; defaultImport2.requestPermission(NativePermissionTypes.INPUT_MONITORING); } function _fun120118(a0) { // fn#120118, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15874:544, offset: 0x0252164b, size: 42 bytes, params: 2, frame: 11 var value; if (a0) { value = environment.__proto__; value = importDefault(15667) /* metro dependency 15667: setAudioInputEnabledAndroid */; value(true); } } } function shouldImmediatelyRequestVoicePermissions(a0, a1) { // fn#120119, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15874:644, offset: 0x02521675, size: 70 bytes, params: 3, frame: 14 let r0 = ChannelStore.getChannel(a1)?.isListenModeCapable(); r0 = r0 ? StageChannelRoleStore.isSpeaker(a0, a1) : !r0; return r0; } function _fun120120(a0) { // fn#120120, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15874:799, offset: 0x025216bb, size: 97 bytes, params: 2, frame: 16 const VoicePermissionManager2 = VoicePermissionManager; Inherits(VoicePermissionManager2, a0); return CreateClass(VoicePermissionManager2, [{key: 'handleVoiceChannelSelect', value: value_120122}, {key: 'handleVoiceStateUpdates', value: function({voiceStates}) { voiceStates.forEach(_fun120124); }}]); function VoicePermissionManager(a0) { // fn#120121, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15874:811, offset: 0x0252171c, size: 156 bytes, params: 2, frame: 19 var r0; var Reflect; let value = copyRestArgs(0, undefined); let binding = env1_3; binding(this, VoicePermissionManager); const items2 = []; arraySpread(items2, value, 0, items2); value = env1_6(VoicePermissionManager); binding = env1_5; if (_isNativeReflectConstruct_120114()) { 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); value.actions = {VOICE_STATE_UPDATES: value.handleVoiceStateUpdates, VOICE_CHANNEL_SELECT: value.handleVoiceChannelSelect}; return value; } function value_120122({channelId}) { // fn#120122, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15874:1270, offset: 0x025217b8, size: 25 bytes, params: 2, frame: 2 var value; if (channelId == null) { value = environment.__proto__; } } function value_120123({voiceStates}) { // fn#120123, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15874:1351, offset: 0x025217d1, size: 32 bytes, params: 2, frame: 11 voiceStates.forEach(_fun120124); function _fun120124(a0) { // fn#120124, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15874:1388, offset: 0x025217f1, size: 200 bytes, params: 2, frame: 18 const userId = a0.userId; const channelId = a0.channelId; if (channelId != null) { var authenticationStoreBinding = AuthenticationStore; var getId = authenticationStoreBinding.getId; if (Reflect.apply(getId, authenticationStoreBinding, []) !== userId) { return undefined; } var rtcConnectionStoreBinding = RTCConnectionStore; var getRTCConnectionId = rtcConnectionStoreBinding.getRTCConnectionId; if (Reflect.apply(getRTCConnectionId, rtcConnectionStoreBinding, []) == null) { return undefined; } if (env2_16 === channelId) { return undefined; } if (shouldImmediatelyRequestVoicePermissions(userId, channelId)) { voicePermissionRequest(); return undefined; } var voiceStateRecordBinding = VoiceStateRecord; var value2 = Object.create(voiceStateRecordBinding.prototype, {constructor: {value: voiceStateRecordBinding}}); var voiceStateRecord2 = new voiceStateRecordBinding(a0); var audienceRequestToSpeakState = (require(4802) /* metro dependency 4802: useAudienceRequestToSpeakState */).getAudienceRequestToSpeakState(voiceStateRecord2 instanceof Object ? voiceStateRecord2 : value2); var RequestToSpeakStates = (require(4802) /* metro dependency 4802: useAudienceRequestToSpeakState */).RequestToSpeakStates; var REQUESTED_TO_SPEAK_AND_AWAITING_USER_ACK = RequestToSpeakStates.REQUESTED_TO_SPEAK_AND_AWAITING_USER_ACK; if (audienceRequestToSpeakState === REQUESTED_TO_SPEAK_AND_AWAITING_USER_ACK) { voicePermissionRequest(); } } } } } } global.__d(_fun120113, 15666, [6, 7, 15, 17, 18, 4811, 4298, 1226, 1379, 4259, 4294, 661, 4661, 4662, 15667, 4802, 4860, 2]) /* metro module 15666, dependencies: [6, 7, 15, 17, 18, 4811, 4298, 1226, 1379, 4259, 4294, 661, 4661, 4662, 15667, 4802, 4860, 2] */;