Files
2026-07-28 01:06:53 +03:00

181 lines
10 KiB
TypeScript

/* Metro module 8912; source: utils/StreamQualityUtils.tsx; dependencies: [31, 4399, 1226, 1867, 4294, 1878, 661, 4282, 1880, 4291, 1244, 566, 683, 2] */
import AnalyticsUtils from './AnalyticsUtils.tsx'; /* Metro dependency 683 */
import AuthenticationStore from '../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */
import GuildStore from '../stores/GuildStore.tsx'; /* Metro dependency 1867 */
import UserStore from '../stores/UserStore.tsx'; /* Metro dependency 1878 */
import RTCConnectionStore from '../stores/RTCConnectionStore.tsx'; /* Metro dependency 4294 */
import ApplicationStreamingSettingsStore from '../stores/ApplicationStreamingSettingsStore.tsx'; /* Metro dependency 4399 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactModule from '../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as PremiumConstantsModule from '../modules/premium/PremiumConstants.tsx'; /* Metro dependency 1880 */
import * as StreamSettingsConstantsModule from '../modules/go_live/StreamSettingsConstants.tsx'; /* Metro dependency 4282 */
import * as ConstantsModule2 from '../external/discord_common/js/packages/media-engine/Constants.tsx'; /* Metro dependency 4291 */
function _fun69523(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#69523, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9097:6, offset: 0x01c75b26, size: 449 bytes, params: 8, frame: 22
let env0_0 = require;
const closure = function(a0) {
return a0.quality != null || a0.guildPremiumTier != null;
};
const closure2 = function(a0, a1, a2) {
var env0_0 = a0;
var env0_1 = a1;
var env0_2 = a2;
return ApplicationStreamSettingRequirements.find(_fun69526);
};
const closure3 = function(a0) {
var value = null;
return value == a0.maxResolution || value == a0.maxFrameRate ? value : {maxFrameRate: a0.maxFrameRate,
maxResolution: a0.maxResolution};
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('utils/StreamQualityUtils.tsx');
exports.isPremiumResolution = isPremiumResolution;
exports.isPremiumFPS = isPremiumFPS;
exports.isPremiumRequirement = closure;
exports.getPremiumRequirement = closure2;
exports.getResolutionText = getResolutionText;
exports.getFPSText = function(a0) {
var intl = require(dependencyMap[10]).intl;
var Qb44XH = require(dependencyMap[10]).t.Qb44XH;
return intl.formatToPlainString(Qb44XH, {fps: a0});
};
exports.getMaxQuality = closure3;
exports.useMaxQuality = useMaxQuality;
exports.trackStreamSettingsUpdate = trackStreamSettingsUpdate;
function getPremiumRequirement(a0, a1, a2) { // fn#69525, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9097:499, offset: 0x01c75d05, size: 50 bytes, params: 4, frame: 11
const env0_0 = a0;
const env0_1 = a1;
const env0_2 = a2;
return ApplicationStreamSettingRequirements.find(_fun69526);
function _fun69526(a0) { // fn#69526, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9097:552, offset: 0x01c75d37, size: 77 bytes, params: 2, frame: 4
return (a0.preset == null || a0.preset === env0_0) && a0.resolution === require && a0.fps === importDefault;
}
}
function isPremiumResolution(a0) { // fn#69528, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9097:845, offset: 0x01c75dc4, size: 141 bytes, params: 2, frame: 15
if (a0 != null) {
var env0_0 = getApplicationResolution(a0.maxResolution.type === ResolutionTypes.SOURCE ? ApplicationStreamResolutions.RESOLUTION_SOURCE : a0.maxResolution.height);
return getApplicationFramerate(a0.maxFrameRate) !== ApplicationStreamFPS.FPS_5 && ApplicationStreamSettingRequirements.find(_fun69529) == null;
}
function _fun69529(a0) { // fn#69529, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9097:1027, offset: 0x01c75e51, size: 68 bytes, params: 2, frame: 12
var r0;
var fps;
const resolution = a0.resolution;
let value = resolution === env0_0;
if (value) {
fps = a0.fps;
value = environment.__proto__;
value = fps !== ApplicationStreamFPS.FPS_5;
r0 = value;
} else {
r0 = value;
}
if (r0) {
value = environment.__proto__;
value = !isPremiumRequirement(a0);
r0 = value;
}
return r0;
}
}
function isPremiumFPS(a0) { // fn#69530, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9097:1109, offset: 0x01c75e95, size: 67 bytes, params: 2, frame: 14
if (a0 != null) {
var env0_0 = getApplicationFramerate(a0.maxFrameRate);
return ApplicationStreamSettingRequirements.find(_fun69531) == null;
}
function _fun69531(a0) { // fn#69531, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9097:1191, offset: 0x01c75ed8, size: 42 bytes, params: 2, frame: 12
var r0;
const fps = a0.fps;
let value = fps === env0_0;
if (value) {
value = environment.__proto__;
value = !isPremiumRequirement(a0);
r0 = value;
} else {
r0 = value;
}
return r0;
}
}
function getResolutionText(a0) { // fn#69532, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9097:1344, offset: 0x01c75f02, size: 156 bytes, params: 2, frame: 17
const intl = (IndexNativeModule).intl;
const t = (IndexNativeModule).t;
const type = a0.type;
const SOURCE = ResolutionTypes.SOURCE;
return type === SOURCE ? intl.string(t.XjXqzh) : intl.formatToPlainString(t.TEOC0I, {resolution: a0.height});
}
function useMaxQuality(a0) { // fn#69534, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9097:1672, offset: 0x01c75fe9, size: 152 bytes, params: 2, frame: 20
const env0_0 = a0;
return ReactModule.useMemo(_fun69537,
[(require(566) /* metro dependency 566: flux */).useStateFromStores([AuthenticationStore], function() {
return AuthenticationStore.getId();
}), a0,
(require(566) /* metro dependency 566: flux */).useStateFromStoresObject([ApplicationStreamingSettingsStore],
function() {
return ApplicationStreamingSettingsStore.getState();
})]);
function _fun69537() { // fn#69537, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9097:1833, offset: 0x01c760a7, size: 132 bytes, params: 1, frame: 14
var r0;
var value2;
var object;
var binding;
var object2;
var resolution;
const idBinding = id;
const user = env0_0.user;
if (idBinding === user.id) {
object = {};
binding = env0_1;
object.maxFrameRate = binding.fps;
object2 = {};
resolution = binding.resolution;
object2.height = resolution;
object2.width = 0;
resolution = binding.resolution;
object2.type = resolution === 0 ? ResolutionTypes.SOURCE : ResolutionTypes.FIXED;
object.maxResolution = object2;
r0 = object;
} else {
value2 = environment.__proto__;
r0 = getMaxQuality(env0_0);
}
return r0;
}
}
function trackStreamSettingsUpdate(a0, a1, a2, a3) { // fn#69538, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9097:2011, offset: 0x01c7612b, size: 263 bytes, params: 5, frame: 25
const getPremiumRequirementBinding = getPremiumRequirement;
const value2 = undefined;
const premiumRequirementBinding = getPremiumRequirementBinding(a0, a1, a2);
const currentUser = UserStore.getCurrentUser();
const guildId = RTCConnectionStore.getGuildId();
const value6 = null;
const r12 = value6 != guildId ? GuildStore.getGuild(guildId) : value6;
const defaultImport = AnalyticsUtils;
const track = defaultImport.track;
const STREAM_SETTINGS_UPDATE = AnalyticEvents.STREAM_SETTINGS_UPDATE;
Reflect.apply(track, defaultImport, [STREAM_SETTINGS_UPDATE,
{user_premium_tier: value6 == currentUser ? value2 : currentUser.premiumType,
guild_premium_tier: value6 == r12 ? value2 : r12.premiumTier,
stream_quality_user_premium_tier: value6 != (value6 == premiumRequirementBinding ? value2 : premiumRequirementBinding.quality) ? StreamQualitiesToPremiumType[premiumRequirementBinding.quality] : value6,
stream_quality_guild_premium_tier: value6 == premiumRequirementBinding ? value2 : premiumRequirementBinding.guildPremiumTier,
stream_quality_preset: a0, stream_quality_resolution: a1, stream_quality_frame_rate: a2,
soundshare_enabled: a3}]);
return value2;
}
}
global.__d(_fun69523, 8912, [31, 4399, 1226, 1867, 4294, 1878, 661, 4282, 1880, 4291, 1244, 566, 683,
2]) /* metro module 8912, dependencies: [31, 4399, 1226, 1867, 4294, 1878, 661, 4282, 1880, 4291, 1244, 566, 683, 2] */;