363 lines
17 KiB
TypeScript
363 lines
17 KiB
TypeScript
/* Metro module 11943; source: modules/message_request/MessageRequestPreviewStore.tsx; dependencies: [6, 7, 15, 17, 18, 1878, 4621, 4622, 4625, 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 UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */
|
|
import MessageRequestStore from './MessageRequestStore.tsx'; /* Metro dependency 4621 */
|
|
import SpamMessageRequestStore from './SpamMessageRequestStore.tsx'; /* Metro dependency 4622 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
|
|
function _fun91663(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#91663, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12129:6, offset: 0x0206d381, size: 499 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_91669 = function(a0, a1) {
|
|
var r0;
|
|
var r1;
|
|
var r2;
|
|
var value3;
|
|
var length;
|
|
var value5;
|
|
var value = undefined;
|
|
var value2 = value == null;
|
|
reducibleJoin2: while (true) {
|
|
if (value2) {
|
|
r0 = value2;
|
|
break reducibleJoin2;
|
|
}
|
|
value3 = value > a0.length;
|
|
r0 = value3;
|
|
break reducibleJoin2;
|
|
}
|
|
reducibleJoin4: while (true) {
|
|
if (r0) {
|
|
length = a0.length;
|
|
r1 = length;
|
|
break reducibleJoin4;
|
|
}
|
|
r1 = value;
|
|
break reducibleJoin4;
|
|
}
|
|
value = (0, global.Array)(r1);
|
|
var value4 = 0;
|
|
if (value4 < r1) {
|
|
r2 = value4;
|
|
reducibleLoop5: while (true) {
|
|
value[r2] = a0[r2];
|
|
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
if (value5 < r1) {
|
|
r2 = value5;
|
|
continue reducibleLoop5;
|
|
}
|
|
break reducibleLoop5;
|
|
}
|
|
}
|
|
return value;
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_10 = {};
|
|
const Set = global.Set;
|
|
let set = new Set();
|
|
const Store = (Flux).Store;
|
|
_fun91672(Store).displayName = 'MessageRequestPreviewStore';
|
|
set = new set(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: CONNECTION_OPEN_91677,
|
|
CHANNEL_CREATE: CHANNEL_CREATE_91678, CHANNEL_UPDATES: CHANNEL_UPDATES_91679,
|
|
CHANNEL_DELETE: CHANNEL_DELETE_91680, MESSAGE_CREATE: function(a0) {
|
|
if (a0.isPushNotification) {
|
|
return false;
|
|
}
|
|
storeMessagePreview(a0.message.channel_id, a0.message);
|
|
}, MESSAGE_UPDATE: MESSAGE_UPDATE_91682, MESSAGE_DELETE: MESSAGE_DELETE_91683,
|
|
LOAD_MESSAGE_REQUESTS_SUPPLEMENTAL_DATA_SUCCESS: LOAD_MESSAGE_REQUESTS_SUPPLEMENTAL_DATA_SUCCESS,
|
|
LOAD_MESSAGE_REQUESTS_SUPPLEMENTAL_DATA_ERROR: function({requestedChannelIds}) {
|
|
requestedChannelIds.forEach(_fun91687);
|
|
}});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/message_request/MessageRequestPreviewStore.tsx');
|
|
exports.default = set;
|
|
function _isNativeReflectConstruct_91664() { // fn#91664, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12129:180, offset: 0x0206d574, 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_91664_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _createForOfIteratorHelperLoose_91667(a0, a1) { // fn#91667, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12129:373, offset: 0x0206d5d6, size: 372 bytes, params: 3, frame: 20
|
|
var r6;
|
|
var r9;
|
|
var r5;
|
|
var value3;
|
|
var regexp;
|
|
const env0_0 = a0;
|
|
const Symbol = global.Symbol;
|
|
let value = typeof Symbol !== 'undefined';
|
|
let r1 = value && a0[global.Symbol.iterator];
|
|
r1 = !r1 ? a0['@@iterator'] : r1;
|
|
if (r1) {
|
|
value = r1.call(a0);
|
|
return value.next.bind(value);
|
|
}
|
|
const Array = global.Array;
|
|
if (Array.isArray(a0)) {
|
|
if (r1) {
|
|
}
|
|
return _fun91668;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_91669(a0, value);
|
|
r5 = value;
|
|
} else {
|
|
value3 = ({}).toString.call(a0).slice(8, -1);
|
|
r6 = value3 === 'Object' && a0.constructor;
|
|
r9 = r6 ? a0.constructor.name : value3;
|
|
if (r9 === 'Map') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Set') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Arguments') {
|
|
value = _arrayLikeToArray_91669(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_91669(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun91668;
|
|
}
|
|
const TypeError = global.TypeError;
|
|
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
|
|
function _fun91668() { // fn#91668, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12129:944, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
|
|
return env0_1 >= env0_0.length ? {done: true} : {done: false,
|
|
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
|
|
}
|
|
|
|
}
|
|
|
|
function isMessagePreviewEnabledForChannel(a0) { // fn#91670, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12129:1302, offset: 0x0206d74a, size: 41 bytes, params: 2, frame: 12
|
|
return MessageRequestStore.isMessageRequest(a0) || SpamMessageRequestStore.isSpam(a0);
|
|
}
|
|
|
|
function storeMessagePreview(a0, a1) { // fn#91671, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12129:1390, offset: 0x0206d773, size: 123 bytes, params: 3, frame: 17
|
|
var value3;
|
|
const value = a2;
|
|
const value2 = undefined;
|
|
const r5 = value !== value2 ? value : false;
|
|
if (isMessagePreviewEnabledForChannel(a0)) {
|
|
value3 = null;
|
|
if (value3 == a1) {
|
|
env0_10[a0] = {loaded: true, error: r5,
|
|
message: value3 == a1 ? value3 : (require(4625) /* metro dependency 4625: MessageRecordUtils */).createMessageRecord(a1)};
|
|
} else if (a0 === (value3 == a1 ? value2 : a1.channel_id)) {
|
|
env0_10[a0] = {loaded: true, error: r5,
|
|
message: value3 == a1 ? value3 : (require(4625) /* metro dependency 4625: MessageRecordUtils */).createMessageRecord(a1)};
|
|
}
|
|
}
|
|
return value2;
|
|
}
|
|
|
|
function _fun91672(a0) { // fn#91672, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12129:1609, offset: 0x0206d7ee, size: 126 bytes, params: 2, frame: 16
|
|
const MessageRequestPreviewStore2 = MessageRequestPreviewStore;
|
|
Inherits(MessageRequestPreviewStore2, a0);
|
|
return CreateClass(MessageRequestPreviewStore2, [{key: 'initialize', value: function() {
|
|
this.waitFor(MessageRequestStore, SpamMessageRequestStore, UserStore);
|
|
}}, {key: 'shouldLoadMessageRequestPreview', value: value_91675}, {key: 'getMessageRequestPreview',
|
|
value: value_91676}]);
|
|
function MessageRequestPreviewStore() { // fn#91673, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12129:1621, offset: 0x00de700a, size: 113 bytes, params: 1, frame: 20
|
|
const value = environment.__proto__;
|
|
env1_2(this, MessageRequestPreviewStore);
|
|
const value3 = env1_5(MessageRequestPreviewStore);
|
|
return env1_4(this, _isNativeReflectConstruct_91664() ? global.Reflect.construct(value3, arguments,
|
|
env1_5(this).constructor) : value3.apply(this, arguments));
|
|
}
|
|
|
|
function value_91675(a0) { // fn#91675, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12129:2047, offset: 0x0206d88f, size: 25 bytes, params: 2, frame: 11
|
|
const binding = env1_11;
|
|
return !binding.has(a0);
|
|
}
|
|
|
|
function value_91676(a0) { // fn#91676, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12129:2115, offset: 0x0206d8a8, size: 49 bytes, params: 2, frame: 4
|
|
if (!(a0 in env1_10)) {
|
|
env1_10[a0] = {'loaded': false, 'error': false, 'message': null};
|
|
}
|
|
return env1_10[a0];
|
|
}
|
|
|
|
}
|
|
|
|
function CONNECTION_OPEN_91677() { // fn#91677, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12129:2289, offset: 0x0206d8d9, size: 27 bytes, params: 1, frame: 9
|
|
env0_10 = {};
|
|
env0_11.clear();
|
|
}
|
|
|
|
function CHANNEL_CREATE_91678({channel}) { // fn#91678, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12129:2352, offset: 0x0206d8f4, size: 51 bytes, params: 2, frame: 13
|
|
var binding;
|
|
if (isMessagePreviewEnabledForChannel(channel.id)) {
|
|
binding = env0_11;
|
|
binding.add(channel.id);
|
|
}
|
|
}
|
|
|
|
function CHANNEL_UPDATES_91679({channels}) { // fn#91679, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12129:2464, offset: 0x0206d927, size: 106 bytes, params: 2, frame: 16
|
|
var r2;
|
|
var value4;
|
|
var isMessagePreviewEnabledForChannelBinding;
|
|
var id;
|
|
var binding;
|
|
var value5;
|
|
const value2 = _createForOfIteratorHelperLoose_91667(channels);
|
|
const value3 = value2();
|
|
let done = value3.done;
|
|
if (!done) {
|
|
r2 = value3;
|
|
while (true) {
|
|
value4 = r2.value;
|
|
isMessagePreviewEnabledForChannelBinding = isMessagePreviewEnabledForChannel;
|
|
id = value4.id;
|
|
if (!isMessagePreviewEnabledForChannelBinding(id)) {
|
|
binding = env0_11;
|
|
id = value4.id;
|
|
binding.delete(id);
|
|
binding = env0_10;
|
|
id = value4.id;
|
|
delete binding[id];
|
|
}
|
|
value5 = value2();
|
|
done = value5.done;
|
|
if (done) {
|
|
break;
|
|
}
|
|
r2 = value5;
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
|
|
function CHANNEL_DELETE_91680({channel}) { // fn#91680, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12129:2675, offset: 0x0206d991, size: 47 bytes, params: 2, frame: 13
|
|
env0_11.delete(channel.id);
|
|
delete env0_10[channel.id];
|
|
}
|
|
|
|
function MESSAGE_UPDATE_91682(a0) { // fn#91682, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12129:2896, offset: 0x0206d9f0, size: 133 bytes, params: 2, frame: 19
|
|
var r1;
|
|
var r0;
|
|
var value3;
|
|
var binding;
|
|
var object;
|
|
var moduleValue;
|
|
const channel_id = a0.message.channel_id;
|
|
if (channel_id == null) {
|
|
return false;
|
|
}
|
|
var value;
|
|
const property = env0_10[channel_id];
|
|
const value2 = property != null;
|
|
if (value2) {
|
|
value3 = property.message != null;
|
|
if (value3) {
|
|
binding = env0_10;
|
|
object = {};
|
|
copyDataProperties(object, property, undefined);
|
|
value = undefined;
|
|
moduleValue = require(4625) /* metro dependency 4625: MessageRecordUtils */;
|
|
object['message'] = moduleValue.updateMessageRecord(property.message, a0.message);
|
|
binding[channel_id] = object;
|
|
r1 = value;
|
|
} else {
|
|
r1 = value3;
|
|
}
|
|
r0 = r1;
|
|
} else {
|
|
r0 = value2;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function MESSAGE_DELETE_91683(a0) { // fn#91683, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12129:3113, offset: 0x0206da75, size: 58 bytes, params: 2, frame: 13
|
|
if (isMessagePreviewEnabledForChannel(a0.channelId)) {
|
|
env0_10[a0.channelId] = {'loaded': true, 'error': false, 'message': null};
|
|
return undefined;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function LOAD_MESSAGE_REQUESTS_SUPPLEMENTAL_DATA_SUCCESS({requestedChannelIds, supplementalData}) { // fn#91684, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12129:3303, offset: 0x0206daaf, size: 147 bytes, params: 2, frame: 17
|
|
var r2;
|
|
const Set = global.Set;
|
|
const items2 = [];
|
|
let value = 0;
|
|
arraySpread(items2, requestedChannelIds, value, Set);
|
|
const set = new Set(items2);
|
|
supplementalData.forEach(_fun91685);
|
|
const Array = global.Array;
|
|
const value4 = Array.from(set);
|
|
let length = value4.length;
|
|
if (value < length) {
|
|
for (r2 = value; true; r2 = value) {
|
|
storeMessagePreview(value4[r2], null);
|
|
value = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
length = value4.length;
|
|
if (!(value < length)) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
function _fun91685(a0) { // fn#91685, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12129:3438, offset: 0x0206db42, size: 53 bytes, params: 2, frame: 14
|
|
storeMessagePreview(a0.channel_id, a0.message_preview);
|
|
env0_0.delete(a0.channel_id);
|
|
}
|
|
|
|
}
|
|
|
|
function LOAD_MESSAGE_REQUESTS_SUPPLEMENTAL_DATA_ERROR({requestedChannelIds}) { // fn#91686, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12129:3643, offset: 0x0206db77, size: 32 bytes, params: 2, frame: 11
|
|
requestedChannelIds.forEach(function(a0) {
|
|
storeMessagePreview(a0, null, true);
|
|
});
|
|
function _fun91687(a0) { // fn#91687, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12129:3735, offset: 0x0206db97, size: 25 bytes, params: 2, frame: 15
|
|
storeMessagePreview(a0, null, true);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun91663, 11943, [6, 7, 15, 17, 18, 1878, 4621, 4622, 4625, 566, 694,
|
|
2]) /* metro module 11943, dependencies: [6, 7, 15, 17, 18, 1878, 4621, 4622, 4625, 566, 694, 2] */;
|