/* Metro module 10599; source: modules/request_to_stream/useCanFulfillStreamRequest.tsx; dependencies: [4266, 4492, 1226, 1379, 1867, 3784, 4396, 4294, 661, 10600, 477, 566, 2] */ import AuthenticationStore from '../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */ import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */ import GuildStore from '../../stores/GuildStore.tsx'; /* Metro dependency 1867 */ import PermissionStore from '../../stores/PermissionStore.tsx'; /* Metro dependency 3784 */ import RunningGameStoreNative from '../game_detection/RunningGameStore.native.tsx'; /* Metro dependency 4266 */ import RTCConnectionStore from '../../stores/RTCConnectionStore.tsx'; /* Metro dependency 4294 */ import PresenceStore from '../../stores/PresenceStore.tsx'; /* Metro dependency 4396 */ import ApplicationStreamingStore from '../../stores/ApplicationStreamingStore.tsx'; /* Metro dependency 4492 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */ import * as UseHasVideoPermissionModule from '../video_calls/useHasVideoPermission.tsx'; /* Metro dependency 10600 */ function _fun81714(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#81714, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10785:6, offset: 0x01edb3d8, size: 351 bytes, params: 8, frame: 20 const env0_0 = require; const canFulfillStreamRequest2 = canFulfillStreamRequest; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); (FileImportTrackerModule).fileFinishedImporting('modules/request_to_stream/useCanFulfillStreamRequest.tsx'); exports.default = useCanFulfillStreamRequest; exports.StreamRequestUnfulfillableReason = {NOT_IN_VOICE_CHANNEL: 'NOT_IN_VOICE_CHANNEL', NOT_RUNNING_GAME: 'NOT_RUNNING_GAME', ALREADY_STREAMING: 'ALREADY_STREAMING', NO_PERMISSION: 'NO_PERMISSION', PENDING_REQUEST: 'PENDING_REQUEST', EXPIRED: 'EXPIRED'}; exports.canFulfillStreamRequest = canFulfillStreamRequest2; function canFulfillStreamRequest(a0) { // fn#81715, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10785:470, offset: 0x01edb537, size: 517 bytes, params: 2, frame: 23 var environment; var items2; let value = a1; const value2 = a2; const value3 = a3; const value4 = a4; const value5 = a6; const value6 = undefined; let r0 = value !== value6 ? value : false; const r2 = value2 !== value6 ? value2 : ApplicationStreamingStore; const r5 = value3 !== value6 ? value3 : ChannelStore; const r10 = value4 !== value6 ? value4 : PresenceStore; const r1 = value5 !== value6 ? value5 : RTCConnectionStore; const getChannel = r5.getChannel; let channel_id = a0.channel_id; value = Reflect.apply(getChannel, r5, [channel_id]); if (value == null) { value = environment; return [false, env0_12.NOT_IN_VOICE_CHANNEL]; } const channelId = r1.getChannelId(); channel_id = a0.channel_id; const getCurrentUserActiveStream = r2.getCurrentUserActiveStream; const value8 = Reflect.apply(getCurrentUserActiveStream, r2, []) != null; const videoPermission = (UseHasVideoPermissionModule).getVideoPermission(value); const application = a0.application; const id = application == null ? value6 : application.id; let env0_2 = ActivityGamePlatforms.DESKTOP; env0_2 = (require(477) /* metro dependency 477: PlatformUtils */).isAndroid() ? ActivityGamePlatforms.ANDROID : ActivityGamePlatforms.IOS; if (id == null) { return [false, env0_12.NOT_RUNNING_GAME]; } value = r10.getActivities(AuthenticationStore.getId(), value.guild_id); value = value.some(_fun81716); if (value8) { r0 = [false, env0_12.ALREADY_STREAMING]; } else if (channelId === channel_id) { items2 = []; if (videoPermission) { if (value) { items2[0] = true; items2[1] = null; r0 = items2; } else { items2[0] = false; items2[1] = env0_12.NOT_RUNNING_GAME; r0 = items2; } } else { items2[0] = false; items2[1] = env0_12.NO_PERMISSION; r0 = items2; } } else { r0 = [false, env0_12.NOT_IN_VOICE_CHANNEL]; } return r0; function _fun81716(a0) { // fn#81716, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10785:908, offset: 0x01edb73c, size: 80 bytes, params: 2, frame: 5 const type = a0.type; const value = environment.__proto__; const PLAYING = ActivityTypes.PLAYING; return type === PLAYING && a0.application_id === id && (env0_0 ? a0.platform === DESKTOP : !env0_0); } } function useCanFulfillStreamRequest(a0) { // fn#81717, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10785:1200, offset: 0x01edb78c, size: 127 bytes, params: 2, frame: 15 const value = a1; const env0_0 = a0; const env0_1 = value !== undefined ? value : false; return (FluxModule).useStateFromStores([ApplicationStreamingStore, ChannelStore, PresenceStore, RunningGameStoreNative, RTCConnectionStore, GuildStore, PermissionStore], _fun81718); function _fun81718() { // fn#81718, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10785:1296, offset: 0x01edb80b, size: 54 bytes, params: 1, frame: 27 return canFulfillStreamRequest(env0_0, env0_1, ApplicationStreamingStore, ChannelStore, PresenceStore, RunningGameStoreNative, RTCConnectionStore, GuildStore, PermissionStore); } } } global.__d(_fun81714, 10599, [4266, 4492, 1226, 1379, 1867, 3784, 4396, 4294, 661, 10600, 477, 566, 2]) /* metro module 10599, dependencies: [4266, 4492, 1226, 1379, 1867, 3784, 4396, 4294, 661, 10600, 477, 566, 2] */;