870 lines
32 KiB
TypeScript
870 lines
32 KiB
TypeScript
/* Metro module 12564; source: modules/messages/GuildOfficialMessagesStore.tsx; dependencies: [6, 7, 15, 17, 18, 1379, 1945, 1867, 3793, 1878, 661, 4625, 1391, 566, 694, 2] */
|
|
function _fun96174(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#96174, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:6, offset: 0x02157149, size: 636 bytes, params: 8, frame: 21
|
|
let env0_0 = require;
|
|
const _arrayLikeToArray_96180 = 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 prependRecord = function(a0, a1) {
|
|
var env0_0 = a1;
|
|
updateGuildState(a0, _fun96184);
|
|
};
|
|
const updateMessage_96185 = function(a0, a1) {
|
|
var env0_0 = a1;
|
|
updateGuildState(a0, _fun96186);
|
|
};
|
|
const closure = CHANNEL_DELETE_96187;
|
|
const closure2 = RELATIONSHIP_ADD_96189;
|
|
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 */;
|
|
const env0_4 = importDefault(15) /* metro dependency 15 */;
|
|
const env0_5 = importDefault(17) /* metro dependency 17 */;
|
|
const env0_6 = importDefault(18) /* metro dependency 18 */;
|
|
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
|
|
const guildMemberStore = importDefault(1945) /* metro dependency 1945: GuildMemberStore */;
|
|
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
|
|
const relationshipStore = importDefault(3793) /* metro dependency 3793: RelationshipStore */;
|
|
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
|
|
const env0_12 = (require(661) /* metro dependency 661: Constants */).MessageFlags;
|
|
let env0_13 = {};
|
|
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
|
|
let value = _fun96190(Store);
|
|
value.displayName = 'GuildOfficialMessagesStore';
|
|
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: function() {
|
|
env0_13 = {};
|
|
}, LOAD_OFFICIAL_MESSAGES: LOAD_OFFICIAL_MESSAGES, LOAD_OFFICIAL_MESSAGES_SUCCESS: LOAD_OFFICIAL_MESSAGES_SUCCESS,
|
|
LOAD_OFFICIAL_MESSAGES_FAILURE: LOAD_OFFICIAL_MESSAGES_FAILURE, GUILD_DELETE: GUILD_DELETE_96208,
|
|
CHANNEL_DELETE: closure, THREAD_DELETE: closure, MESSAGE_CREATE: MESSAGE_CREATE_96209,
|
|
MESSAGE_UPDATE: MESSAGE_UPDATE_96210, MESSAGE_REACTION_ADD: MESSAGE_REACTION_ADD_96213,
|
|
MESSAGE_REACTION_REMOVE: MESSAGE_REACTION_REMOVE, MESSAGE_REACTION_REMOVE_ALL: function({channelId,
|
|
messageId}) {
|
|
var message = findMessage(channelId, messageId);
|
|
if (message == null) {
|
|
return false;
|
|
}
|
|
updateMessage_96185(message.guildId, message.message.set('reactions', []));
|
|
}, MESSAGE_REACTION_REMOVE_EMOJI: function({channelId, messageId, emoji}) {
|
|
var message = findMessage(channelId, messageId);
|
|
if (message == null) {
|
|
return false;
|
|
}
|
|
updateMessage_96185(message.guildId, message.message.removeReactionsForEmoji(emoji));
|
|
}, MESSAGE_DELETE: MESSAGE_DELETE_96217, MESSAGE_DELETE_BULK: MESSAGE_DELETE_BULK_96220, RELATIONSHIP_ADD: closure2,
|
|
RELATIONSHIP_REMOVE: closure2, RELATIONSHIP_UPDATE: closure2});
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/messages/GuildOfficialMessagesStore.tsx');
|
|
exports.default = value;
|
|
}
|
|
|
|
function _isNativeReflectConstruct_96175() { // fn#96175, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:248, offset: 0x021573c5, 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_96175_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _createForOfIteratorHelperLoose_96178(a0, a1) { // fn#96178, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:441, offset: 0x02157427, 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 _fun96179;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_96180(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_96180(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_96180(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun96179;
|
|
}
|
|
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 findMessage(a0, a1) { // fn#96181, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:1360, offset: 0x0215759b, size: 98 bytes, params: 3, frame: 13
|
|
const channel = ChannelStore.getChannel(a0);
|
|
const value3 = null;
|
|
const r4 = value3 == channel ? undefined : channel.getGuildId();
|
|
if (value3 == r4) {
|
|
return value3;
|
|
}
|
|
let property = env0_13[r4];
|
|
if (value3 == property) {
|
|
return value3;
|
|
}
|
|
property = property.messages[a1];
|
|
return value3 == property ? value3 : {guildId: r4, message: property};
|
|
}
|
|
|
|
function updateGuildState(a0, a1) { // fn#96182, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:1561, offset: 0x021575fd, size: 75 bytes, params: 3, frame: 16
|
|
var object3;
|
|
var object4;
|
|
const property = env0_13[a0];
|
|
if (property != null) {
|
|
object3 = {};
|
|
copyDataProperties(object3, env0_13, property);
|
|
object4 = {};
|
|
copyDataProperties(object4, property, property);
|
|
copyDataProperties(object4, a1(property), property);
|
|
object3[a0] = object4;
|
|
}
|
|
}
|
|
|
|
function prependRecord(a0, a1) { // fn#96183, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:1642, offset: 0x02157648, size: 36 bytes, params: 3, frame: 13
|
|
const env0_0 = a1;
|
|
updateGuildState(a0, function(a0) {
|
|
var r5;
|
|
var object = {};
|
|
var items = [require.id];
|
|
arraySpread(items, a0.ids, 1, r5);
|
|
object.ids = items;
|
|
var object2 = {};
|
|
copyDataProperties(object2, a0.messages, 1);
|
|
object2[require.id] = require;
|
|
object.messages = object2;
|
|
return object;
|
|
});
|
|
}
|
|
|
|
function updateMessage_96185(a0, a1) { // fn#96185, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:1753, offset: 0x021576ba, size: 36 bytes, params: 3, frame: 13
|
|
const env0_0 = a1;
|
|
updateGuildState(a0, function(a0) {
|
|
var r3;
|
|
var object2 = {};
|
|
copyDataProperties(object2, a0.messages, r3);
|
|
object2[require.id] = require;
|
|
return {messages: object2};
|
|
});
|
|
}
|
|
|
|
function CHANNEL_DELETE_96187({channel}) { // fn#96187, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:1844, offset: 0x0215770a, size: 226 bytes, params: 2, frame: 24
|
|
var r7;
|
|
var channel_id;
|
|
var value5;
|
|
var property2;
|
|
var id;
|
|
var value6;
|
|
const guild_id = channel.guild_id;
|
|
if (guild_id == null) {
|
|
return false;
|
|
}
|
|
const property = env0_13[guild_id];
|
|
if (property == null) {
|
|
return false;
|
|
}
|
|
const items2 = [];
|
|
const object2 = {};
|
|
let messages = property.messages;
|
|
copyDataProperties(object2, messages, undefined);
|
|
const value3 = _createForOfIteratorHelperLoose_96178(property.ids);
|
|
const value4 = value3();
|
|
let done = value4.done;
|
|
if (!done) {
|
|
r7 = value4;
|
|
while (true) {
|
|
value5 = r7.value;
|
|
messages = property.messages;
|
|
property2 = messages[value5];
|
|
channel_id = property2?.channel_id;
|
|
id = channel.id;
|
|
if (channel_id === id) {
|
|
delete object2[value5];
|
|
} else {
|
|
items2.push(value5);
|
|
}
|
|
value6 = value3();
|
|
done = value6.done;
|
|
if (done) {
|
|
break;
|
|
}
|
|
r7 = value6;
|
|
continue;
|
|
}
|
|
}
|
|
if (items2.length === property.ids.length) {
|
|
return false;
|
|
}
|
|
updateGuildState(guild_id, _fun96188);
|
|
}
|
|
|
|
function RELATIONSHIP_ADD_96189() { // fn#96189, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:2218, offset: 0x02157805, size: 382 bytes, params: 1, frame: 41
|
|
var r10;
|
|
var r14;
|
|
var r21;
|
|
var r22;
|
|
var r25;
|
|
var r28;
|
|
var r18;
|
|
var r16;
|
|
var r4;
|
|
var property;
|
|
var property2;
|
|
var _createForOfIteratorHelperLoose_96178Binding;
|
|
var ids;
|
|
var value6;
|
|
var value7;
|
|
var done;
|
|
var value8;
|
|
var messages;
|
|
var property3;
|
|
var isBlockedForMessage2;
|
|
var isIgnoredForMessage2;
|
|
var blocked;
|
|
var value9;
|
|
var ignored;
|
|
var value10;
|
|
var object3;
|
|
var merge;
|
|
var value11;
|
|
var object5;
|
|
var value12;
|
|
var value13;
|
|
const object6 = {};
|
|
const Object = global.Object;
|
|
const value2 = Object.keys(env0_13);
|
|
let length = value2.length;
|
|
const value3 = 0;
|
|
const value4 = false;
|
|
const value5 = null;
|
|
if (value3 < length) {
|
|
r10 = value4;
|
|
r14 = value3;
|
|
while (true) {
|
|
property = value2[r14];
|
|
property2 = env0_13[property];
|
|
_createForOfIteratorHelperLoose_96178Binding = _createForOfIteratorHelperLoose_96178;
|
|
ids = property2.ids;
|
|
value6 = _createForOfIteratorHelperLoose_96178Binding(ids);
|
|
value7 = value6();
|
|
done = value7.done;
|
|
if (done) {
|
|
r18 = value5;
|
|
} else {
|
|
r21 = value5;
|
|
r22 = value7;
|
|
while (true) {
|
|
value8 = r22.value;
|
|
messages = property2.messages;
|
|
property3 = messages[value8];
|
|
if (value5 != property3) {
|
|
isBlockedForMessage2 = RelationshipStore.isBlockedForMessage(property3);
|
|
isIgnoredForMessage2 = RelationshipStore.isIgnoredForMessage(property3);
|
|
blocked = property3.blocked;
|
|
value9 = blocked === isBlockedForMessage2;
|
|
if (!value9) {
|
|
r25 = value9;
|
|
continue;
|
|
}
|
|
ignored = property3.ignored;
|
|
value10 = ignored === isIgnoredForMessage2;
|
|
r25 = value10;
|
|
if (r25) {
|
|
r28 = r21;
|
|
break;
|
|
}
|
|
if (value5 != r21) {
|
|
r25 = r21;
|
|
continue;
|
|
}
|
|
object3 = {};
|
|
messages = property2.messages;
|
|
copyDataProperties(object3, messages, undefined);
|
|
r25 = object3;
|
|
merge = property3.merge;
|
|
r25[value8] = Reflect.apply(merge, property3, [{blocked: isBlockedForMessage2,
|
|
ignored: isIgnoredForMessage2}]);
|
|
r28 = r25;
|
|
break;
|
|
}
|
|
r28 = r21;
|
|
value11 = value6();
|
|
done = value11.done;
|
|
if (done) {
|
|
r18 = r28;
|
|
break;
|
|
}
|
|
r21 = r28;
|
|
r22 = value11;
|
|
continue;
|
|
}
|
|
}
|
|
if (value5 == r18) {
|
|
object6[property] = property2;
|
|
r16 = r10;
|
|
} else {
|
|
object5 = {};
|
|
copyDataProperties(object5, property2, undefined);
|
|
object5['messages'] = r18;
|
|
object6[property] = object5;
|
|
value12 = true;
|
|
r16 = value12;
|
|
}
|
|
value13 = typeof r14 === 'bigint' ? r14 + 1n : +r14 + 1;
|
|
length = value2.length;
|
|
if (value13 < length) {
|
|
r10 = r16;
|
|
r14 = value13;
|
|
continue;
|
|
}
|
|
r4 = r16;
|
|
break;
|
|
}
|
|
} else {
|
|
r4 = value4;
|
|
}
|
|
if (r4) {
|
|
return undefined;
|
|
}
|
|
return value4;
|
|
}
|
|
|
|
function _fun96190(a0) { // fn#96190, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:2665, offset: 0x02157983, size: 222 bytes, params: 2, frame: 16
|
|
const closure = GuildOfficialMessagesStore;
|
|
env0_6(closure, a0);
|
|
return env0_3(closure, [{key: 'initialize', value: function() {
|
|
this.waitFor(ChannelStore, GuildMemberStore, GuildStore, RelationshipStore, UserStore);
|
|
}}, {key: 'getState', value: value_96193}, {key: 'getMessage', value: value_96194}, {key: 'getMessages',
|
|
value: value_96195}, {key: 'isLoading', value: value_96198}, {key: 'isLoaded', value: value_96199},
|
|
{key: 'hasMore', value: value_96200}]);
|
|
}
|
|
|
|
function LOAD_OFFICIAL_MESSAGES({guildId, before}) { // fn#96202, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:3770, offset: 0x02157b6a, size: 167 bytes, params: 2, frame: 18
|
|
var object2;
|
|
var object4;
|
|
const property = env0_13[guildId];
|
|
if (property?.loading === true) {
|
|
return false;
|
|
}
|
|
if (before != null) {
|
|
if (property == null) {
|
|
return false;
|
|
}
|
|
object2 = {};
|
|
copyDataProperties(object2, env0_13, undefined);
|
|
object4 = {};
|
|
copyDataProperties(object4, property, undefined);
|
|
object4['loading'] = true;
|
|
object2[guildId] = object4;
|
|
env0_13 = object2;
|
|
} else {
|
|
object2 = {};
|
|
copyDataProperties(object2, env0_13, undefined);
|
|
object2[guildId] = {'ids': null, 'messages': null, 'hasMore': false, 'loading': true, 'loaded': false,
|
|
'error': false, ids: [], messages: {}};
|
|
}
|
|
}
|
|
|
|
function LOAD_OFFICIAL_MESSAGES_SUCCESS({guildId, messages, hasMore, before}) { // fn#96203, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:4058, offset: 0x02157c11, size: 82 bytes, params: 2, frame: 14
|
|
if (env0_13[guildId] == null) {
|
|
return false;
|
|
}
|
|
updateGuildState(guildId, _fun96204);
|
|
}
|
|
|
|
function LOAD_OFFICIAL_MESSAGES_FAILURE({guildId, before}) { // fn#96205, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:4494, offset: 0x02157d49, size: 71 bytes, params: 2, frame: 15
|
|
if (env0_13[guildId] == null) {
|
|
return false;
|
|
}
|
|
updateGuildState(guildId, before != null ? function() {
|
|
return {loading: false};
|
|
} : _fun96207);
|
|
}
|
|
|
|
function GUILD_DELETE_96208({guild}) { // fn#96208, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:4671, offset: 0x02157dab, size: 64 bytes, params: 2, frame: 13
|
|
const property = env0_13[guild.id];
|
|
if (property == null) {
|
|
return false;
|
|
}
|
|
const object2 = {};
|
|
copyDataProperties(object2, env0_13, property);
|
|
delete object2[guild.id];
|
|
}
|
|
|
|
function MESSAGE_CREATE_96209({message, guildId, optimistic, isPushNotification}) { // fn#96209, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:4852, offset: 0x02157deb, size: 206 bytes, params: 2, frame: 19
|
|
var r0;
|
|
var property;
|
|
var value4;
|
|
var value5;
|
|
var prependRecordBinding;
|
|
if (!optimistic) {
|
|
if (isPushNotification) {
|
|
return false;
|
|
}
|
|
if (guildId == null) {
|
|
return false;
|
|
}
|
|
var value;
|
|
var value2 = undefined;
|
|
var moduleValue = require(1391) /* metro dependency 1391: FlagUtils */;
|
|
var hasFlag = moduleValue.hasFlag;
|
|
var r1 = message.flags ?? 0;
|
|
var IS_GUILD_OFFICIAL = MessageFlags.IS_GUILD_OFFICIAL;
|
|
if (Reflect.apply(hasFlag, moduleValue, [r1, IS_GUILD_OFFICIAL])) {
|
|
property = env0_13[guildId];
|
|
value4 = property != null;
|
|
if (value4) {
|
|
value5 = property.messages[message.id] == null;
|
|
if (value5) {
|
|
prependRecordBinding = prependRecord;
|
|
value = require(4625) /* metro dependency 4625: MessageRecordUtils */;
|
|
prependRecordBinding(guildId, value.createMessageRecord(message));
|
|
r1 = value2;
|
|
} else {
|
|
r1 = value5;
|
|
}
|
|
r0 = r1;
|
|
} else {
|
|
r0 = value4;
|
|
}
|
|
return r0;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function MESSAGE_UPDATE_96210({message}) { // fn#96210, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:5168, offset: 0x02157eb9, size: 385 bytes, params: 2, frame: 21
|
|
var r0;
|
|
var updateMessage_96185Binding;
|
|
var moduleValue2;
|
|
var prependRecordBinding;
|
|
var moduleValue3;
|
|
var value6;
|
|
var moduleValue4;
|
|
let id = message.id;
|
|
if (id == null) {
|
|
return false;
|
|
}
|
|
const guildId = ChannelStore.getChannel(message.channel_id)?.getGuildId();
|
|
if (guildId == null) {
|
|
return false;
|
|
}
|
|
let property = env0_13[guildId];
|
|
if (property == null) {
|
|
return false;
|
|
}
|
|
property = property.messages[message.id];
|
|
if (message.author == null) {
|
|
value6 = property != null;
|
|
if (value6) {
|
|
updateMessage_96185Binding = updateMessage_96185;
|
|
moduleValue4 = require(4625) /* metro dependency 4625: MessageRecordUtils */;
|
|
updateMessage_96185Binding(guildId, moduleValue4.updateMessageRecord(property, message));
|
|
r0 = undefined;
|
|
} else {
|
|
r0 = value6;
|
|
}
|
|
return r0;
|
|
}
|
|
const flagUtilsModule = require(1391) /* metro dependency 1391: FlagUtils */;
|
|
const hasFlag = flagUtilsModule.hasFlag;
|
|
const r8 = message.flags ?? 0;
|
|
const IS_GUILD_OFFICIAL = MessageFlags.IS_GUILD_OFFICIAL;
|
|
const hasFlag2 = Reflect.apply(hasFlag, flagUtilsModule, [r8, IS_GUILD_OFFICIAL]);
|
|
if (hasFlag2) {
|
|
if (property == null) {
|
|
prependRecordBinding = prependRecord;
|
|
moduleValue3 = require(4625) /* metro dependency 4625: MessageRecordUtils */;
|
|
prependRecordBinding(guildId, moduleValue3.createMessageRecord(message));
|
|
return undefined;
|
|
}
|
|
}
|
|
if (hasFlag2) {
|
|
if (hasFlag2) {
|
|
if (property == null) {
|
|
return false;
|
|
}
|
|
updateMessage_96185Binding = updateMessage_96185;
|
|
moduleValue2 = require(4625) /* metro dependency 4625: MessageRecordUtils */;
|
|
updateMessage_96185Binding(guildId, moduleValue2.updateMessageRecord(property, message));
|
|
return undefined;
|
|
}
|
|
return false;
|
|
}
|
|
if (property == null) {
|
|
if (hasFlag2) {
|
|
if (property == null) {
|
|
return false;
|
|
}
|
|
updateMessage_96185Binding = updateMessage_96185;
|
|
moduleValue2 = require(4625) /* metro dependency 4625: MessageRecordUtils */;
|
|
updateMessage_96185Binding(guildId, moduleValue2.updateMessageRecord(property, message));
|
|
return undefined;
|
|
}
|
|
return false;
|
|
}
|
|
id = message.id;
|
|
updateGuildState(guildId, function(a0) {
|
|
var r4;
|
|
var object = {};
|
|
copyDataProperties(object, a0.messages, r4);
|
|
delete object[id];
|
|
var object2 = {};
|
|
object2.ids = a0.ids.filter(_fun96212);
|
|
object2.messages = object;
|
|
return object2;
|
|
});
|
|
}
|
|
|
|
function MESSAGE_REACTION_ADD_96213({channelId, messageId, userId, emoji, optimistic, reactionType, colors}) { // fn#96213, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:5845, offset: 0x0215807e, size: 154 bytes, params: 2, frame: 24
|
|
var message;
|
|
const value4 = UserStore.getCurrentUser()?.id === userId;
|
|
if (optimistic) {
|
|
if (value4) {
|
|
message = findMessage(channelId, messageId);
|
|
if (message == null) {
|
|
return false;
|
|
}
|
|
updateMessage_96185(message.guildId, message.message.addReaction(emoji, value4, colors, reactionType));
|
|
return undefined;
|
|
}
|
|
return false;
|
|
}
|
|
message = findMessage(channelId, messageId);
|
|
if (message == null) {
|
|
return false;
|
|
}
|
|
updateMessage_96185(message.guildId, message.message.addReaction(emoji, value4, colors, reactionType));
|
|
}
|
|
|
|
function MESSAGE_REACTION_REMOVE({channelId, messageId, userId, emoji, optimistic, reactionType}) { // fn#96214, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:6165, offset: 0x02158118, size: 137 bytes, params: 2, frame: 22
|
|
var message;
|
|
const value4 = UserStore.getCurrentUser()?.id === userId;
|
|
if (optimistic) {
|
|
if (value4) {
|
|
message = findMessage(channelId, messageId);
|
|
if (message == null) {
|
|
return false;
|
|
}
|
|
updateMessage_96185(message.guildId, message.message.removeReaction(emoji, value4, reactionType));
|
|
return undefined;
|
|
}
|
|
return false;
|
|
}
|
|
message = findMessage(channelId, messageId);
|
|
if (message == null) {
|
|
return false;
|
|
}
|
|
updateMessage_96185(message.guildId, message.message.removeReaction(emoji, value4, reactionType));
|
|
}
|
|
|
|
function MESSAGE_DELETE_96217({id, guildId}) { // fn#96217, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:6894, offset: 0x0215823d, size: 91 bytes, params: 2, frame: 19
|
|
var r1;
|
|
var r0;
|
|
var property;
|
|
var value2;
|
|
var value3;
|
|
const value = guildId != null;
|
|
if (value) {
|
|
property = env0_13[guildId];
|
|
value2 = undefined;
|
|
r1 = property == null ? value2 : property.messages[id];
|
|
value3 = r1 != null;
|
|
if (value3) {
|
|
updateGuildState(guildId, function(a0) {
|
|
var r4;
|
|
var object = {};
|
|
copyDataProperties(object, a0.messages, r4);
|
|
delete object[id];
|
|
var object2 = {};
|
|
object2.ids = a0.ids.filter(_fun96219);
|
|
object2.messages = object;
|
|
return object2;
|
|
});
|
|
r1 = value2;
|
|
} else {
|
|
r1 = value3;
|
|
}
|
|
r0 = r1;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function MESSAGE_DELETE_BULK_96220({ids, guildId}) { // fn#96220, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:7146, offset: 0x021582dc, size: 253 bytes, params: 2, frame: 19
|
|
var r5;
|
|
var value7;
|
|
var has;
|
|
var value8;
|
|
if (guildId == null) {
|
|
return false;
|
|
}
|
|
const property = env0_13[guildId];
|
|
if (property == null) {
|
|
return false;
|
|
}
|
|
const Set = global.Set;
|
|
const set = new Set(ids);
|
|
if (property.ids.filter(_fun96221).length === property.ids.length) {
|
|
return false;
|
|
}
|
|
const object2 = {};
|
|
copyDataProperties(object2, property.messages, undefined);
|
|
const value5 = _createForOfIteratorHelperLoose_96178(property.ids);
|
|
const value6 = value5();
|
|
let done = value6.done;
|
|
if (!done) {
|
|
r5 = value6;
|
|
while (true) {
|
|
value7 = r5.value;
|
|
has = set.has;
|
|
if (Reflect.apply(has, set, [value7])) {
|
|
delete object2[value7];
|
|
}
|
|
value8 = value5();
|
|
done = value8.done;
|
|
if (done) {
|
|
break;
|
|
}
|
|
r5 = value8;
|
|
continue;
|
|
}
|
|
}
|
|
updateGuildState(guildId, _fun96222);
|
|
}
|
|
|
|
function _fun96188() { // fn#96188, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:2191, offset: 0x021577ec, size: 25 bytes, params: 1, frame: 3
|
|
return {ids: env0_0, messages: env0_1};
|
|
}
|
|
|
|
function value_96194(a0, a1) { // fn#96194, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:3134, offset: 0x02157a61, size: 40 bytes, params: 3, frame: 3
|
|
const value = environment.__proto__;
|
|
const property = env1_13[a0];
|
|
return property == null ? undefined : property.messages[a1];
|
|
}
|
|
|
|
function value_96195(a0) { // fn#96195, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:3224, offset: 0x02157a89, size: 74 bytes, params: 2, frame: 12
|
|
var environment;
|
|
var r0;
|
|
let value = environment.__proto__;
|
|
const property = env1_13[a0];
|
|
if (property == null) {
|
|
r0 = [];
|
|
} else {
|
|
value = property.ids.map(_fun96196);
|
|
value = value.filter(function(a0) {
|
|
return a0 != null;
|
|
});
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function value_96198(a0) { // fn#96198, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:3341, offset: 0x02157ae9, size: 43 bytes, params: 2, frame: 4
|
|
const value = environment.__proto__;
|
|
const loading = env1_13[a0]?.loading;
|
|
return loading != null && loading;
|
|
}
|
|
|
|
function value_96199(a0) { // fn#96199, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:3437, offset: 0x02157b14, size: 43 bytes, params: 2, frame: 4
|
|
const value = environment.__proto__;
|
|
const loaded = env1_13[a0]?.loaded;
|
|
return loaded != null && loaded;
|
|
}
|
|
|
|
function value_96200(a0) { // fn#96200, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:3531, offset: 0x02157b3f, size: 43 bytes, params: 2, frame: 4
|
|
const value = environment.__proto__;
|
|
const hasMore = env1_13[a0]?.hasMore;
|
|
return hasMore != null && hasMore;
|
|
}
|
|
|
|
function _fun96204(a0) { // fn#96204, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:4187, offset: 0x02157c63, size: 230 bytes, params: 2, frame: 22
|
|
var r12;
|
|
var r3;
|
|
var r2;
|
|
var r4;
|
|
var object;
|
|
var ids;
|
|
var value2;
|
|
var value6;
|
|
var moduleValue;
|
|
var messageRecord;
|
|
var id;
|
|
var value7;
|
|
if (before != null) {
|
|
ids = a0.ids;
|
|
object = [];
|
|
value2 = 0;
|
|
arraySpread(object, ids, value2, undefined);
|
|
r3 = object;
|
|
r12 = value2;
|
|
} else {
|
|
r3 = [];
|
|
}
|
|
if (before != null) {
|
|
object = {};
|
|
copyDataProperties(object, a0.messages, r12);
|
|
r2 = object;
|
|
} else {
|
|
r2 = {};
|
|
}
|
|
const value4 = _createForOfIteratorHelperLoose_96178(messages);
|
|
const value5 = value4();
|
|
let done = value5.done;
|
|
if (!done) {
|
|
r4 = value5;
|
|
while (true) {
|
|
value6 = r4.value;
|
|
moduleValue = require(4625) /* metro dependency 4625: MessageRecordUtils */;
|
|
messageRecord = moduleValue.createMessageRecord(value6);
|
|
id = messageRecord.id;
|
|
if (r2[id] == null) {
|
|
r3.push(messageRecord.id);
|
|
}
|
|
id = messageRecord.id;
|
|
r2[id] = messageRecord;
|
|
value7 = value4();
|
|
done = value7.done;
|
|
if (done) {
|
|
break;
|
|
}
|
|
r4 = value7;
|
|
continue;
|
|
}
|
|
}
|
|
return {'ids': null, 'messages': null, 'hasMore': null, 'loading': false, 'loaded': true, 'error': false, ids: r3,
|
|
messages: r2, hasMore: hasMore};
|
|
}
|
|
|
|
function _fun96207() { // fn#96207, offset: 0x02157d9b, size: 16 bytes, params: 1, frame: 1
|
|
return {'loading': false, 'error': true};
|
|
}
|
|
|
|
function _fun96211({messages, ids}) { // fn#96211, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:5732, offset: 0x0215803a, size: 68 bytes, params: 2, frame: 14
|
|
const object3 = {};
|
|
copyDataProperties(object3, messages, undefined);
|
|
delete object3[id];
|
|
const object4 = {};
|
|
object4.ids = ids.filter(function(a0) {
|
|
return a0 !== id;
|
|
});
|
|
object4.messages = object3;
|
|
return object4;
|
|
}
|
|
|
|
function _fun96218({messages, ids}) { // fn#96218, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:7034, offset: 0x02158298, size: 68 bytes, params: 2, frame: 14
|
|
const object3 = {};
|
|
copyDataProperties(object3, messages, undefined);
|
|
delete object3[id];
|
|
const object4 = {};
|
|
object4.ids = ids.filter(function(a0) {
|
|
return a0 !== id;
|
|
});
|
|
object4.messages = object3;
|
|
return object4;
|
|
}
|
|
|
|
function _fun96222() { // fn#96222, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:7474, offset: 0x021583d9, size: 25 bytes, params: 1, frame: 3
|
|
return {ids: env0_1, messages: env0_2};
|
|
}
|
|
|
|
function _fun96196(a0) { // fn#96196, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12754:3276, offset: 0x02157ad3, size: 22 bytes, params: 2, frame: 2
|
|
return env0_0.messages[a0];
|
|
}
|
|
|