Files
discord-decomp/sources/modules/chat/native/NativeExperimentBridgeManager.tsx
T
2026-07-27 16:20:00 +03:00

160 lines
7.8 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] */
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});
const env0_3 = importDefault(7) /* metro dependency 7 */;
const env0_4 = importDefault(6) /* metro dependency 6 */;
const env0_5 = importDefault(15) /* metro dependency 15 */;
const env0_6 = importDefault(17) /* metro dependency 17 */;
const env0_7 = importDefault(18) /* metro dependency 18 */;
const env0_8 = (require(27) /* metro dependency 27 */).NativeModules;
const localeStore = importDefault(1949) /* metro dependency 1949: LocaleStore */;
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
let value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
value = _fun124892(value);
value = new value();
(require(2) /* metro dependency 2 */).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 = importDefault(16157) /* metro dependency 16157: 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 object2;
const object4 = {};
var value;
const defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
const getSuperPropertiesBase64 = defaultImport.getSuperPropertiesBase64;
object4['X-Super-Properties'] = Reflect.apply(getSuperPropertiesBase64, defaultImport, []);
const getFingerprint = AuthenticationStore.getFingerprint;
object4['X-Fingerprint'] = Reflect.apply(getFingerprint, AuthenticationStore, []);
const getInstallationForTracking = AuthenticationStore.getInstallationForTracking;
object4['X-Installation-ID'] = Reflect.apply(getInstallationForTracking, AuthenticationStore, []);
object4['X-Discord-Locale'] = LocaleStore.locale;
const {enabled, limit, cooldownMs,
debounceMs} = (importDefault(16158) /* metro dependency 16158: NotificationLoadMessagesExperiment */).getConfig({location: 'NativeExperimentBridgeManager'});
const NativeCacheModule = NativeModules.NativeCacheModule;
if (NativeCacheModule != null) {
setItem = NativeCacheModule.setItem;
JSON = global.JSON;
stringify = JSON.stringify;
object2 = {headers: object4};
object2.userId = AuthenticationStore.getId();
object2.enabled = enabled;
value = require(507) /* metro dependency 507: HTTPUtils */;
object2.apiBaseUrl = value.getAPIBaseURL();
object2.urlQueryParams = '?limit=' + limit;
object2.cooldownMs = cooldownMs;
object2.debounceMs = debounceMs;
value = Reflect.apply(stringify, JSON, [object2]);
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 closure = NativeExperimentBridgeManager;
env0_7(closure, a0);
return env0_3(closure);
}
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 items = [];
arraySpread(items, value, 0, items);
value = env1_6(NativeExperimentBridgeManager);
binding = env1_5;
if (_isNativeReflectConstruct_124887()) {
Reflect = global.Reflect;
value = Reflect.construct(value, items, env1_6(this).constructor);
r0 = value;
} else {
value = value.apply(this, items);
r0 = value;
}
value = binding(this, r0);
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
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;
}