Files
discord-decomp/sources/stores/MessageReactionsStore.tsx
2026-07-28 01:06:53 +03:00

160 lines
8.7 KiB
TypeScript

/* Metro module 7150; source: stores/MessageReactionsStore.tsx; dependencies: [15, 17, 18, 6, 7, 3785, 1885, 1379, 1878, 7151, 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 ChannelStore from './ChannelStore.tsx'; /* Metro dependency 1379 */
import UserStore from './UserStore.tsx'; /* Metro dependency 1878 */
import UserRecord from '../records/UserRecord.tsx'; /* Metro dependency 1885 */
import LurkingStore from '../modules/lurker_mode/LurkingStore.tsx'; /* Metro dependency 3785 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
function _fun57209(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#57209, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7328:6, offset: 0x013df719, size: 380 bytes, params: 8, frame: 19
const MESSAGE_REACTION_ADD_572132 = MESSAGE_REACTION_ADD_57213;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let env0_11 = {};
const env0_12 = _fun57214();
const Store = (Flux).Store;
let value = _fun57217(Store);
value.displayName = 'MessageReactionsStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: function() {
env0_11 = {};
}, MESSAGE_REACTION_ADD: MESSAGE_REACTION_ADD_572132, MESSAGE_REACTION_REMOVE: MESSAGE_REACTION_ADD_572132,
MESSAGE_REACTION_ADD_USERS: MESSAGE_REACTION_ADD_USERS});
(FileImportTrackerModule).fileFinishedImporting('stores/MessageReactionsStore.tsx');
exports.default = value;
function _isNativeReflectConstruct_57210() { // fn#57210, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7328:188, offset: 0x013df895, 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_57210_isNativeReflectConstruct = function() {
return !!result;
})();
}
function MESSAGE_REACTION_ADD_57213({type, messageId, userId, emoji, reactionType}) { // fn#57213, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7328:639, offset: 0x013df8f3, size: 118 bytes, params: 2, frame: 18
var user;
const value2 = env0_12.ensure(messageId, emoji, reactionType);
if (type === 'MESSAGE_REACTION_ADD') {
user = UserStore.getUser(userId);
if (user != null) {
value2.users.set(userId, user);
}
} else {
value2.users.delete(userId);
}
}
function _fun57214() { // fn#57214, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7328:392, offset: 0x013df969, size: 58 bytes, params: 1, frame: 15
return CreateClass(Reaction, null, [{key: 'ensure', value: value_57216}]);
function Reaction() { // fn#57215, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7328:403, offset: 0x013df9a3, size: 69 bytes, params: 1, frame: 13
const value = environment.__proto__;
env1_5(this, Reaction);
this.fetched = false;
const Map = global.Map;
this.users = new Map();
}
function value_57216(a0, {name, id}, a2) { // fn#57216, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7328:519, offset: 0x013df9e8, size: 125 bytes, params: 4, frame: 22
var r0;
var reaction;
let value = '';
value = value + a0 + ':' + name + ':' + (id ?? value) + ':' + a2;
const binding = env1_11;
const property = binding[value];
if (property != null) {
r0 = property;
} else {
reaction = new Reaction();
}
binding[value] = r0;
return r0;
}
}
function _fun57217(a0) { // fn#57217, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7328:844, offset: 0x013dfa65, size: 91 bytes, params: 2, frame: 16
const MessageReactionsStore2 = MessageReactionsStore;
Inherits(MessageReactionsStore2, a0);
return CreateClass(MessageReactionsStore2, [{key: 'initialize', value: function() {
this.waitFor(ChannelStore, LurkingStore, UserStore);
}}, {key: 'getReactions', value: value_57220}]);
function MessageReactionsStore() { // fn#57218, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7328:856, offset: 0x0111f655, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_5(this, MessageReactionsStore);
const value3 = env1_3(MessageReactionsStore);
return env1_2(this, _isNativeReflectConstruct_57210() ? global.Reflect.construct(value3, arguments,
env1_3(this).constructor) : value3.apply(this, arguments));
}
function value_57220(a0, a1, a2, a3, a4) { // fn#57220, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7328:1238, offset: 0x013dfae3, size: 182 bytes, params: 6, frame: 20
var r8;
const value = environment.__proto__;
const value2 = env1_12.ensure(a1, a2, a4);
if (!value2.fetched) {
var channel = ChannelStore.getChannel(a0);
var value4 = null;
r8 = value4 != channel ? channel.getGuildId() : value4;
if (value4 == r8) {
(importAll(7151) /* metro dependency 7151: ReactionActionCreators */).getReactors({channelId: a0,
messageId: a1,
emoji: a2, limit: a3, type: a4});
value2.fetched = true;
return value2.users;
}
var lurkingStoreBinding = LurkingStore;
if (lurkingStoreBinding.isLurking(r8)) {
return undefined;
}
(importAll(7151) /* metro dependency 7151: ReactionActionCreators */).getReactors({channelId: a0, messageId: a1,
emoji: a2, limit: a3, type: a4});
value2.fetched = true;
}
return value2.users;
}
}
function MESSAGE_REACTION_ADD_USERS({messageId, users, emoji, reactionType}) { // fn#57222, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7328:1716, offset: 0x013dfba6, size: 71 bytes, params: 2, frame: 17
const env0_0 = env0_12.ensure(messageId, emoji, reactionType);
users.forEach(_fun57223);
function _fun57223(a0) { // fn#57223, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7328:1827, offset: 0x013dfbed, size: 64 bytes, params: 2, frame: 15
const users = env0_0.users;
const set = users.set;
const id = a0.id;
const value = environment.__proto__;
const userRecord2 = new UserRecord(a0);
return Reflect.apply(set, users, [id, userRecord2]);
}
}
}
global.__d(_fun57209, 7150, [15, 17, 18, 6, 7, 3785, 1885, 1379, 1878, 7151, 566, 694,
2]) /* metro module 7150, dependencies: [15, 17, 18, 6, 7, 3785, 1885, 1379, 1878, 7151, 566, 694, 2] */;