This commit is contained in:
janisslsm committed 2026-07-28 01:06:53 +03:00
1 parent af3b49f756
commit 1781d25a15
22448 files changed
+2731829 -2650550

No files matched your search

File diff suppressed because it is too large. Load diff
+116 -112
View File
@@ -1,128 +1,132 @@
/* Metro module 4650; source: lib/uploader/Upload.tsx; dependencies: [6, 7, 15, 17, 18, 4651, 22, 4655, 491, 639, 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 * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as Module00639Module from '../../by-id/module-00639.js'; /* Metro dependency 639 */
function _fun40122(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#40122, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4828:6, offset: 0x010f6cfc, size: 320 bytes, params: 8, frame: 21
var object3;
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_4 = importDefault(6) /* metro dependency 6 */;
const env0_5 = importDefault(7) /* metro dependency 7 */;
const env0_6 = importDefault(15) /* metro dependency 15 */;
const env0_7 = importDefault(17) /* metro dependency 17 */;
const env0_8 = importDefault(18) /* metro dependency 18 */;
object3 = {REACT_NATIVE: 0};
object3[0] = 'REACT_NATIVE';
object3.WEB = 1;
object3[1] = 'WEB';
const object4 = {FILE_ATTACHMENT: 0};
object4[0] = 'FILE_ATTACHMENT';
object4.IMAGE_PICKER = 1;
object4[1] = 'IMAGE_PICKER';
object4.IMAGE_EDITOR = 2;
object4[2] = 'IMAGE_EDITOR';
const EventEmitter = (require(639) /* metro dependency 639 */).EventEmitter;
object = {REACT_NATIVE: 0};
object[0] = 'REACT_NATIVE';
object.WEB = 1;
object[1] = 'WEB';
const object2 = {FILE_ATTACHMENT: 0};
object2[0] = 'FILE_ATTACHMENT';
object2.IMAGE_PICKER = 1;
object2[1] = 'IMAGE_PICKER';
object2.IMAGE_EDITOR = 2;
object2[2] = 'IMAGE_EDITOR';
const EventEmitter = (Module00639Module).EventEmitter;
const value = _fun40126(EventEmitter);
(require(2) /* metro dependency 2 */).fileFinishedImporting('lib/uploader/Upload.tsx');
(FileImportTrackerModule).fileFinishedImporting('lib/uploader/Upload.tsx');
exports.default = value;
exports.UploadPlatform = object3;
exports.UploadPlatform = object;
exports.isResolvedUpload = function(a0) {
return a0.isVideo !== undefined && a0.isImage !== undefined;
};
exports.UploadOrigin = object4;
}
function _isNativeReflectConstruct_40123() { // fn#40123, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4828:148, offset: 0x010f6e3c, size: 94 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) {
exports.UploadOrigin = object2;
function _isNativeReflectConstruct_40123() { // fn#40123, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4828:148, offset: 0x010f6e3c, size: 94 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_40123_isNativeReflectConstruct = function() {
return !!result;
})();
}
return (_isNativeReflectConstruct_40123_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _fun40126(a0) { // fn#40126, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4828:570, offset: 0x010f6e9a, size: 91 bytes, params: 2, frame: 16
const closure = Upload;
env0_8(closure, a0);
return env0_5(closure, [{key: 'cancel', value: function() {
}}, {key: 'resetState', value: function() {
return this;
}}]);
}
function _fun40126(a0) { // fn#40126, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4828:570, offset: 0x010f6e9a, size: 91 bytes, params: 2, frame: 16
const Upload2 = Upload;
Inherits(Upload2, a0);
return CreateClass(Upload2, [{key: 'cancel', value: function() {
}}, {key: 'resetState', value: function() {
return this;
}}]);
function Upload(a0) { // fn#40127, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4828:582, offset: 0x010f6ef5, size: 579 bytes, params: 2, frame: 21
var moduleValue;
var classifyFile;
var file;
var classification;
var moduleValue2;
var getFile;
var filename;
var value8;
const value = environment.__proto__;
env1_4(this, Upload);
const value3 = env1_7(Upload);
const value6 = env1_6(this, _isNativeReflectConstruct_40123() ? global.Reflect.construct(value3, [],
env1_7(this).constructor) : value3.apply(this, undefined));
value6.allowOptimization = true;
value6.item = a0;
const platform = a0.platform;
const REACT_NATIVE = env1_9.REACT_NATIVE;
if (platform === REACT_NATIVE) {
value6.id = a0.id ?? a0.uri;
moduleValue2 = require(4651) /* metro dependency 4651: UploadUtils */;
getFile = moduleValue2.getFile;
filename = a0.filename;
value8 = Reflect.apply(getFile, moduleValue2, [{uri: a0.uri, overrideFilename: filename,
overrideType: a0.mimeType}]);
filename = value8.filename;
value6.filename = filename;
value6.isImage = value8.isImage;
value6.isVideo = value8.isVideo;
value6.mimeType = value8.type;
value6.origin = a0.origin;
value6.durationSecs = a0.durationSecs;
value6.waveform = a0.waveform;
} else {
value6.id = a0.id ?? (importDefault(22) /* metro dependency 22 */).uniqueId('upload');
moduleValue = importAll(4655) /* metro dependency 4655: FileUtils */;
classifyFile = moduleValue.classifyFile;
file = a0.file;
value6.classification = Reflect.apply(classifyFile, moduleValue, [file]);
classification = value6.classification;
value6.isImage = classification === 'image';
classification = value6.classification;
value6.isVideo = classification === 'video';
file = a0.file;
value6.filename = file.name;
file = a0.file;
value6.mimeType = file.type;
value6.origin = a0.origin;
}
value6.isThumbnail = a0.isThumbnail;
value6.clip = a0.clip;
value6.uniqueId = (require(491) /* metro dependency 491 */).v4();
value6.spoiler = false;
value6.description = null;
return value6;
}
function Upload(a0) { // fn#40127, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4828:582, offset: 0x010f6ef5, size: 579 bytes, params: 2, frame: 21
var moduleValue;
var classifyFile;
var file;
var classification;
var moduleValue2;
var getFile;
var filename;
var value8;
const value = environment.__proto__;
env1_4(this, Upload);
const value3 = env1_7(Upload);
const value6 = env1_6(this, _isNativeReflectConstruct_40123() ? global.Reflect.construct(value3, [],
env1_7(this).constructor) : value3.apply(this, undefined));
value6.allowOptimization = true;
value6.item = a0;
const platform = a0.platform;
const REACT_NATIVE = env1_9.REACT_NATIVE;
if (platform === REACT_NATIVE) {
value6.id = a0.id ?? a0.uri;
moduleValue2 = require(4651) /* metro dependency 4651: UploadUtils */;
getFile = moduleValue2.getFile;
filename = a0.filename;
value8 = Reflect.apply(getFile, moduleValue2, [{uri: a0.uri, overrideFilename: filename,
overrideType: a0.mimeType}]);
filename = value8.filename;
value6.filename = filename;
value6.isImage = value8.isImage;
value6.isVideo = value8.isVideo;
value6.mimeType = value8.type;
value6.origin = a0.origin;
value6.durationSecs = a0.durationSecs;
value6.waveform = a0.waveform;
} else {
value6.id = a0.id ?? (importDefault(22) /* metro dependency 22 */).uniqueId('upload');
moduleValue = importAll(4655) /* metro dependency 4655: FileUtils */;
classifyFile = moduleValue.classifyFile;
file = a0.file;
value6.classification = Reflect.apply(classifyFile, moduleValue, [file]);
classification = value6.classification;
value6.isImage = classification === 'image';
classification = value6.classification;
value6.isVideo = classification === 'video';
file = a0.file;
value6.filename = file.name;
file = a0.file;
value6.mimeType = file.type;
value6.origin = a0.origin;
}
value6.isThumbnail = a0.isThumbnail;
value6.clip = a0.clip;
value6.uniqueId = (require(491) /* metro dependency 491 */).v4();
value6.spoiler = false;
value6.description = null;
return value6;
}
global.__d(_fun40122, 4650, [6, 7, 15, 17, 18, 4651, 22, 4655, 491, 639,
2]) /* metro module 4650, dependencies: [6, 7, 15, 17, 18, 4651, 22, 4655, 491, 639, 2] */;
+62 -57
View File
@@ -1,71 +1,76 @@
/* Metro module 4692; source: lib/uploader/UploadTargets.tsx; dependencies: [6, 7, 1379, 661, 4655, 4651, 4693, 4695, 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 ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as FileUtilsModule from '../../utils/FileUtils.tsx'; /* Metro dependency 4655 */
function _fun40570(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#40570, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4870:6, offset: 0x0110535c, size: 256 bytes, params: 8, frame: 20
var object2;
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_4 = importDefault(6) /* metro dependency 6 */;
const env0_5 = importDefault(7) /* metro dependency 7 */;
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
const constantsModule = require(661) /* metro dependency 661: Constants */;
const env0_7 = constantsModule.Endpoints;
const env0_8 = constantsModule.MAX_UPLOAD_COUNT;
const env0_9 = _fun40571();
object2 = {MESSAGE_ATTACHMENT: 0};
object2[0] = 'MESSAGE_ATTACHMENT';
object2.GUILD_PRODUCT_ATTACHMENT = 1;
object2[1] = 'GUILD_PRODUCT_ATTACHMENT';
object2.GRAVITY_ATTACHMENT = 2;
object2[2] = 'GRAVITY_ATTACHMENT';
(require(2) /* metro dependency 2 */).fileFinishedImporting('lib/uploader/UploadTargets.tsx');
exports.UploadTargets = object2;
object = {MESSAGE_ATTACHMENT: 0};
object[0] = 'MESSAGE_ATTACHMENT';
object.GUILD_PRODUCT_ATTACHMENT = 1;
object[1] = 'GUILD_PRODUCT_ATTACHMENT';
object.GRAVITY_ATTACHMENT = 2;
object[2] = 'GRAVITY_ATTACHMENT';
(FileImportTrackerModule).fileFinishedImporting('lib/uploader/UploadTargets.tsx');
exports.UploadTargets = object;
exports.getUploadTarget = getUploadTarget;
}
function _fun40571() { // fn#40571, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4870:173, offset: 0x0110545c, size: 176 bytes, params: 1, frame: 15
return CreateClass(MessageAttachmentUploadTarget, [{key: 'getCreateAttachmentURL', value: function(a0) {
return Endpoints.MESSAGE_CREATE_ATTACHMENT_UPLOAD(a0);
}}, {key: 'getDeleteUploadURL', value: function(a0) {
return Endpoints.MESSAGE_DELETE_UPLOAD(a0);
}}, {key: 'getMaxFileSize', value: value_40575}, {key: 'getMaxAttachmentsCount', value: function() {
return MAX_UPLOAD_COUNT;
}}, {key: 'getMaxTotalAttachmentSize', value: function() {
return require(dependencyMap[5]).MAX_TOTAL_ATTACHMENT_SIZE;
}}, {key: 'shouldReactNativeCompressUploads', get: function() {
return true;
}}]);
function MessageAttachmentUploadTarget() { // fn#40572, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4870:194, offset: 0x00c8063e, size: 27 bytes, params: 1, frame: 13
env1_4(this, MessageAttachmentUploadTarget);
}
function _fun40571() { // fn#40571, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4870:173, offset: 0x0110545c, size: 176 bytes, params: 1, frame: 15
return env0_5(MessageAttachmentUploadTarget, [{key: 'getCreateAttachmentURL', value: function(a0) {
return Endpoints.MESSAGE_CREATE_ATTACHMENT_UPLOAD(a0);
}}, {key: 'getDeleteUploadURL', value: function(a0) {
return Endpoints.MESSAGE_DELETE_UPLOAD(a0);
}}, {key: 'getMaxFileSize', value: value_40575}, {key: 'getMaxAttachmentsCount', value: function() {
return MAX_UPLOAD_COUNT;
}}, {key: 'getMaxTotalAttachmentSize', value: function() {
return require(dependencyMap[5]).MAX_TOTAL_ATTACHMENT_SIZE;
}}, {key: 'shouldReactNativeCompressUploads', get: function() {
return true;
}}]);
}
function value_40575(a0) { // fn#40575, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4870:479, offset: 0x0110553a, size: 70 bytes, params: 2, frame: 13
let value = environment.__proto__;
const basicChannel = ChannelStore.getBasicChannel(a0);
value = undefined;
return FileUtilsModule.maxFileSize(basicChannel == null ? value : basicChannel.guild_id);
}
function getUploadTarget(a0) { // fn#40579, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4870:1077, offset: 0x011055a1, size: 158 bytes, params: 2, frame: 12
var value3;
var value4;
var value;
const GUILD_PRODUCT_ATTACHMENT = env0_10.GUILD_PRODUCT_ATTACHMENT;
if (GUILD_PRODUCT_ATTACHMENT === a0) {
value = importDefault(4693) /* metro dependency 4693: GuildProductAttachmentUploadTarget */;
value4 = Object.create(value.prototype, {constructor: {value: value}});
value = new value();
return value instanceof Object ? value : value4;
}
const GRAVITY_ATTACHMENT = env0_10.GRAVITY_ATTACHMENT;
if (GRAVITY_ATTACHMENT === a0) {
value = importDefault(4695) /* metro dependency 4695: ICYMIAttachmentUploadTarget */;
value3 = Object.create(value.prototype, {constructor: {value: value}});
value = new value();
return value instanceof Object ? value : value3;
function getUploadTarget(a0) { // fn#40579, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4870:1077, offset: 0x011055a1, size: 158 bytes, params: 2, frame: 12
var value3;
var value4;
var value;
const GUILD_PRODUCT_ATTACHMENT = env0_10.GUILD_PRODUCT_ATTACHMENT;
if (GUILD_PRODUCT_ATTACHMENT === a0) {
value = importDefault(4693) /* metro dependency 4693: GuildProductAttachmentUploadTarget */;
value4 = Object.create(value.prototype, {constructor: {value: value}});
value = new value();
return value instanceof Object ? value : value4;
}
const GRAVITY_ATTACHMENT = env0_10.GRAVITY_ATTACHMENT;
if (GRAVITY_ATTACHMENT === a0) {
value = importDefault(4695) /* metro dependency 4695: ICYMIAttachmentUploadTarget */;
value3 = Object.create(value.prototype, {constructor: {value: value}});
value = new value();
return value instanceof Object ? value : value3;
}
env0_10.MESSAGE_ATTACHMENT;
const binding = env0_9;
value = Object.create(binding.prototype, {constructor: {value: binding}});
const binding2 = new binding();
return binding2 instanceof Object ? binding2 : value;
}
env0_10.MESSAGE_ATTACHMENT;
const binding = env0_9;
value = Object.create(binding.prototype, {constructor: {value: binding}});
const binding2 = new binding();
return binding2 instanceof Object ? binding2 : value;
}
function value_40575(a0) { // fn#40575, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4870:479, offset: 0x0110553a, size: 70 bytes, params: 2, frame: 13
let value = environment.__proto__;
const basicChannel = ChannelStore.getBasicChannel(a0);
value = undefined;
const fileUtilsModule = importAll(4655) /* metro dependency 4655: FileUtils */;
return fileUtilsModule.maxFileSize(basicChannel == null ? value : basicChannel.guild_id);
}
global.__d(_fun40570, 4692, [6, 7, 1379, 661, 4655, 4651, 4693, 4695,
2]) /* metro module 4692, dependencies: [6, 7, 1379, 661, 4655, 4651, 4693, 4695, 2] */;
+221 -211
View File
@@ -1,13 +1,17 @@
/* Metro module 4658; source: lib/uploader/UploadUtils.tsx; dependencies: [6, 7, 4650, 507, 4659, 1873, 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 * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ShimNativeModule from '../../external/discord_common/js/packages/libdiscore/js_shim/js/shim.native.tsx'; /* Metro dependency 1873 */
import * as UploadModule from './Upload.tsx'; /* Metro dependency 4650 */
function _fun40246(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#40246, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:6, offset: 0x010fa529, size: 180 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(6) /* metro dependency 6 */;
const env0_3 = importDefault(7) /* metro dependency 7 */;
let value = _fun40247();
const value2 = _fun40251();
(require(2) /* metro dependency 2 */).fileFinishedImporting('lib/uploader/UploadUtils.tsx');
(FileImportTrackerModule).fileFinishedImporting('lib/uploader/UploadUtils.tsx');
exports.doesImageMatchUpload = doesImageMatchUpload;
exports.calculateProgress = function(a0, a1) {
var value = 0;
@@ -16,220 +20,226 @@ function _fun40246(global, require, importDefault, importAll, module, exports, d
exports.DefaultHttpClient = value;
exports.canUploadNatively = canUploadNatively;
exports.LibdiscoreHttpClient = value2;
}
function _fun40247() { // fn#40247, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:122, offset: 0x010fa5dd, size: 80 bytes, params: 1, frame: 15
return CreateClass(DefaultHttpClient, [{key: 'sliceBody', value: function(a0, a1) {
var r0;
var value = a0;
if (value instanceof global.File) {
value = value.slice(a1);
r0 = value;
} else {
r0 = value;
}
return r0;
}}, {key: 'doUpload', value: function(a0, a1) {
if (a1?.fileByteRange != null) {
a0.body = this.sliceBody(a0.body, a1.fileByteRange.start);
}
return require(dependencyMap[3]).HTTP.put(a0);
}}]);
function DefaultHttpClient() { // fn#40248, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:143, offset: 0x00c618a4, size: 27 bytes, params: 1, frame: 13
env1_2(this, DefaultHttpClient);
}
function _fun40247() { // fn#40247, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:122, offset: 0x010fa5dd, size: 80 bytes, params: 1, frame: 15
return env0_3(DefaultHttpClient, [{key: 'sliceBody', value: function(a0, a1) {
var r0;
var value = a0;
if (value instanceof global.File) {
value = value.slice(a1);
r0 = value;
}
function _fun40251() { // fn#40251, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:448, offset: 0x010fa6be, size: 55 bytes, params: 1, frame: 14
return CreateClass(LibdiscoreHttpClient, [{key: 'doUpload', value: value_40253}]);
function LibdiscoreHttpClient() { // fn#40252, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:469, offset: 0x010fa6f5, size: 96 bytes, params: 1, frame: 14
let value = environment.__proto__;
env1_2(this, LibdiscoreHttpClient);
value = require(1873) /* metro dependency 1873: shimNative */;
if (value.isLibdiscoreInitialized()) {
return undefined;
}
const Error = global.Error;
throw new Error('Libdiscore is not loaded');
}
function value_40253(a0, a1) { // fn#40253, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:637, offset: 0x010fa755, size: 426 bytes, params: 3, frame: 20
var environment;
var r1;
var value5;
let env0_0 = a0;
let value = environment.__proto__;
value = undefined;
const httpClientAPI = (ShimNativeModule).getHttpClientAPI();
if (httpClientAPI == null) {
throw new global.Error('Libdiscore client is not available');
}
let body = a0.body;
let uri = body == null ? value : body.uri;
if (value !== uri && typeof a0.body.uri === 'string') {
body = a0.body;
uri = body.uri;
value5 = uri.startsWith('file://');
body = a0.body;
uri = body.uri;
r1 = value5 ? uri.slice(7) : uri;
} else {
r1 = value;
}
if (value === r1) {
throw new global.Error('No file path found in request body');
}
if (r1 === '') {
throw new global.Error('No file path found in request body');
}
let env0_2 = httpClientAPI.httpRequest(a0.url, {method: 'PUT', body: {path: r1,
byteRangeStart: a1 == null || a1.fileByteRange == null ? value : a1.fileByteRange.start,
byteRangeEnd: a1 == null || a1.fileByteRange == null ? value : a1.fileByteRange.end}, headers: a0.headers});
const Promise = global.Promise;
value = Object.create(Promise.prototype, {constructor: {value: Promise}});
const promise = new Promise(function(a0, a1) {
var env0_0 = a0;
var env0_1 = a1;
var closure = _fun40255;
var env0_2 = closure;
closure();
});
return promise instanceof Object ? promise : value;
function _fun40254(a0, a1) { // fn#40254, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:1196, offset: 0x010fa8ff, size: 33 bytes, params: 3, frame: 9
const env0_0 = a0;
const env0_1 = a1;
pollStatus();
function pollStatus() { // fn#40255, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:1219, offset: 0x010fa920, size: 491 bytes, params: 1, frame: 18
var binding;
var httpRequestStatus;
var Error;
var error;
var object;
var response;
var value5;
const value = environment.__proto__;
const signal = env1_0.signal;
if (signal == null) {
httpRequestStatus = env1_1.getHttpRequestStatus(env1_2);
} else {
if (signal.aborted) {
Error = global.Error;
value5 = Object.create(Error.prototype, {constructor: {value: Error}});
error = new Error('Request cancelled');
require(error instanceof Object ? error : value5);
env1_1.cancelHttpRequest(env1_2);
return undefined;
}
httpRequestStatus = env1_1.getHttpRequestStatus(env1_2);
}
const value3 = undefined;
if ((httpRequestStatus == null ? value3 : httpRequestStatus.status) === 'success') {
binding = env0_0;
object = {};
response = httpRequestStatus.response;
object.status = response == null ? value3 : response.status;
response = httpRequestStatus.response;
object.headers = response == null ? value3 : response.headers;
response = httpRequestStatus.response;
object.text = response == null ? value3 : response.body;
binding(object);
} else if ((httpRequestStatus == null ? value3 : httpRequestStatus.status) === 'error') {
Error = global.Error;
error = httpRequestStatus.error;
error = new Error();
require(error);
} else if ((httpRequestStatus == null ? value3 : httpRequestStatus.status) === 'progressing') {
if (value3 !== env1_0.onRequestProgress) {
if (httpRequestStatus.uploaded_bytes != null) {
if (httpRequestStatus.uploaded_bytes > 0) {
env1_0.onRequestProgress({loaded: httpRequestStatus.uploaded_bytes,
total: httpRequestStatus.total_bytes});
}
}
}
global.setTimeout(pollStatus, 50);
} else {
require(new global.Error('Unknown upload status'));
}
return value3;
}
}
}
}
function doesImageMatchUpload(a0, a1) { // fn#40256, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:1993, offset: 0x010fab0b, size: 176 bytes, params: 3, frame: 15
var item;
const UploadPlatform = (UploadModule).UploadPlatform;
var filename;
var originalUri;
if (a1.id === a0.uri) {
return true;
}
if (a1.id == null) {
item = a1.item;
if (item.platform === UploadPlatform.REACT_NATIVE) {
item = a1.item;
filename = a0.filename;
originalUri = item.originalUri;
if (originalUri === a0.uri) {
return true;
}
if (filename == null) {
return false;
}
originalUri = item.originalUri;
if (originalUri == null) {
return false;
}
if (originalUri.includes(filename)) {
return true;
}
return false;
}
} else {
if (a1.id === a0.id) {
return true;
}
item = a1.item;
if (item.platform === UploadPlatform.REACT_NATIVE) {
item = a1.item;
filename = a0.filename;
originalUri = item.originalUri;
if (originalUri === a0.uri) {
return true;
}
if (filename == null) {
return false;
}
originalUri = item.originalUri;
if (originalUri == null) {
return false;
}
if (originalUri.includes(filename)) {
return true;
}
return false;
}
}
return false;
}
function canUploadNatively(a0) { // fn#40258, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:2423, offset: 0x010fabf8, size: 138 bytes, params: 2, frame: 15
var moduleValue;
const platform = a0.platform;
var value;
const UploadPlatform = (UploadModule).UploadPlatform;
const REACT_NATIVE = UploadPlatform.REACT_NATIVE;
let r0 = platform === REACT_NATIVE && a0.uri != null;
if (r0) {
moduleValue = require(4659) /* metro dependency 4659: AttachmentFileNative */;
r0 = moduleValue.fileIsInAppDir(a0.uri);
}
if (r0) {
value = require(1873) /* metro dependency 1873: shimNative */;
value = value.isLibdiscoreInitialized();
r0 = value;
}
return r0;
}}, {key: 'doUpload', value: function(a0, a1) {
if (a1?.fileByteRange != null) {
a0.body = this.sliceBody(a0.body, a1.fileByteRange.start);
}
return require(dependencyMap[3]).HTTP.put(a0);
}}]);
}
function _fun40251() { // fn#40251, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:448, offset: 0x010fa6be, size: 55 bytes, params: 1, frame: 14
return env0_3(LibdiscoreHttpClient, [{key: 'doUpload', value: value_40253}]);
}
function doesImageMatchUpload(a0, a1) { // fn#40256, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:1993, offset: 0x010fab0b, size: 176 bytes, params: 3, frame: 15
var item;
const UploadPlatform = (require(4650) /* metro dependency 4650: Upload */).UploadPlatform;
var filename;
var originalUri;
if (a1.id === a0.uri) {
return true;
}
if (a1.id == null) {
item = a1.item;
if (item.platform === UploadPlatform.REACT_NATIVE) {
item = a1.item;
filename = a0.filename;
originalUri = item.originalUri;
if (originalUri === a0.uri) {
return true;
}
if (filename == null) {
return false;
}
originalUri = item.originalUri;
if (originalUri == null) {
return false;
}
if (originalUri.includes(filename)) {
return true;
}
return false;
}
} else {
if (a1.id === a0.id) {
return true;
}
item = a1.item;
if (item.platform === UploadPlatform.REACT_NATIVE) {
item = a1.item;
filename = a0.filename;
originalUri = item.originalUri;
if (originalUri === a0.uri) {
return true;
}
if (filename == null) {
return false;
}
originalUri = item.originalUri;
if (originalUri == null) {
return false;
}
if (originalUri.includes(filename)) {
return true;
}
return false;
}
}
return false;
}
function canUploadNatively(a0) { // fn#40258, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:2423, offset: 0x010fabf8, size: 138 bytes, params: 2, frame: 15
var moduleValue;
const platform = a0.platform;
var value;
const UploadPlatform = (require(4650) /* metro dependency 4650: Upload */).UploadPlatform;
const REACT_NATIVE = UploadPlatform.REACT_NATIVE;
let r0 = platform === REACT_NATIVE && a0.uri != null;
if (r0) {
moduleValue = require(4659) /* metro dependency 4659: AttachmentFileNative */;
r0 = moduleValue.fileIsInAppDir(a0.uri);
}
if (r0) {
value = require(1873) /* metro dependency 1873: shimNative */;
value = value.isLibdiscoreInitialized();
r0 = value;
}
return r0;
}
function LibdiscoreHttpClient() { // fn#40252, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:469, offset: 0x010fa6f5, size: 96 bytes, params: 1, frame: 14
let value = environment.__proto__;
env1_2(this, LibdiscoreHttpClient);
value = require(1873) /* metro dependency 1873: shimNative */;
if (value.isLibdiscoreInitialized()) {
return undefined;
}
const Error = global.Error;
throw new Error('Libdiscore is not loaded');
}
function value_40253(a0, a1) { // fn#40253, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:637, offset: 0x010fa755, size: 426 bytes, params: 3, frame: 20
var environment;
var r1;
var value5;
let env0_0 = a0;
let value = environment.__proto__;
value = undefined;
const httpClientAPI = (require(1873) /* metro dependency 1873: shimNative */).getHttpClientAPI();
if (httpClientAPI == null) {
throw new global.Error('Libdiscore client is not available');
}
let body = a0.body;
let uri = body == null ? value : body.uri;
if (value !== uri && typeof a0.body.uri === 'string') {
body = a0.body;
uri = body.uri;
value5 = uri.startsWith('file://');
body = a0.body;
uri = body.uri;
r1 = value5 ? uri.slice(7) : uri;
} else {
r1 = value;
}
if (value === r1) {
throw new global.Error('No file path found in request body');
}
if (r1 === '') {
throw new global.Error('No file path found in request body');
}
let env0_2 = httpClientAPI.httpRequest(a0.url, {method: 'PUT', body: {path: r1,
byteRangeStart: a1 == null || a1.fileByteRange == null ? value : a1.fileByteRange.start,
byteRangeEnd: a1 == null || a1.fileByteRange == null ? value : a1.fileByteRange.end}, headers: a0.headers});
const Promise = global.Promise;
value = Object.create(Promise.prototype, {constructor: {value: Promise}});
const promise = new Promise(function(a0, a1) {
var env0_0 = a0;
var env0_1 = a1;
var closure = _fun40255;
var env0_2 = closure;
closure();
});
return promise instanceof Object ? promise : value;
}
function _fun40254(a0, a1) { // fn#40254, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:1196, offset: 0x010fa8ff, size: 33 bytes, params: 3, frame: 9
const env0_0 = a0;
const env0_1 = a1;
pollStatus();
}
function pollStatus() { // fn#40255, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:1219, offset: 0x010fa920, size: 491 bytes, params: 1, frame: 18
var binding;
var httpRequestStatus;
var Error;
var error;
var object2;
var response;
var value5;
const value = environment.__proto__;
const signal = env1_0.signal;
if (signal == null) {
httpRequestStatus = env1_1.getHttpRequestStatus(env1_2);
} else {
if (signal.aborted) {
Error = global.Error;
value5 = Object.create(Error.prototype, {constructor: {value: Error}});
error = new Error('Request cancelled');
require(error instanceof Object ? error : value5);
env1_1.cancelHttpRequest(env1_2);
return undefined;
}
httpRequestStatus = env1_1.getHttpRequestStatus(env1_2);
}
const value3 = undefined;
if ((httpRequestStatus == null ? value3 : httpRequestStatus.status) === 'success') {
binding = env0_0;
object2 = {};
response = httpRequestStatus.response;
object2.status = response == null ? value3 : response.status;
response = httpRequestStatus.response;
object2.headers = response == null ? value3 : response.headers;
response = httpRequestStatus.response;
object2.text = response == null ? value3 : response.body;
binding(object2);
} else if ((httpRequestStatus == null ? value3 : httpRequestStatus.status) === 'error') {
Error = global.Error;
error = httpRequestStatus.error;
error = new Error();
require(error);
} else if ((httpRequestStatus == null ? value3 : httpRequestStatus.status) === 'progressing') {
if (value3 !== env1_0.onRequestProgress) {
if (httpRequestStatus.uploaded_bytes != null) {
if (httpRequestStatus.uploaded_bytes > 0) {
env1_0.onRequestProgress({loaded: httpRequestStatus.uploaded_bytes,
total: httpRequestStatus.total_bytes});
}
}
}
global.setTimeout(pollStatus, 50);
} else {
require(new global.Error('Unknown upload status'));
}
return value3;
}
global.__d(_fun40246, 4658, [6, 7, 4650, 507, 4659, 1873,
2]) /* metro module 4658, dependencies: [6, 7, 4650, 507, 4659, 1873, 2] */;
File diff suppressed because it is too large. Load diff
+194 -179
View File
@@ -1,192 +1,207 @@
/* Metro module 7225; source: lib/uploader/UploaderQueue.tsx; dependencies: [5, 6, 7, 3, 2] */
import Logger from '../../modules/debug/Logger.tsx'; /* Metro dependency 3 */
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 * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
function _fun57838(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#57838, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7403:6, offset: 0x016b7650, size: 202 bytes, params: 8, frame: 18
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_0 = importDefault(5) /* metro dependency 5 */;
const env0_1 = importDefault(6) /* metro dependency 6 */;
const env0_2 = importDefault(7) /* metro dependency 7 */;
let value = importDefault(3) /* metro dependency 3: Logger */;
let value = Logger;
value = new value('UploaderQueue.tsx');
value = _fun57839();
value = new value();
(require(2) /* metro dependency 2 */).fileFinishedImporting('lib/uploader/UploaderQueue.tsx');
(FileImportTrackerModule).fileFinishedImporting('lib/uploader/UploaderQueue.tsx');
exports.default = value;
}
function _fun57839() { // fn#57839, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7403:166, offset: 0x016b771a, size: 96 bytes, params: 1, frame: 17
const binding = env0_2;
const closure = UploaderQueue;
const items2 = [{key: 'enqueue', value: value_57841}];
const env0_0Binding = env0_0(_fun57843);
items2[1] = {key: 'drainQueue', value: value_57847};
return binding(closure, items2);
}
function UploaderQueue() { // fn#57840, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7403:187, offset: 0x016b777a, size: 45 bytes, params: 1, frame: 13
env1_1(this, UploaderQueue);
this.queue = [];
this.drainingQueue = false;
}
function value_57841(a0) { // fn#57841, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7403:294, offset: 0x016b77a7, size: 93 bytes, params: 2, frame: 13
this.queue.unshift(a0);
const value = environment.__proto__;
const binding = env1_3;
binding.log('enqueue() - alreadying draining? ' + (this.drainingQueue ? 'yes' : 'no'));
if (!this.drainingQueue) {
this.drainQueue();
}
}
function* _fun57843() { // fn#57843, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7403:473, offset: 0x016b780d, size: 298 bytes, params: 1, frame: 21
var environment;
var value4;
var Promise;
var prototype;
var closure;
var promise;
var value6;
var value7;
var value8;
var id;
var value9;
var error;
var error2;
var drainQueue;
if (true) {
var env0_0;
this.drainingQueue = true;
value = environment.__proto__.__proto__;
var binding = env2_3;
var log = binding.log;
Reflect.apply(log, binding, ['drainQueue() - starting, queue length: ' + this.queue.length]);
var value3 = this.queue.pop();
if (value3 == null) {
env2_3.log('drainQueue() - No uploads left, setting drainingQueue to false');
function _fun57839() { // fn#57839, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7403:166, offset: 0x016b771a, size: 96 bytes, params: 1, frame: 17
const UploaderQueue2 = UploaderQueue;
const items2 = [{key: 'enqueue', value: value_57841}];
const env0_0Binding = Module00005(_fun57843);
items2[1] = {key: 'drainQueue', value: value_57847};
return CreateClass(UploaderQueue2, items2);
function UploaderQueue() { // fn#57840, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7403:187, offset: 0x016b777a, size: 45 bytes, params: 1, frame: 13
env1_1(this, UploaderQueue);
this.queue = [];
this.drainingQueue = false;
} else {
reducibleJoin3: while (true) {
reduciblePort29: while (true) {
exceptionLanding28: while (true) {
try {
binding = env2_3;
} catch (error) {
break exceptionLanding28;
}
break reducibleJoin3;
}
binding = env2_3;
error2 = binding.error;
Reflect.apply(error2, binding, [error]);
break reduciblePort29;
}
drainQueue = this.drainQueue;
Reflect.apply(drainQueue, this, []);
return undefined;
}
try {
log = binding.log;
} catch (error) {
break exceptionLanding28;
}
try {
Reflect.apply(log, binding, ['drainQueue() - start uploader']);
} catch (error) {
break exceptionLanding28;
}
try {
value4 = value3();
} catch (error) {
break exceptionLanding28;
}
try {
env0_0 = value4;
} catch (error) {
break exceptionLanding28;
}
try {
Promise = global.Promise;
} catch (error) {
break exceptionLanding28;
}
try {
prototype = Promise.prototype;
} catch (error) {
break exceptionLanding28;
}
try {
} catch (error) {
break exceptionLanding28;
}
try {
closure = _fun57844;
} catch (error) {
break exceptionLanding28;
}
try {
promise = new Promise();
} catch (error) {
break exceptionLanding28;
}
try {
value6 = promise instanceof Object ? promise : undefined;
} catch (error) {
break exceptionLanding28;
}
yield value6;
try {
value7 = undefined;
value8 = false;
} catch (error) {
break exceptionLanding28;
}
if (value8) {
return value7;
}
try {
binding = env2_3;
} catch (error) {
break exceptionLanding28;
}
try {
log = binding.log;
} catch (error) {
break exceptionLanding28;
}
try {
id = value4.id;
} catch (error) {
break exceptionLanding28;
}
try {
} catch (error) {
break exceptionLanding28;
}
try {
} catch (error) {
break exceptionLanding28;
}
try {
value9 = 'drainQueue() Uploader complete - ' + id;
} catch (error) {
break exceptionLanding28;
}
try {
Reflect.apply(log, binding, [value9]);
} catch (error) {
break exceptionLanding28;
}
this.drainQueue();
}
function value_57841(a0) { // fn#57841, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7403:294, offset: 0x016b77a7, size: 93 bytes, params: 2, frame: 13
this.queue.unshift(a0);
const value = environment.__proto__;
const binding = env1_3;
binding.log('enqueue() - alreadying draining? ' + (this.drainingQueue ? 'yes' : 'no'));
if (!this.drainingQueue) {
this.drainQueue();
}
}
function* _fun57843() { // fn#57843, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7403:473, offset: 0x016b780d, size: 298 bytes, params: 1, frame: 21
var environment;
var value4;
var Promise;
var prototype;
var closure;
var promise;
var value6;
var value7;
var value8;
var id;
var value9;
var error;
var error2;
var drainQueue;
if (true) {
var env0_0;
this.drainingQueue = true;
value = environment.__proto__.__proto__;
var binding = env2_3;
var log = binding.log;
Reflect.apply(log, binding, ['drainQueue() - starting, queue length: ' + this.queue.length]);
var value3 = this.queue.pop();
if (value3 == null) {
env2_3.log('drainQueue() - No uploads left, setting drainingQueue to false');
this.drainingQueue = false;
} else {
reducibleJoin3: while (true) {
reduciblePort29: while (true) {
exceptionLanding28: while (true) {
try {
binding = env2_3;
} catch (error) {
break exceptionLanding28;
}
break reducibleJoin3;
}
binding = env2_3;
error2 = binding.error;
Reflect.apply(error2, binding, [error]);
break reduciblePort29;
}
drainQueue = this.drainQueue;
Reflect.apply(drainQueue, this, []);
return undefined;
}
try {
log = binding.log;
} catch (error) {
break exceptionLanding28;
}
try {
Reflect.apply(log, binding, ['drainQueue() - start uploader']);
} catch (error) {
break exceptionLanding28;
}
try {
value4 = value3();
} catch (error) {
break exceptionLanding28;
}
try {
env0_0 = value4;
} catch (error) {
break exceptionLanding28;
}
try {
Promise = global.Promise;
} catch (error) {
break exceptionLanding28;
}
try {
prototype = Promise.prototype;
} catch (error) {
break exceptionLanding28;
}
try {
} catch (error) {
break exceptionLanding28;
}
try {
closure = _fun57844;
} catch (error) {
break exceptionLanding28;
}
try {
promise = new Promise();
} catch (error) {
break exceptionLanding28;
}
try {
value6 = promise instanceof Object ? promise : undefined;
} catch (error) {
break exceptionLanding28;
}
yield value6;
try {
value7 = undefined;
value8 = false;
} catch (error) {
break exceptionLanding28;
}
if (value8) {
return value7;
}
try {
binding = env2_3;
} catch (error) {
break exceptionLanding28;
}
try {
log = binding.log;
} catch (error) {
break exceptionLanding28;
}
try {
id = value4.id;
} catch (error) {
break exceptionLanding28;
}
try {
} catch (error) {
break exceptionLanding28;
}
try {
} catch (error) {
break exceptionLanding28;
}
try {
value9 = 'drainQueue() Uploader complete - ' + id;
} catch (error) {
break exceptionLanding28;
}
try {
Reflect.apply(log, binding, [value9]);
} catch (error) {
break exceptionLanding28;
}
this.drainQueue();
}
}
function _fun57844(a0) { // fn#57844, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7403:789, offset: 0x016b7937, size: 98 bytes, params: 2, frame: 15
const env0_0 = a0;
if (env0_0._aborted || env0_0._errored) {
a0();
}
env0_0.addListener('complete', _fun57845);
env0_0.addListener('error', _fun57846);
function _fun57845() { // fn#57845, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7403:849, offset: 0x00cefeb4, size: 15 bytes, params: 1, frame: 9
return env0_0();
}
function _fun57846() { // fn#57846, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7403:882, offset: 0x00cefeb4, size: 15 bytes, params: 1, frame: 9
return env0_0();
}
}
}
function value_57847() { // fn#57847, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7403:986, offset: 0x00c3945f, size: 30 bytes, params: 1, frame: 13
return Module00005.apply(this, arguments);
}
}
}
function _fun57844(a0) { // fn#57844, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7403:789, offset: 0x016b7937, size: 98 bytes, params: 2, frame: 15
const env0_0 = a0;
if (env0_0._aborted || env0_0._errored) {
a0();
}
env0_0.addListener('complete', _fun57845);
env0_0.addListener('error', _fun57846);
}
global.__d(_fun57838, 7225, [5, 6, 7, 3, 2]) /* metro module 7225, dependencies: [5, 6, 7, 3, 2] */;
File diff suppressed because it is too large. Load diff
@@ -1,87 +1,92 @@
/* Metro module 4691; source: lib/uploader/native/CloudUploaderUtils.tsx; dependencies: [1949, 1226, 691, 4651, 22, 683, 2] */
import AnalyticsUtils from '../../../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */
import DeveloperOptionsStore from '../../../stores/DeveloperOptionsStore.tsx'; /* Metro dependency 691 */
import AuthenticationStore from '../../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */
import LocaleStore from '../../../modules/user_settings/LocaleStore.tsx'; /* Metro dependency 1949 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
function _fun40565(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#40565, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4869:6, offset: 0x011050d7, size: 183 bytes, params: 8, frame: 20
var object2;
const env0_0 = require;
const closure = getUploadPayload;
const getUploadPayload2 = getUploadPayload;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const localeStore = importDefault(1949) /* metro dependency 1949: LocaleStore */;
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
const developerOptionsStore = importDefault(691) /* metro dependency 691: DeveloperOptionsStore */;
object2 = {getUploadPayload: closure};
(require(2) /* metro dependency 2 */).fileFinishedImporting('lib/uploader/native/CloudUploaderUtils.tsx');
exports.default = object2;
object = {getUploadPayload: getUploadPayload2};
(FileImportTrackerModule).fileFinishedImporting('lib/uploader/native/CloudUploaderUtils.tsx');
exports.default = object;
exports.prepareMessagePayload = prepareMessagePayload;
exports.getUploadPayload = closure;
}
exports.getUploadPayload = getUploadPayload2;
function _prepareMessageRequestBodyCloud(a0, a1, a2) { // fn#40566, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4869:126, offset: 0x0110518e, size: 166 bytes, params: 4, frame: 21
var r0;
var object;
var object2;
var value;
var value2;
var items2;
const items3 = [];
a0.forEach(_fun40567);
if (a2 == null) {
object = {};
copyDataProperties(object, a1, undefined);
object['attachments'] = items3;
r0 = object;
} else if (a1 != null) {
object2 = {};
copyDataProperties(object2, a1, undefined);
value = importDefault(22) /* metro dependency 22 */;
value2 = value.get(object2, a2, []);
items2 = [];
arraySpread(items2, items3, arraySpread(items2, value2, 0, value), value);
value = importDefault(22) /* metro dependency 22 */;
value = value.set(object2, a2, items2);
r0 = value;
} else {
object = {};
copyDataProperties(object, a1, undefined);
object['attachments'] = items3;
r0 = object;
}
return r0;
function _fun40567(a0, a1) { // fn#40567, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4869:201, offset: 0x01105234, size: 71 bytes, params: 3, frame: 14
let value = environment.__proto__;
value = require(4651) /* metro dependency 4651: UploadUtils */;
const attachmentPayload = value.getAttachmentPayload(a0, a1);
const binding = env0_0;
const push = binding.push;
const object = {};
copyDataProperties(object, attachmentPayload, value);
Reflect.apply(push, binding, [object]);
}
function _prepareMessageRequestBodyCloud(a0, a1, a2) { // fn#40566, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4869:126, offset: 0x0110518e, size: 166 bytes, params: 4, frame: 21
var r0;
var object3;
var object4;
var value;
var value2;
var items2;
const items3 = [];
a0.forEach(_fun40567);
if (a2 == null) {
object3 = {};
copyDataProperties(object3, a1, undefined);
object3['attachments'] = items3;
r0 = object3;
} else if (a1 != null) {
object4 = {};
copyDataProperties(object4, a1, undefined);
value = importDefault(22) /* metro dependency 22 */;
value2 = value.get(object4, a2, []);
items2 = [];
arraySpread(items2, items3, arraySpread(items2, value2, 0, value), value);
value = importDefault(22) /* metro dependency 22 */;
value = value.set(object4, a2, items2);
r0 = value;
} else {
object3 = {};
copyDataProperties(object3, a1, undefined);
object3['attachments'] = items3;
r0 = object3;
}
return r0;
}
function getUploadPayload({filename, currentSize}) { // fn#40568, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4869:425, offset: 0x0110527b, size: 73 bytes, params: 2, frame: 12
const object2 = {};
object2.filename = filename;
object2.file_size = currentSize;
object2.id = (importDefault(22) /* metro dependency 22 */).uniqueId();
object2.original_content_type = undefined;
return object2;
}
function prepareMessagePayload(a0, a1, a2, a3) { // fn#40569, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4869:711, offset: 0x011052c4, size: 152 bytes, params: 5, frame: 18
const value2 = _prepareMessageRequestBodyCloud(a1, a2, a3);
const object = {Authorization: a0};
const getDebugOptionsHeaderValue = DeveloperOptionsStore.getDebugOptionsHeaderValue;
object['X-Debug-Options'] = Reflect.apply(getDebugOptionsHeaderValue, DeveloperOptionsStore, []);
object['Accept-Language'] = LocaleStore.locale;
const superPropertiesBase64 = (importDefault(683) /* metro dependency 683: AnalyticsUtils */).getSuperPropertiesBase64();
if (superPropertiesBase64 != null) {
object['X-Super-Properties'] = superPropertiesBase64;
function getUploadPayload({filename, currentSize}) { // fn#40568, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4869:425, offset: 0x0110527b, size: 73 bytes, params: 2, frame: 12
const object = {};
object.filename = filename;
object.file_size = currentSize;
object.id = (importDefault(22) /* metro dependency 22 */).uniqueId();
object.original_content_type = undefined;
return object;
}
const fingerprint = AuthenticationStore.getFingerprint();
if (fingerprint != null) {
object['X-Fingerprint'] = fingerprint;
function prepareMessagePayload(a0, a1, a2, a3) { // fn#40569, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4869:711, offset: 0x011052c4, size: 152 bytes, params: 5, frame: 18
const value2 = _prepareMessageRequestBodyCloud(a1, a2, a3);
const object2 = {Authorization: a0};
const developerOptionsStoreBinding = DeveloperOptionsStore;
const getDebugOptionsHeaderValue = developerOptionsStoreBinding.getDebugOptionsHeaderValue;
object2['X-Debug-Options'] = Reflect.apply(getDebugOptionsHeaderValue, developerOptionsStoreBinding, []);
object2['Accept-Language'] = LocaleStore.locale;
const superPropertiesBase64 = (AnalyticsUtils).getSuperPropertiesBase64();
if (superPropertiesBase64 != null) {
object2['X-Super-Properties'] = superPropertiesBase64;
}
const fingerprint = AuthenticationStore.getFingerprint();
if (fingerprint != null) {
object2['X-Fingerprint'] = fingerprint;
}
return {headers: object2, body: value2};
}
return {headers: object, body: value2};
}
function _fun40567(a0, a1) { // fn#40567, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4869:201, offset: 0x01105234, size: 71 bytes, params: 3, frame: 14
let value = environment.__proto__;
value = require(4651) /* metro dependency 4651: UploadUtils */;
const attachmentPayload = value.getAttachmentPayload(a0, a1);
const binding = env0_0;
const push = binding.push;
const object2 = {};
copyDataProperties(object2, attachmentPayload, value);
Reflect.apply(push, binding, [object2]);
}
global.__d(_fun40565, 4691, [1949, 1226, 691, 4651, 22, 683,
2]) /* metro module 4691, dependencies: [1949, 1226, 691, 4651, 22, 683, 2] */;
+105 -102
View File
@@ -1,116 +1,119 @@
/* Metro module 7226; source: lib/uploader/stageAttachmentFiles.tsx; dependencies: [5, 661, 4648, 2] */
import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
function _fun57848(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#57848, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7404:6, offset: 0x016b7999, size: 143 bytes, params: 8, frame: 18
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(5) /* metro dependency 5 */;
const env0_3 = (require(661) /* metro dependency 661: Constants */).AbortCodes;
(require(2) /* metro dependency 2 */).fileFinishedImporting('lib/uploader/stageAttachmentFiles.tsx');
(FileImportTrackerModule).fileFinishedImporting('lib/uploader/stageAttachmentFiles.tsx');
exports.default = function() {
return _stageAttachmentFiles.apply(this, arguments);
};
}
function _stageAttachmentFiles() { // fn#57849, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7404:127, offset: 0x016b7a28, size: 48 bytes, params: 1, frame: 14
return env0_2(_fun57851).apply(this, arguments);
}
async function _fun57851(a0) { // fn#57851, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7404:192, offset: 0x016b7a6a, size: 100 bytes, params: 2, frame: 15
let value = a1;
if (true) {
var env0_0 = value !== undefined ? value : false;
var env0_1 = a2;
await undefined;
if (false) {
return undefined;
}
value = a0.map(function(a0) {
var env0_0 = a0;
var Promise = global.Promise;
var value = Object.create(Promise.prototype, {constructor: {value: Promise}});
var value2 = new Promise(_fun57853);
return value2 instanceof Object ? value2 : value;
});
var Promise = global.Promise;
await Promise.all(value);
}
}
function _fun57852(a0) { // fn#57852, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7404:225, offset: 0x016b7ace, size: 44 bytes, params: 2, frame: 11
const env0_0 = a0;
const Promise = global.Promise;
const value = Object.create(Promise.prototype, {constructor: {value: Promise}});
const promise = new Promise(_fun57853);
return promise instanceof Object ? promise : value;
}
function _fun57853(a0, a1) { // fn#57853, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7404:241, offset: 0x016b7afa, size: 482 bytes, params: 3, frame: 19
var environment;
var Error;
var value3;
var error;
var value5;
var value7;
var value8;
const env0_0 = a0;
const env0_1 = a1;
const status = env0_0.status;
let binding = env4_0;
const CloudUploadStatus = binding(env4_1[2]).CloudUploadStatus;
const NOT_STARTED = CloudUploadStatus.NOT_STARTED;
if (NOT_STARTED === status) {
env0_0.upload();
} else if (env4_0(env4_1[2]).CloudUploadStatus.COMPLETED === status) {
a0('complete');
} else if (env4_0(env4_1[2]).CloudUploadStatus.ERROR === status) {
value7 = environment.__proto__;
if (env1_0) {
error = env0_0.error;
if (error !== env4_3.ENTITY_TOO_LARGE) {
env0_0.upload();
} else {
Error = global.Error;
value8 = Object.create(Error.prototype, {constructor: {value: Error}});
error = new Error('File failed to upload');
a1(error instanceof Object ? error : value8);
function _stageAttachmentFiles() { // fn#57849, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7404:127, offset: 0x016b7a28, size: 48 bytes, params: 1, frame: 14
return Module00005(_fun57851).apply(this, arguments);
async function _fun57851(a0) { // fn#57851, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7404:192, offset: 0x016b7a6a, size: 100 bytes, params: 2, frame: 15
let value = a1;
if (true) {
var env0_0 = value !== undefined ? value : false;
var env0_1 = a2;
await undefined;
if (false) {
return undefined;
}
value = a0.map(function(a0) {
var env0_0 = a0;
var Promise = global.Promise;
var value = Object.create(Promise.prototype, {constructor: {value: Promise}});
var value2 = new Promise(_fun57853);
return value2 instanceof Object ? value2 : value;
});
var Promise = global.Promise;
await Promise.all(value);
}
} else {
Error = global.Error;
value8 = Object.create(Error.prototype, {constructor: {value: Error}});
error = new Error('File failed to upload');
a1(error instanceof Object ? error : value8);
function _fun57852(a0) { // fn#57852, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7404:225, offset: 0x016b7ace, size: 44 bytes, params: 2, frame: 11
const env0_0 = a0;
const Promise = global.Promise;
const value = Object.create(Promise.prototype, {constructor: {value: Promise}});
const promise = new Promise(_fun57853);
return promise instanceof Object ? promise : value;
function _fun57853(a0, a1) { // fn#57853, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7404:241, offset: 0x016b7afa, size: 482 bytes, params: 3, frame: 19
var environment;
var Error;
var value3;
var error;
var value5;
var value7;
var value8;
const env0_0 = a0;
const env0_1 = a1;
const status = env0_0.status;
let binding = env4_0;
const CloudUploadStatus = binding(env4_1[2]).CloudUploadStatus;
const NOT_STARTED = CloudUploadStatus.NOT_STARTED;
if (NOT_STARTED === status) {
env0_0.upload();
} else if (env4_0(env4_1[2]).CloudUploadStatus.COMPLETED === status) {
a0('complete');
} else if (env4_0(env4_1[2]).CloudUploadStatus.ERROR === status) {
value7 = environment.__proto__;
if (env1_0) {
error = env0_0.error;
if (error !== env4_3.ENTITY_TOO_LARGE) {
env0_0.upload();
} else {
Error = global.Error;
value8 = Object.create(Error.prototype, {constructor: {value: Error}});
error = new Error('File failed to upload');
a1(error instanceof Object ? error : value8);
}
} else {
Error = global.Error;
value8 = Object.create(Error.prototype, {constructor: {value: Error}});
error = new Error('File failed to upload');
a1(error instanceof Object ? error : value8);
}
} else if (env4_0(env4_1[2]).CloudUploadStatus.CANCELED === status) {
Error = global.Error;
value5 = Object.create(Error.prototype, {constructor: {value: Error}});
error = new Error('Upload is canceled');
a1(error instanceof Object ? error : value5);
} else if (env4_0(env4_1[2]).CloudUploadStatus.REMOVED_FROM_MSG_DRAFT === status) {
Error = global.Error;
value3 = Object.create(Error.prototype, {constructor: {value: Error}});
error = new Error('Upload is removed from draft');
a1(error instanceof Object ? error : value3);
}
binding = env0_0;
binding.on('complete', _fun57854);
binding.on('error', _fun57855);
binding.on('progress', function(a0, a1) {
if (importDefault != null) {
importDefault(a0, a1);
}
});
function _fun57854() { // fn#57854, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7404:708, offset: 0x016b7cdc, size: 20 bytes, params: 1, frame: 11
env0_0('complete');
}
function _fun57855() { // fn#57855, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7404:744, offset: 0x016b7cf0, size: 85 bytes, params: 1, frame: 15
const Error = global.Error;
let value = environment.__proto__;
value = 'File ' + env1_0.id + ' failed to upload';
const value2 = Object.create(Error.prototype, {constructor: {value: Error}});
const error = new Error();
require(error instanceof Object ? error : value2);
}
}
}
}
} else if (env4_0(env4_1[2]).CloudUploadStatus.CANCELED === status) {
Error = global.Error;
value5 = Object.create(Error.prototype, {constructor: {value: Error}});
error = new Error('Upload is canceled');
a1(error instanceof Object ? error : value5);
} else if (env4_0(env4_1[2]).CloudUploadStatus.REMOVED_FROM_MSG_DRAFT === status) {
Error = global.Error;
value3 = Object.create(Error.prototype, {constructor: {value: Error}});
error = new Error('Upload is removed from draft');
a1(error instanceof Object ? error : value3);
}
binding = env0_0;
binding.on('complete', _fun57854);
binding.on('error', _fun57855);
binding.on('progress', function(a0, a1) {
if (importDefault != null) {
importDefault(a0, a1);
}
});
}
function _fun57854() { // fn#57854, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7404:708, offset: 0x016b7cdc, size: 20 bytes, params: 1, frame: 11
env0_0('complete');
}
function _fun57855() { // fn#57855, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7404:744, offset: 0x016b7cf0, size: 85 bytes, params: 1, frame: 15
const Error = global.Error;
let value = environment.__proto__;
value = 'File ' + env1_0.id + ' failed to upload';
const value2 = Object.create(Error.prototype, {constructor: {value: Error}});
const error = new Error();
require(error instanceof Object ? error : value2);
}
global.__d(_fun57848, 7226, [5, 661, 4648, 2]) /* metro module 7226, dependencies: [5, 661, 4648, 2] */;
File diff suppressed because it is too large. Load diff