Files
discord-decomp/sources/lib/native/BundleUpdater.tsx
T
2026-07-28 01:06:53 +03:00

185 lines
11 KiB
TypeScript

/* Metro module 10560; source: lib/native/BundleUpdater.tsx; dependencies: [5, 6, 7, 27, 661, 3, 477, 90, 1962, 4242, 683, 4826, 2] */
import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */
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 AnalyticsUtils from '../../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */
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 ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
function _fun81412(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#81412, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10746:6, offset: 0x01ececf1, size: 297 bytes, params: 8, frame: 20
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactNativeModule;
const NativeModules = value.NativeModules;
const NativeEventEmitter = value.NativeEventEmitter;
value = importDefault(3) /* metro dependency 3: Logger */;
value = new value('BundleUpdater');
const BundleUpdaterManager = NativeModules.BundleUpdaterManager;
let nativeEventEmitter = new NativeEventEmitter(BundleUpdaterManager);
const env0_10 = {'downloaded': 'BundleDownloaded', 'otaUpdateChecked': 'OtaUpdateChecked'};
nativeEventEmitter = _fun81413();
(FileImportTrackerModule).fileFinishedImporting('lib/native/BundleUpdater.tsx');
exports.default = nativeEventEmitter;
function _fun81413() { // fn#81413, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10746:342, offset: 0x01ecee1a, size: 384 bytes, params: 1, frame: 18
const BundleUpdater2 = BundleUpdater;
const items2 = [{key: 'getInitialBundleDownloaded', value: function() {
return BundleUpdaterManager.getInitialBundleDownloaded();
}}];
items2[1] = {key: 'getInitialOtaUpdateChecked', value: function() {
return BundleUpdaterManager.getInitialOtaUpdateChecked();
}};
items2[2] = {key: 'addEventListener', value: value_81417};
items2[3] = {key: 'checkForUpdateAndReload', value: function() {
BundleUpdaterManager.checkForUpdateAndReload();
}};
items2[4] = {key: 'verifyOtaFiles', value: function() {
return BundleUpdaterManager.verifyOtaFiles();
}};
items2[5] = {key: 'getBuildOverrideCookieContents', value: function() {
return BundleUpdaterManager.getBuildOverrideCookieContents();
}};
items2[6] = {key: 'setBuildOverrideCookieHeader', value: function(a0) {
return BundleUpdaterManager.setBuildOverrideCookieHeader(a0);
}};
items2[7] = {key: 'getOtaRootPath', value: function() {
return BundleUpdaterManager.getOtaRootPath();
}};
items2[8] = {key: 'getOtaStatus', value: function() {
return BundleUpdaterManager.getOtaStatus();
}};
items2[9] = {key: 'getManifestInfo', value: function() {
return BundleUpdaterManager.getManifestInfo();
}};
let env0_0 = Module00005(_fun81426);
items2[10] = {key: 'setupOTAAssetFallback', value: value_81428};
items2[11] = {key: 'emitOtaMetric', value: value_81429};
items2[12] = {key: 'prepareOtaMetricForDatadog', value: function(a0) {
var value = a1;
var env0_0 = a0;
return {name: a0.type, tags: (value !== undefined ? value : []).map(_fun81433)};
}};
return CreateClass(BundleUpdater2, null, items2);
function BundleUpdater() { // fn#81414, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10746:353, offset: 0x01ecef9a, size: 27 bytes, params: 1, frame: 13
env1_4(this, BundleUpdater);
}
function value_81417(a0, a1) { // fn#81417, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10746:641, offset: 0x01ecefdb, size: 37 bytes, params: 3, frame: 13
env1_9.addListener(env1_10[a0], a1);
}
function* _fun81426() { // fn#81426, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10746:1268, offset: 0x01ecf096, size: 142 bytes, params: 1, frame: 15
var environment;
var binding2;
var property;
if (true) {
value = environment.__proto__.__proto__;
var binding = env2_0;
var value3 = binding(env2_2[6]);
if (value3.isIOS()) {
binding = env2_0;
binding2 = env2_2;
value = binding(binding2[8]);
property = binding2[7];
yield value(property, binding2.paths);
value = undefined;
if (false) {
return value;
}
property = value.default;
(property ?? value).addCustomSourceTransformer(_fun81427);
}
}
function _fun81427(a0) { // fn#81427, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10746:1394, offset: 0x01ecf124, size: 92 bytes, params: 2, frame: 13
var r0;
var value;
var value2;
var binding;
var resolvedOTAAssetURI;
var uri;
var value3;
var object;
if (a0.isLoadedFromFileSystem()) {
value = a0.scaledAssetURLNearBundle();
value2 = environment.__proto__.__proto__.__proto__;
binding = env3_8;
resolvedOTAAssetURI = binding.resolvedOTAAssetURI;
uri = value.uri;
value3 = Reflect.apply(resolvedOTAAssetURI, binding, [uri]);
uri = value.uri;
if (value3 === uri) {
r0 = null;
} else {
object = {};
copyDataProperties(object, value, value3);
object['uri'] = value3;
r0 = object;
}
return r0;
}
return null;
}
}
function value_81428() { // fn#81428, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10746:1549, offset: 0x00c3945f, size: 30 bytes, params: 1, frame: 13
return env0_0.apply(this, arguments);
}
function value_81429(a0) { // fn#81429, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10746:1643, offset: 0x01ecf180, size: 115 bytes, params: 2, frame: 15
var environment;
let value = environment.__proto__;
value = require(4242) /* metro dependency 4242 */;
value = value.match(a0);
value = value.with({type: 'OtaCheckAttempt'}, _fun81430);
value = value.with({type: 'OtaAssetDownloadAttempt'}, _fun81431);
value.exhaustive();
function _fun81430(a0) { // fn#81430, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10746:1703, offset: 0x01ecf1f3, size: 167 bytes, params: 2, frame: 18
let value = environment.__proto__.__proto__;
env2_7.verbose('OTA check attempt', a0);
const defaultImport = AnalyticsUtils;
const track = defaultImport.track;
const MOBILE_OTA_CHECK_ATTEMPT = AnalyticEvents.MOBILE_OTA_CHECK_ATTEMPT;
Reflect.apply(track, defaultImport, [MOBILE_OTA_CHECK_ATTEMPT, {result: a0.result,
duration_seconds: a0.durationSeconds, bytes_received: a0.bytesReceived, error: a0.error}]);
value = importDefault(4826) /* metro dependency 4826: MonitoringAgent */;
return value.increment(BundleUpdater.prepareOtaMetricForDatadog(a0, ['result']));
}
function _fun81431(a0) { // fn#81431, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10746:1998, offset: 0x01ecf29a, size: 189 bytes, params: 2, frame: 18
let value = environment.__proto__.__proto__;
env2_7.verbose('OTA asset download attempt', a0);
const defaultImport = AnalyticsUtils;
const track = defaultImport.track;
const MOBILE_OTA_ASSET_DOWNLOAD_ATTEMPT = AnalyticEvents.MOBILE_OTA_ASSET_DOWNLOAD_ATTEMPT;
Reflect.apply(track, defaultImport, [MOBILE_OTA_ASSET_DOWNLOAD_ATTEMPT, {result: a0.result,
duration_seconds: a0.durationSeconds, error: a0.error, url: a0.url, status_code: a0.statusCode,
bytes_received: a0.bytesReceived}]);
value = importDefault(4826) /* metro dependency 4826: MonitoringAgent */;
return value.increment(BundleUpdater.prepareOtaMetricForDatadog(a0, ['result', 'statusCode']));
}
}
function value_81432(a0) { // fn#81432, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10746:2375, offset: 0x01ecf357, size: 57 bytes, params: 2, frame: 12
const value = a1;
const env0_0 = a0;
const r3 = value !== undefined ? value : [];
const object = {};
object.name = a0.type;
object.tags = r3.map(_fun81433);
return object;
function _fun81433(a0) { // fn#81433, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10746:2423, offset: 0x0102abe3, size: 44 bytes, params: 2, frame: 15
return '' + a0 + ':' + env0_0[a0];
}
}
}
}
global.__d(_fun81412, 10560, [5, 6, 7, 27, 661, 3, 477, 90, 1962, 4242, 683, 4826,
2]) /* metro module 10560, dependencies: [5, 6, 7, 27, 661, 3, 477, 90, 1962, 4242, 683, 4826, 2] */;