106 lines
5.8 KiB
TypeScript
106 lines
5.8 KiB
TypeScript
/* Metro module 10599; source: modules/request_to_stream/useCanFulfillStreamRequest.tsx; dependencies: [4266, 4492, 1226, 1379, 1867, 3784, 4396, 4294, 661, 10600, 477, 566, 2] */
|
|
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 closure = canFulfillStreamRequest;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const runningGameStoreNative = importDefault(4266) /* metro dependency 4266: RunningGameStoreNative */;
|
|
const applicationStreamingStore = importDefault(4492) /* metro dependency 4492: ApplicationStreamingStore */;
|
|
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
|
|
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
|
|
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
|
|
const permissionStore = importDefault(3784) /* metro dependency 3784: PermissionStore */;
|
|
const presenceStore = importDefault(4396) /* metro dependency 4396: PresenceStore */;
|
|
const rtcConnectionStore = importDefault(4294) /* metro dependency 4294: RTCConnectionStore */;
|
|
const constantsModule = require(661) /* metro dependency 661: Constants */;
|
|
const env0_10 = constantsModule.ActivityGamePlatforms;
|
|
const env0_11 = constantsModule.ActivityTypes;
|
|
(require(2) /* metro dependency 2 */).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 = closure;
|
|
}
|
|
|
|
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 = (require(10600) /* metro dependency 10600: useHasVideoPermission */).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 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 (require(566) /* metro dependency 566: flux */).useStateFromStores([ApplicationStreamingStore, ChannelStore,
|
|
PresenceStore, RunningGameStoreNative, RTCConnectionStore, GuildStore, PermissionStore], _fun81718);
|
|
}
|
|
|
|
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 _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);
|
|
}
|
|
|