302 lines
14 KiB
TypeScript
302 lines
14 KiB
TypeScript
/* Metro module 7223; source: stores/UploadStore.tsx; dependencies: [6, 7, 15, 17, 18, 4814, 566, 694, 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 Flux from '../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import MessageStore from './MessageStore.tsx'; /* Metro dependency 4814 */
|
|
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
|
|
function _fun57776(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#57776, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7401:6, offset: 0x016b5ea9, size: 514 bytes, params: 8, frame: 19
|
|
const clearLocalUriForUpload = function() {
|
|
env0_13 = {};
|
|
};
|
|
let Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_6 = RegExp('^(assets-library|ph|file):\\/\\/', '');
|
|
const env0_7 = RegExp('^content:\\/\\/', '');
|
|
Object = global.Object;
|
|
const env0_8 = Object.freeze([]);
|
|
const env0_9 = {};
|
|
const env0_10 = {};
|
|
const env0_11 = {};
|
|
const env0_12 = {};
|
|
let env0_13 = {};
|
|
const Store = (Flux).Store;
|
|
let value = _fun57787(Store);
|
|
value.displayName = 'UploadStore';
|
|
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: function() {
|
|
clearLocalUriForUpload();
|
|
}, LOGOUT: function() {
|
|
clearLocalUriForUpload();
|
|
}, UPLOAD_START: UPLOAD_START_57796, UPLOAD_COMPRESSION_PROGRESS: function({channelId, file}) {
|
|
updateFile(channelId, file);
|
|
}, UPLOAD_PROGRESS: function({channelId, file}) {
|
|
updateFile(channelId, file);
|
|
}, UPLOAD_COMPLETE: function({channelId, file}) {
|
|
return clearFile(channelId, file.id);
|
|
}, UPLOAD_FAIL: function({channelId, file}) {
|
|
return clearFile(channelId, file.id);
|
|
}, UPLOAD_CANCEL_REQUEST: UPLOAD_CANCEL_REQUEST_57801, UPLOAD_ITEM_CANCEL_REQUEST: UPLOAD_ITEM_CANCEL_REQUEST,
|
|
UPLOAD_FILE_UPDATE: UPLOAD_FILE_UPDATE, UPLOAD_RESTORE_FAILED_UPLOAD: UPLOAD_RESTORE_FAILED_UPLOAD});
|
|
(FileImportTrackerModule).fileFinishedImporting('stores/UploadStore.tsx');
|
|
exports.default = value;
|
|
function _isNativeReflectConstruct_57777() { // fn#57777, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7401:158, offset: 0x016b60ab, 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_57777_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function storeLocalUriForUpload(a0, a1) { // fn#57780, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7401:453, offset: 0x016b6109, size: 67 bytes, params: 3, frame: 15
|
|
const env0_0 = a1;
|
|
const binding = env0_13;
|
|
const items2 = a1.items;
|
|
const value = undefined;
|
|
let r2 = items2 == null ? value : items2.map(_fun57781);
|
|
r2 = r2 ?? [];
|
|
binding[a0] = r2;
|
|
return value;
|
|
function _fun57781(a0) { // fn#57781, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7401:544, offset: 0x016b614c, size: 174 bytes, params: 2, frame: 16
|
|
var r4;
|
|
var object;
|
|
var width;
|
|
var id;
|
|
const item = a0.item;
|
|
let value = environment.__proto__;
|
|
let binding = env1_6;
|
|
let test = binding.test;
|
|
let originalUri = item.originalUri;
|
|
if (Reflect.apply(test, binding, [originalUri])) {
|
|
object = {};
|
|
width = item.width;
|
|
value = 0;
|
|
object.width = width ?? value;
|
|
r4 = item.height ?? value;
|
|
object.height = r4;
|
|
originalUri = item.originalUri;
|
|
value = '';
|
|
r4 = originalUri ?? value;
|
|
object.localUri = r4;
|
|
id = require.id;
|
|
object.uploaderId = id;
|
|
id = a0.id;
|
|
object.uploaderItemId = id ?? value;
|
|
return object;
|
|
}
|
|
binding = env1_7;
|
|
test = binding.test;
|
|
originalUri = item.originalUri;
|
|
if (Reflect.apply(test, binding, [originalUri])) {
|
|
object = {};
|
|
width = item.width;
|
|
value = 0;
|
|
object.width = width ?? value;
|
|
r4 = item.height ?? value;
|
|
object.height = r4;
|
|
originalUri = item.originalUri;
|
|
value = '';
|
|
r4 = originalUri ?? value;
|
|
object.localUri = r4;
|
|
id = require.id;
|
|
object.uploaderId = id;
|
|
id = a0.id;
|
|
object.uploaderItemId = id ?? value;
|
|
return object;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function clearFile(a0, a1) { // fn#57783, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7401:820, offset: 0x016b6207, size: 95 bytes, params: 3, frame: 16
|
|
var r0;
|
|
const env0_0 = a1;
|
|
const property = env0_9[a0];
|
|
const value2 = property != null;
|
|
if (value2) {
|
|
env0_9[a0] = property.filter(function({id}) {
|
|
return id !== require;
|
|
});
|
|
delete env0_10[a1];
|
|
delete env0_11[a1];
|
|
r0 = property.length !== env0_9[a0].length;
|
|
} else {
|
|
r0 = value2;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function updateFile(a0, a1) { // fn#57785, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7401:949, offset: 0x016b6266, size: 145 bytes, params: 3, frame: 17
|
|
var object;
|
|
const env0_0 = a1;
|
|
const property = env0_9[a0];
|
|
if (property == null) {
|
|
return false;
|
|
}
|
|
let binding = env0_9;
|
|
binding[a0] = property.map(function(a0) {
|
|
var r0;
|
|
var object;
|
|
var value = a0;
|
|
var id = value.id;
|
|
if (id !== require.id) {
|
|
r0 = value;
|
|
} else {
|
|
object = {};
|
|
copyDataProperties(object, value, id);
|
|
copyDataProperties(object, require, id);
|
|
r0 = object;
|
|
}
|
|
return r0;
|
|
});
|
|
binding = env0_11;
|
|
let id = a1.id;
|
|
const property2 = binding[id];
|
|
if (property2 != null && env0_12[property2.id] != null) {
|
|
binding = env0_12;
|
|
id = property2.id;
|
|
object = {};
|
|
copyDataProperties(object, env0_12[property2.id], property);
|
|
copyDataProperties(object, a1, property);
|
|
binding[id] = object;
|
|
}
|
|
}
|
|
|
|
function _fun57787(a0) { // fn#57787, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7401:1120, offset: 0x016b632e, size: 162 bytes, params: 2, frame: 16
|
|
const UploadStore2 = UploadStore;
|
|
Inherits(UploadStore2, a0);
|
|
return CreateClass(UploadStore2, [{key: 'initialize', value: function() {
|
|
this.waitFor(MessageStore);
|
|
}}, {key: 'getFiles', value: value_57790}, {key: 'getMessageForFile', value: value_57791},
|
|
{key: 'getUploaderFileForMessageId', value: value_57792}, {key: 'getUploadAttachments', value: value_57793}]);
|
|
function UploadStore() { // fn#57788, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7401:1132, offset: 0x0108d31d, size: 113 bytes, params: 1, frame: 20
|
|
const value = environment.__proto__;
|
|
env1_0(this, UploadStore);
|
|
const value3 = env1_3(UploadStore);
|
|
return env1_2(this, _isNativeReflectConstruct_57777() ? global.Reflect.construct(value3, arguments,
|
|
env1_3(this).constructor) : value3.apply(this, arguments));
|
|
}
|
|
|
|
function value_57790(a0) { // fn#57790, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7401:1456, offset: 0x016b63d0, size: 26 bytes, params: 2, frame: 3
|
|
return env1_9[a0] ?? env1_8;
|
|
}
|
|
|
|
function value_57791(a0) { // fn#57791, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7401:1533, offset: 0x0108d3ec, size: 16 bytes, params: 2, frame: 2
|
|
return env1_11[a0];
|
|
}
|
|
|
|
function value_57792(a0) { // fn#57792, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7401:1600, offset: 0x00f8559b, size: 16 bytes, params: 2, frame: 2
|
|
return env1_12[a0];
|
|
}
|
|
|
|
function value_57793(a0) { // fn#57793, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7401:1660, offset: 0x016b63ea, size: 26 bytes, params: 2, frame: 2
|
|
var value;
|
|
if (a0 != null) {
|
|
value = environment.__proto__;
|
|
return env1_13[a0];
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function UPLOAD_START_57796({channelId, file, uploader, message}) { // fn#57796, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7401:1908, offset: 0x016b6413, size: 211 bytes, params: 2, frame: 19
|
|
var r8;
|
|
var binding;
|
|
var id;
|
|
var object;
|
|
var value2;
|
|
var items2;
|
|
if (!uploader._aborted) {
|
|
if (!uploader._errored) {
|
|
r8 = env0_9[channelId] ?? env0_8;
|
|
binding = env0_10;
|
|
id = file.id;
|
|
binding[id] = uploader;
|
|
binding = env0_9;
|
|
object = [];
|
|
value2 = arraySpread(object, r8, 0, r8);
|
|
object[value2] = file;
|
|
value2 + 1;
|
|
binding[channelId] = object;
|
|
if (message != null) {
|
|
binding = env0_11;
|
|
id = file.id;
|
|
binding[id] = message;
|
|
items2 = file.items;
|
|
if (items2 != null) {
|
|
binding = env0_12;
|
|
id = message.id;
|
|
object = {};
|
|
copyDataProperties(object, file, 0);
|
|
object['items'] = items2;
|
|
binding[id] = object;
|
|
}
|
|
storeLocalUriForUpload(message.nonce ?? message.id, file);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function UPLOAD_CANCEL_REQUEST_57801({file}) { // fn#57801, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7401:2583, offset: 0x016b6529, size: 63 bytes, params: 2, frame: 11
|
|
if (env0_10[file.id] == null) {
|
|
return false;
|
|
}
|
|
global.setImmediate(_fun57802);
|
|
function _fun57802() { // fn#57802, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7401:2669, offset: 0x016b6568, size: 40 bytes, params: 1, frame: 10
|
|
return ClassCallCheck.cancel?.();
|
|
}
|
|
|
|
}
|
|
|
|
function UPLOAD_ITEM_CANCEL_REQUEST({file, itemId}) { // fn#57803, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7401:2736, offset: 0x016b6590, size: 73 bytes, params: 2, frame: 11
|
|
if (env0_10[file.id] == null) {
|
|
return false;
|
|
}
|
|
global.setImmediate(_fun57804);
|
|
function _fun57804() { // fn#57804, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7401:2835, offset: 0x016b65d9, size: 26 bytes, params: 1, frame: 11
|
|
return CreateClass.cancelItem(itemId);
|
|
}
|
|
|
|
}
|
|
|
|
function UPLOAD_FILE_UPDATE({channelId, file}) { // fn#57805, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7401:2877, offset: 0x016b65f3, size: 77 bytes, params: 2, frame: 16
|
|
const property = env0_11[file.id];
|
|
if (property != null) {
|
|
storeLocalUriForUpload(property.nonce ?? property.id, file);
|
|
}
|
|
updateFile(channelId, file);
|
|
}
|
|
|
|
function UPLOAD_RESTORE_FAILED_UPLOAD({file, messageId}) { // fn#57806, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7401:3053, offset: 0x016b6640, size: 29 bytes, params: 2, frame: 3
|
|
env0_12[messageId] = file;
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun57776, 7223, [6, 7, 15, 17, 18, 4814, 566, 694,
|
|
2]) /* metro module 7223, dependencies: [6, 7, 15, 17, 18, 4814, 566, 694, 2] */;
|