Files
discord-decomp/sources/modules/chat/native/NativeExperimentBridgeManager.tsx
2026-07-28 01:06:53 +03:00

170 lines
9.5 KiB
TypeScript

/* Metro module 16155; source: modules/chat/native/NativeExperimentBridgeManager.tsx; dependencies: [7, 6, 15, 17, 18, 27, 1949, 1226, 4819, 16156, 16157, 683, 16158, 507, 477, 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 AnalyticsUtils from '../../../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */
import AuthenticationStore from '../../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */
import LocaleStore from '../../user_settings/LocaleStore.tsx'; /* Metro dependency 1949 */
import AutomaticLifecycleManager from '../../../lib/AutomaticLifecycleManager.tsx'; /* Metro dependency 4860 */
import VideoStutterMitigationExperiment from '../../media_engine/VideoStutterMitigationExperiment.tsx'; /* Metro dependency 16157 */
import NotificationLoadMessagesExperiment from '../../cache/NotificationLoadMessagesExperiment.tsx'; /* Metro dependency 16158 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as PlatformUtilsModule from '../../../utils/PlatformUtils.tsx'; /* Metro dependency 477 */
function _fun124886(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#124886, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16363:6, offset: 0x025c65a1, size: 306 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = AutomaticLifecycleManager;
value = _fun124892(value);
value = new value();
(FileImportTrackerModule).fileFinishedImporting('modules/chat/native/NativeExperimentBridgeManager.tsx');
exports.default = value;
function _isNativeReflectConstruct_124887() { // fn#124887, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16363:192, offset: 0x025c66d3, 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_124887_isNativeReflectConstruct = function() {
return !!result;
})();
}
function updateIOSExperiments() { // fn#124890, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16363:385, offset: 0x025c6735, size: 277 bytes, params: 1, frame: 16
var setShouldFixPushNotificationRawPayload;
var moduleValue;
var setShouldEnableYYTextReplacement;
var moduleValue2;
var RNVVideo;
let NSUserDefaultsBridge = NativeModules.NSUserDefaultsBridge;
if (!(NSUserDefaultsBridge == null || NSUserDefaultsBridge.setShouldFixPushNotificationRawPayload == null)) {
setShouldFixPushNotificationRawPayload = NSUserDefaultsBridge.setShouldFixPushNotificationRawPayload;
moduleValue = require(4819) /* metro dependency 4819: IOSPushNotificationRawPayloadFixExperiment */;
Reflect.apply(setShouldFixPushNotificationRawPayload, NSUserDefaultsBridge,
[moduleValue.isIOSPushNotificationRawPayloadFixExperimentEnabled()]);
}
NSUserDefaultsBridge = NativeModules.NSUserDefaultsBridge;
if (!(NSUserDefaultsBridge == null || NSUserDefaultsBridge.setShouldEnableYYTextReplacement == null)) {
setShouldEnableYYTextReplacement = NSUserDefaultsBridge.setShouldEnableYYTextReplacement;
moduleValue2 = require(16156) /* metro dependency 16156: YYTextReplacementExperiment */;
Reflect.apply(setShouldEnableYYTextReplacement, NSUserDefaultsBridge,
[moduleValue2.shouldEnableYYTextReplacement({location: 'NativeExperimentBridgeManager'})]);
}
const defaultImport = VideoStutterMitigationExperiment;
const getConfig = defaultImport.getConfig;
if (Reflect.apply(getConfig, defaultImport, [{location: 'NativeExperimentBridgeManager'}]).enabled) {
RNVVideo = NativeModules.RNVVideo;
if (RNVVideo != null) {
RNVVideo.setOptimizeConfigureAudio(true);
}
RNVVideo = NativeModules.RNVVideo;
if (RNVVideo != null) {
RNVVideo.setUseBackgroundProgressQueue(true);
}
}
}
function updateAndroidExperiments() { // fn#124891, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16363:997, offset: 0x025c684a, size: 317 bytes, params: 1, frame: 23
var setItem;
var JSON;
var stringify;
var object;
const object3 = {};
var value;
const defaultImport = AnalyticsUtils;
const getSuperPropertiesBase64 = defaultImport.getSuperPropertiesBase64;
object3['X-Super-Properties'] = Reflect.apply(getSuperPropertiesBase64, defaultImport, []);
let authenticationStoreBinding = AuthenticationStore;
const getFingerprint = authenticationStoreBinding.getFingerprint;
object3['X-Fingerprint'] = Reflect.apply(getFingerprint, authenticationStoreBinding, []);
authenticationStoreBinding = AuthenticationStore;
const getInstallationForTracking = authenticationStoreBinding.getInstallationForTracking;
object3['X-Installation-ID'] = Reflect.apply(getInstallationForTracking, authenticationStoreBinding, []);
object3['X-Discord-Locale'] = LocaleStore.locale;
const {enabled, limit, cooldownMs,
debounceMs} = (NotificationLoadMessagesExperiment).getConfig({location: 'NativeExperimentBridgeManager'});
const NativeCacheModule = NativeModules.NativeCacheModule;
if (NativeCacheModule != null) {
setItem = NativeCacheModule.setItem;
JSON = global.JSON;
stringify = JSON.stringify;
object = {headers: object3};
object.userId = AuthenticationStore.getId();
object.enabled = enabled;
value = require(507) /* metro dependency 507: HTTPUtils */;
object.apiBaseUrl = value.getAPIBaseURL();
object.urlQueryParams = '?limit=' + limit;
object.cooldownMs = cooldownMs;
object.debounceMs = debounceMs;
value = Reflect.apply(stringify, JSON, [object]);
Reflect.apply(setItem, NativeCacheModule, ['notificationNetworkRequest', value]);
}
}
function _fun124892(a0) { // fn#124892, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16363:1602, offset: 0x025c6987, size: 42 bytes, params: 2, frame: 14
const NativeExperimentBridgeManager2 = NativeExperimentBridgeManager;
Inherits(NativeExperimentBridgeManager2, a0);
return CreateClass(NativeExperimentBridgeManager2);
function NativeExperimentBridgeManager(a0) { // fn#124893, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16363:1614, offset: 0x025c69b1, size: 235 bytes, params: 2, frame: 20
var r0;
var r1;
var Reflect;
var moduleValue2;
let value = copyRestArgs(0, undefined);
let binding = env1_4;
binding(this, NativeExperimentBridgeManager);
const items2 = [];
arraySpread(items2, value, 0, items2);
value = env1_6(NativeExperimentBridgeManager);
binding = env1_5;
if (_isNativeReflectConstruct_124887()) {
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);
if (PlatformUtilsModule.isIOS()) {
r1 = updateIOSExperiments;
} else {
moduleValue2 = PlatformUtilsModule;
r1 = moduleValue2.isAndroid() ? updateAndroidExperiments : function() {
};
}
value.handleUpdate = r1;
value.actions = {POST_CONNECTION_OPEN: value.handleUpdate};
return value;
}
}
}
global.__d(_fun124886, 16155, [7, 6, 15, 17, 18, 27, 1949, 1226, 4819, 16156, 16157, 683, 16158, 507, 477, 4860,
2]) /* metro module 16155, dependencies: [7, 6, 15, 17, 18, 27, 1949, 1226, 4819, 16156, 16157, 683, 16158, 507, 477, 4860, 2] */;