/* Metro module 7709; source: utils/native/PrivateChannelCallUtils.tsx; dependencies: [5, 31, 3849, 7710, 1379, 3793, 1934, 1878, 661, 1229, 4661, 33, 5072, 7712, 7713, 1239, 5080, 7714, 1962, 5459, 5075, 4080, 12084, 4796, 4496, 1244, 4662, 4015, 12120, 4497, 8916, 4007, 8114, 2] */ function _fun61571(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#61571, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:6, offset: 0x01b4599f, size: 554 bytes, params: 8, frame: 26 const env0_0 = require; const closure = function(a0) { return getVoiceChannelKeyByChannelId(a0); }; const closure2 = openChannelCallModal; const closure3 = dismissVoiceChannelScreens; const closure4 = function() { var Promise = global.Promise; var value = Object.create(Promise.prototype, {constructor: {value: Promise}}); var value2 = new Promise(_fun61576); return value2 instanceof Object ? value2 : value; }; const closure5 = showGuardCallAlert; const closure6 = guardPrivateCallForChannel; const closure7 = function(a0, a1) { if (!require(dependencyMap[31]).isModalOpen(getVoiceChannelKey(a0.id))) { openChannelCallModal(a0); } }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = importDefault(5) /* metro dependency 5 */; const env0_4 = importAll(31) /* metro dependency 31 */; const actionSheetStore = importDefault(3849) /* metro dependency 3849: ActionSheetStore */; const voicePanelStore = importDefault(7710) /* metro dependency 7710: VoicePanelStore */; const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */; const relationshipStore = importDefault(3793) /* metro dependency 3793: RelationshipStore */; const selectedChannelStore = importDefault(1934) /* metro dependency 1934: SelectedChannelStore */; const userStore = importDefault(1878) /* metro dependency 1878: UserStore */; const constantsModule = require(661) /* metro dependency 661: Constants */; const env0_11 = constantsModule.ChannelTypes; const env0_12 = constantsModule.ComponentActions; const env0_13 = constantsModule.NOOP; const env0_14 = (require(1229) /* metro dependency 1229: AgeGateConstants */).AgeGateSource; const env0_15 = (require(4661) /* metro dependency 4661: NativePermissionConstants */).NativePermissionTypes; const env0_16 = (require(33) /* metro dependency 33 */).jsx; const closure8 = function(a0) { return '' + 'voice-channel' + '-' + a0; }; (require(2) /* metro dependency 2 */).fileFinishedImporting('utils/native/PrivateChannelCallUtils.tsx'); exports.getVoiceChannelKeyByChannelId = closure8; exports.getVoiceChannelKey = closure; exports.isVoiceChannelModalKey = function(a0) { return a0.startsWith('voice-channel'); }; exports.openChannelCallModal = closure2; exports.maybeShowAgeGateModal = maybeShowAgeGateModal; exports.openVoiceChannelActionSheet = openVoiceChannelActionSheet; exports.hideVoiceChannelActionSheet = function(a0) { importDefault(dependencyMap[21]).hideActionSheet(getVoiceChannelKey(a0.id)); }; exports.dismissVoiceChannelScreens = closure3; exports.monkeyPatchCall = closure4; exports.showGuardCallAlert = closure5; exports.guardPrivateCallForChannel = closure6; exports.handleJoinCall = handleJoinCall; exports.handleStartCall = handleStartCall; exports.handleRedesignGroupDMCall = handleRedesignGroupDMCall; exports.handleRedesignJoinCall = handleRedesignJoinCall; exports.openGuildVoiceModal = closure7; exports.navigateToVoiceChannel = function(a0, a1) { if (a0.isPrivate()) { openChannelCallModal(a0); } else if (a0.isGuildStageVoice()) { require(dependencyMap[32]).openStageChannel(a0); } else { openGuildVoiceModal(a0); } }; } function openChannelCallModal(a0) { // fn#61573, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:439, offset: 0x01b45bdc, size: 289 bytes, params: 2, frame: 19 var moduleValue2; var defaultImport2; var state; var openChannel; var ComponentDispatch; var dispatch; var VOICE_PANEL_OPEN; const moduleValue = require(dependencyMap[12]); const maybeOpenAgeGateForVoiceChannel = moduleValue.maybeOpenAgeGateForVoiceChannel; let id = a0.id; if (!Reflect.apply(maybeOpenAgeGateForVoiceChannel, moduleValue, [id])) { importDefault(dependencyMap[13]).rebuildRTCActiveChannels(); moduleValue2 = require(dependencyMap[14]); if (moduleValue2.isVoicePanelEnabled(a0)) { state = VoicePanelStore.getState(); openChannel = state.openChannel; id = a0.id; Reflect.apply(openChannel, state, [id]); ComponentDispatch = require(dependencyMap[15]).ComponentDispatch; dispatch = ComponentDispatch.dispatch; VOICE_PANEL_OPEN = ComponentActions.VOICE_PANEL_OPEN; id = a0.id; Reflect.apply(dispatch, ComponentDispatch, [VOICE_PANEL_OPEN, {channelId: id}]); } else { defaultImport2 = importDefault(dependencyMap[16]); defaultImport2.pushLazy(require(dependencyMap[18])(dependencyMap[17], dependencyMap.paths), {channel: a0}, getVoiceChannelKey(a0.id)); } } } function dismissVoiceChannelScreens({id}, a1) { // fn#61574, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:776, offset: 0x01b45cfd, size: 107 bytes, params: 3, frame: 15 const voiceChannelKey = getVoiceChannelKey(id); (importDefault(5080) /* metro dependency 5080: ModalActionCreators */).popWithKey(voiceChannelKey, a1); const getKey = ActionSheetStore.getKey; if (Reflect.apply(getKey, ActionSheetStore, []) === voiceChannelKey) { (importDefault(4080) /* metro dependency 4080: ActionSheetActionCreators */).hideActionSheet(); } } function monkeyPatchCall() { // fn#61575, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:916, offset: 0x01b45d68, size: 37 bytes, params: 1, frame: 11 const Promise = global.Promise; const value = Object.create(Promise.prototype, {constructor: {value: Promise}}); const promise = new Promise(_fun61576); return promise instanceof Object ? promise : value; } function showGuardCallAlert(a0) { // fn#61577, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:1107, offset: 0x01b45df7, size: 224 bytes, params: 2, frame: 20 const env0_0 = a0; const defaultImport = importDefault(4496) /* metro dependency 4496: AlertActionCreators */; const show = defaultImport.show; const object2 = {}; const intl = (require(1244) /* metro dependency 1244: indexNative */).intl; const string = intl.string; const t = (require(1244) /* metro dependency 1244: indexNative */).t; object2.title = Reflect.apply(string, intl, [t['91WuJ9']]); object2.body = intl.string(t['Rs+Vk1']); object2.cancelText = intl.string(t['ETE/oC']); object2.onConfirm = onConfirm; object2.onCancel = NOOP; Reflect.apply(show, defaultImport, [object2]); } function guardPrivateCallForChannel(a0, a1) { // fn#61579, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:1335, offset: 0x01b45ed7, size: 123 bytes, params: 3, frame: 16 const env0_0 = a1; const channel = ChannelStore.getChannel(SelectedChannelStore.getVoiceChannelId()); if (channel == null) { a1(); } else if (channel.type === ChannelTypes.GUILD_VOICE) { a1(); } else if (a0 == null) { a1(); } else if (a0.id !== channel.id) { showGuardCallAlert(env0_3(_fun61581)); } else { a1(); } } function maybeShowAgeGateModal(a0) { // fn#61585, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:1989, offset: 0x01b4600d, size: 86 bytes, params: 2, frame: 14 const ageGateUtilsModule = require(5072) /* metro dependency 5072: AgeGateUtils */; if (ageGateUtilsModule.shouldShowAgeGateForChannelId(a0)) { (require(5459) /* metro dependency 5459: RunAfterInteractionsUtils */).runAfterInteractions(function() { require(dependencyMap[20]).openAgeGateModal(AgeGateSource.NSFW_VOICE_CHANNEL); }, 150); } } function openVoiceChannelActionSheet(a0) { // fn#61587, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:2188, offset: 0x01b46093, size: 97 bytes, params: 2, frame: 18 const defaultImport = importDefault(dependencyMap[21]); defaultImport.openLazy(require(dependencyMap[18])(dependencyMap[22], dependencyMap.paths), getVoiceChannelKey(a0.id), {channel: a0}); } function handleJoinCall(a0) { // fn#61589, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:2634, offset: 0x01b4612b, size: 53 bytes, params: 2, frame: 14 const value = a1; const env0_0 = a0; const env0_1 = value !== undefined ? value : false; guardPrivateCallForChannel(a0, function() { return _onConfirm.apply(this, arguments); }); } function handleStartCall(a0) { // fn#61594, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:2982, offset: 0x01b46243, size: 66 bytes, params: 2, frame: 14 const value = a1; const env0_0 = a0; const env0_1 = value !== undefined ? value : false; if (!guardAgainstCallingProvisionalAccount(a0)) { guardPrivateCallForChannel(a0, function() { return _onConfirm2.apply(this, arguments); }); } } function handleRedesignGroupDMCall(a0) { // fn#61601, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:3689, offset: 0x01b46493, size: 53 bytes, params: 2, frame: 14 const value = a1; const env0_0 = a0; const env0_1 = value !== undefined ? value : false; guardPrivateCallForChannel(a0, function() { return _onConfirm3.apply(this, arguments); }); } function handleRedesignJoinCall(a0) { // fn#61606, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:4047, offset: 0x01b465ad, size: 53 bytes, params: 2, frame: 14 const value = a1; const env0_0 = a0; const env0_1 = value !== undefined ? value : false; guardPrivateCallForChannel(a0, function() { return _onConfirm4.apply(this, arguments); }); } function _fun61576(a0) { // fn#61576, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:963, offset: 0x01b45d8d, size: 106 bytes, params: 2, frame: 14 const value = environment.__proto__; const channel = ChannelStore.getChannel(SelectedChannelStore.getVoiceChannelId()); if (channel != null) { dismissVoiceChannelScreens(channel); } (importDefault(4796) /* metro dependency 4796: SelectedChannelActionCreators */).selectVoiceChannel(null); global.setTimeout(a0, 500); } function* _fun61581() { // fn#61581, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:1498, offset: 0x01b45f5b, size: 50 bytes, params: 1, frame: 11 if (true) { value = environment.__proto__.__proto__; yield env2_21(); if (false) { return undefined; } value = environment.__proto__; require(); } } function _onConfirm() { // fn#61590, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:2666, owner: handleJoinCall._onConfirm, offset: 0x01b46160, size: 51 bytes, params: 1, frame: 13 var environment; const value = environment.__proto__; return env1_3(_fun61592).apply(this, arguments); } function _onConfirm2() { // fn#61595, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:3015, owner: handleStartCall._onConfirm2, offset: 0x01b46285, size: 51 bytes, params: 1, frame: 13 var environment; const value = environment.__proto__; return env1_3(_fun61597).apply(this, arguments); } function guardAgainstCallingProvisionalAccount(a0) { // fn#61598, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:3307, owner: handleStartCall.guardAgainstCallingProvisionalAccount, offset: 0x01b463d9, size: 141 bytes, params: 2, frame: 15 var environment; var value; var value2; if (a0.isDM()) { value = environment.__proto__; value2 = UserStore.getUser(a0.getRecipientId()); if (value2 == null) { return false; } if (value2.isProvisional) { (require(4497) /* metro dependency 4497: useAlertStoreNative */).openAlert('ProvisionalAccountNocallAllowed', ((Component) => )(env1_4.lazy(_fun61599))); return true; } } return false; } function _onConfirm3() { // fn#61602, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:3732, owner: handleRedesignGroupDMCall._onConfirm3, offset: 0x01b464c8, size: 51 bytes, params: 1, frame: 13 var environment; const value = environment.__proto__; return env1_3(_fun61604).apply(this, arguments); } function _onConfirm4() { // fn#61607, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:4087, owner: handleRedesignJoinCall._onConfirm4, offset: 0x01b465e2, size: 51 bytes, params: 1, frame: 13 var environment; const value = environment.__proto__; return env1_3(_fun61609).apply(this, arguments); } function* _fun61592() { // fn#61592, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:2709, offset: 0x01b4619c, size: 167 bytes, params: 1, frame: 17 var value3; var binding; var value4; var value5; var value7; var binding2; var value9; if (true) { value = environment.__proto__.__proto__; if (importDefault) { value3 = environment.__proto__.__proto__.__proto__; binding = env3_1; value4 = binding(env3_2[26]); yield value4.requestPermission(env3_15.CAMERA); value5 = undefined; if (false) { return value5; } if (value5) { value7 = environment.__proto__.__proto__.__proto__; binding = env3_0; binding2 = env3_2; binding(binding2[27]).dismissKeyboard(); binding = env3_1; value9 = binding(binding2[23]); value9.selectVoiceChannel(require.id, importDefault); return undefined; } } else { binding = env3_0; binding2 = env3_2; binding(binding2[27]).dismissKeyboard(); binding = env3_1; value9 = binding(binding2[23]); value9.selectVoiceChannel(require.id, importDefault); } } } function* _fun61597() { // fn#61597, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:3060, offset: 0x01b462c1, size: 280 bytes, params: 1, frame: 22 var r8; var r7; var value3; var binding; var value4; var value5; var value7; var value12; var call; var id; if (true) { value = environment.__proto__.__proto__; if (importDefault) { value3 = environment.__proto__.__proto__.__proto__; binding = env3_1; value4 = binding(env3_2[26]); yield value4.requestPermission(env3_15.CAMERA); value5 = undefined; if (false) { return value5; } if (value5) { value7 = environment.__proto__.__proto__.__proto__; binding = env3_0; binding(env3_2[27]).dismissKeyboard(); r8 = require.type !== env3_11.DM || env3_8.isFriend(require.getRecipientId()); r7 = r8 ? null : require.getRecipientId(); binding = env3_1; value12 = binding(env3_2[30]); call = value12.call; id = require.id; r8 = r8 && !require.isManaged(); Reflect.apply(call, value12, [id, importDefault, r8, r7]); return undefined; } } else { binding = env3_0; binding(env3_2[27]).dismissKeyboard(); r8 = require.type !== env3_11.DM || env3_8.isFriend(require.getRecipientId()); r7 = r8 ? null : require.getRecipientId(); binding = env3_1; value12 = binding(env3_2[30]); call = value12.call; id = require.id; r8 = r8 && !require.isManaged(); Reflect.apply(call, value12, [id, importDefault, r8, r7]); } } } function _fun61599() { // fn#61599, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:3448, offset: 0x01b46466, size: 45 bytes, params: 1, frame: 13 const value = environment.__proto__.__proto__; return require(dependencyMap[18])(dependencyMap[28], dependencyMap.paths); } function* _fun61604() { // fn#61604, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:3777, offset: 0x01b46504, size: 169 bytes, params: 1, frame: 18 var value3; var binding; var value4; var value5; var value7; var binding2; var value9; if (true) { value = environment.__proto__.__proto__; if (importDefault) { value3 = environment.__proto__.__proto__.__proto__; binding = env3_1; value4 = binding(env3_2[26]); yield value4.requestPermission(env3_15.CAMERA); value5 = undefined; if (false) { return value5; } if (value5) { value7 = environment.__proto__.__proto__.__proto__; binding = env3_0; binding2 = env3_2; binding(binding2[27]).dismissKeyboard(); binding = env3_1; value9 = binding(binding2[30]); value9.call(require.id, importDefault, true); return undefined; } } else { binding = env3_0; binding2 = env3_2; binding(binding2[27]).dismissKeyboard(); binding = env3_1; value9 = binding(binding2[30]); value9.call(require.id, importDefault, true); } } }