Files
discord-decomp/sources/stores/PrivateChannelReadStateStore.tsx
T
2026-07-27 16:20:00 +03:00

271 lines
11 KiB
TypeScript

/* Metro module 12600; source: stores/PrivateChannelReadStateStore.tsx; dependencies: [6, 7, 15, 17, 18, 1383, 1379, 4605, 1934, 5219, 1944, 566, 694, 2] */
function _fun96596(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#96596, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:6, offset: 0x02161482, size: 512 bytes, params: 8, frame: 22
const env0_0 = require;
const _arrayLikeToArray_96602 = 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 closure = function() {
return rebuildUnreads();
};
const closure2 = MESSAGE_CREATE_96606;
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 env0_7 = (require(1383) /* metro dependency 1383: ChannelRecord */).isPrivate;
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
const readStateStore = importDefault(4605) /* metro dependency 4605: ReadStateStore */;
const selectedChannelStore = importDefault(1934) /* metro dependency 1934: SelectedChannelStore */;
const privateChannelSortStore = importDefault(5219) /* metro dependency 5219: PrivateChannelSortStore */;
const env0_12 = [];
const Set = global.Set;
let set = new Set();
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
_fun96607(Store).displayName = 'PrivateChannelReadStateStore';
set = new set(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: closure,
OVERLAY_INITIALIZE: closure, MESSAGE_CREATE: closure2, MESSAGE_ACK: closure2,
CHANNEL_SELECT: CHANNEL_SELECT_96611, CHANNEL_DELETE: CHANNEL_DELETE_96612, WINDOW_FOCUS: WINDOW_FOCUS_96613,
CHANNEL_CREATE: CHANNEL_CREATE_96614, CHANNEL_UPDATES: CHANNEL_UPDATES_96615});
(require(2) /* metro dependency 2 */).fileFinishedImporting('stores/PrivateChannelReadStateStore.tsx');
exports.default = set;
}
function _isNativeReflectConstruct_96597() { // fn#96597, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:211, offset: 0x02161682, 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_96597_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _createForOfIteratorHelperLoose_96600(a0, a1) { // fn#96600, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:404, offset: 0x021616e4, 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 _fun96601;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_96602(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_96602(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_96602(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun96601;
}
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 rebuildUnreads() { // fn#96603, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:1333, offset: 0x02161858, size: 141 bytes, params: 1, frame: 14
var r0;
var set;
const value3 = PrivateChannelSortStore.getPrivateChannelIds().filter(_fun96604);
if (value3.length > 20) {
value3.length = 20;
}
const value4 = (require(1944) /* metro dependency 1944: FunctionUtils */).areArraysShallowlyEqual(value3, env0_12);
if (value4) {
r0 = !value4;
} else {
set = new global.Set(value3);
r0 = true;
}
return r0;
}
function MESSAGE_ACK_96606({channelId}) { // fn#96606, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:1579, offset: 0x02161911, size: 71 bytes, params: 2, frame: 13
const channel = ChannelStore.getChannel(channelId);
return !(channel == null || !isPrivate(channel.type)) && rebuildUnreads();
}
function _fun96607(a0) { // fn#96607, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:1698, offset: 0x02161958, size: 97 bytes, params: 2, frame: 16
const closure = PrivateChannelReadStateStore;
env0_6(closure, a0);
return env0_3(closure, [{key: 'initialize', value: function() {
this.waitFor(PrivateChannelSortStore, ChannelStore, SelectedChannelStore, ReadStateStore);
}}, {key: 'getUnreadPrivateChannelIds', value: value_96610}]);
}
function CHANNEL_DELETE_96612({channel}) { // fn#96612, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:2539, offset: 0x021619e0, size: 51 bytes, params: 2, frame: 12
const value2 = env0_13.has(channel.id);
return value2 ? rebuildUnreads() : !!value2;
}
function WINDOW_FOCUS_96613() { // fn#96613, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:2635, offset: 0x02161a13, size: 77 bytes, params: 1, frame: 13
const getChannel = ChannelStore.getChannel;
const getChannelId = SelectedChannelStore.getChannelId;
const value2 = Reflect.apply(getChannel, ChannelStore, [Reflect.apply(getChannelId, SelectedChannelStore, [])]);
return !(value2 == null || !isPrivate(value2.type)) && rebuildUnreads();
}
function CHANNEL_CREATE_96614({channel}) { // fn#96614, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:2764, offset: 0x02161a60, size: 76 bytes, params: 2, frame: 13
const channel2 = ChannelStore.getChannel(channel.id);
return !(channel2 == null || !isPrivate(channel2.type)) && rebuildUnreads();
}
function CHANNEL_UPDATES_96615({channels}) { // fn#96615, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:2897, offset: 0x02161aac, size: 131 bytes, params: 2, frame: 19
var r4;
var r5;
var r0;
var r3;
var value5;
var id;
var channel;
var value7;
var isPrivateBinding;
var type;
var isPrivate2;
var value8;
var value9;
const value2 = _createForOfIteratorHelperLoose_96600(channels);
const value3 = value2();
let done = value3.done;
if (done) {
r3 = false;
} else {
r4 = false;
r5 = value3;
while (true) {
value5 = r5.value;
id = value5.id;
channel = ChannelStore.getChannel(id);
value7 = channel != null;
if (value7) {
isPrivateBinding = isPrivate;
type = channel.type;
isPrivate2 = isPrivateBinding(type);
r0 = isPrivate2;
} else {
r0 = value7;
}
if (!r0) {
continue;
}
value8 = true;
r4 = value8;
value9 = value2();
done = value9.done;
if (done) {
r3 = r4;
break;
}
r5 = value9;
continue;
}
}
return r3 ? rebuildUnreads() : !!r3;
}
function _fun96604(a0) { // fn#96604, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12790:1398, offset: 0x021618e5, size: 29 bytes, params: 2, frame: 11
const value = environment.__proto__;
return ReadStateStore.getMentionCount(a0) > 0;
}