119 lines
6.4 KiB
TypeScript
119 lines
6.4 KiB
TypeScript
/* Metro module 11332; source: modules/chat/native/ChatUpdatesQueue.tsx; dependencies: [6, 7, 27, 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 * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
|
|
|
|
function _fun86537(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#86537, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11518:6, offset: 0x01f971ec, size: 166 bytes, params: 8, frame: 19
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = ReactNativeModule;
|
|
const env0_2 = value.NativeEventEmitter;
|
|
const NativeModules = value.NativeModules;
|
|
const env0_3 = NativeModules.DCDChatBlockerManager;
|
|
value = _fun86538();
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/chat/native/ChatUpdatesQueue.tsx');
|
|
exports.default = value;
|
|
function _fun86538() { // fn#86538, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11518:191, offset: 0x01f97292, size: 265 bytes, params: 1, frame: 15
|
|
return CreateClass(ChatUpdatesQueue, [{key: 'hasUpdates', value: function() {
|
|
return this.queue.length > 0;
|
|
}}, {key: 'isBlocking', get: function() {
|
|
return this.hasUpdates() || this.blockers.size > 0;
|
|
}}, {key: 'addBlocker', value: function(a0) {
|
|
if (a0 != null) {
|
|
this.blockers.add(a0);
|
|
}
|
|
}}, {key: 'removeBlocker', value: function(a0) {
|
|
if (a0 != null) {
|
|
this.blockers.delete(a0);
|
|
if (this.blockers.size === 0) {
|
|
this.flush();
|
|
}
|
|
}
|
|
}}, {key: 'add', value: value_86547}, {key: 'tryFlush', value: function() {
|
|
if (this.blockers.size === 0) {
|
|
this.flush();
|
|
}
|
|
}}, {key: 'clear', value: function() {
|
|
this.queue = [];
|
|
this.queueStartTimestamp = null;
|
|
}}, {key: 'flush', value: function() {
|
|
var env0_0 = this;
|
|
this.queueStartTimestamp = null;
|
|
this.queue.forEach(_fun86551);
|
|
this.queue = [];
|
|
}}, {key: 'cleanup', value: function() {
|
|
this.addBlockerSubscription.remove();
|
|
this.removeBlockerSubscription.remove();
|
|
}}]);
|
|
function ChatUpdatesQueue(a0, a1) { // fn#86539, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11518:212, offset: 0x01f9739b, size: 226 bytes, params: 3, frame: 16
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
env1_0(this, ChatUpdatesQueue);
|
|
const Set = global.Set;
|
|
const value3 = Object.create(Set.prototype, {constructor: {value: Set}});
|
|
const set = new Set();
|
|
this.blockers = set instanceof Object ? set : value3;
|
|
this.queue = [];
|
|
this.queueStartTimestamp = null;
|
|
this.setOnFlushItem = setOnFlushItem;
|
|
this.getReactTag = a0;
|
|
this.onFlushItem = a1;
|
|
this.eventEmitter = new NativeEventEmitter(DCDChatBlockerManager);
|
|
let eventEmitter = this.eventEmitter;
|
|
this.addBlockerSubscription = eventEmitter.addListener('AddBlocker', _fun86541);
|
|
eventEmitter = this.eventEmitter;
|
|
this.removeBlockerSubscription = eventEmitter.addListener('RemoveBlocker', _fun86542);
|
|
function setOnFlushItem(a0) { // fn#86540, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11518:354, owner: ChatUpdatesQueue.setOnFlushItem, offset: 0x01f9747d, size: 20 bytes, params: 2, frame: 2
|
|
ClassCallCheck.onFlushItem = a0;
|
|
}
|
|
|
|
function _fun86541({blockerId, reactTag}) { // fn#86541, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11518:515, offset: 0x01f97491, size: 69 bytes, params: 2, frame: 14
|
|
if (reactTag != null && reactTag === ClassCallCheck.getReactTag()) {
|
|
ClassCallCheck.addBlocker(blockerId);
|
|
}
|
|
}
|
|
|
|
function _fun86542({blockerId, reactTag}) { // fn#86542, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11518:685, offset: 0x01f974d6, size: 69 bytes, params: 2, frame: 14
|
|
if (reactTag != null && reactTag === ClassCallCheck.getReactTag()) {
|
|
ClassCallCheck.removeBlocker(blockerId);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function value_86550() { // fn#86550, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11518:1544, offset: 0x01f9768e, size: 54 bytes, params: 1, frame: 12
|
|
this.queueStartTimestamp = null;
|
|
this.queue.forEach(_fun86551);
|
|
this.queue = [];
|
|
function _fun86551(a0) { // fn#86551, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11518:1605, offset: 0x01f976c4, size: 45 bytes, params: 2, frame: 13
|
|
var onFlushItem;
|
|
if (a0 != null) {
|
|
onFlushItem = ClassCallCheck.onFlushItem;
|
|
if (onFlushItem != null) {
|
|
onFlushItem.call(ClassCallCheck, a0);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function value_86547(a0) { // fn#86547, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11518:1127, offset: 0x01f975af, size: 164 bytes, params: 2, frame: 13
|
|
var Date;
|
|
if (this.queueStartTimestamp == null) {
|
|
Date = global.Date;
|
|
this.queueStartTimestamp = Date.now();
|
|
}
|
|
this.queue.push(a0);
|
|
if (this.queue.length > 100 || this.queueStartTimestamp != null && global.Date.now() - this.queueStartTimestamp > 30000) {
|
|
this.blockers.clear();
|
|
this.flush();
|
|
}
|
|
}
|
|
|
|
global.__d(_fun86537, 11332, [6, 7, 27, 2]) /* metro module 11332, dependencies: [6, 7, 27, 2] */;
|