Files
2026-07-28 01:06:53 +03:00

503 lines
26 KiB
TypeScript

/* Metro module 16144; source: modules/notifications/friend_online/FriendOnlineTimer.tsx; dependencies: [6, 7, 15, 17, 18, 5, 6876, 16145, 661, 482, 672, 507, 1216, 694, 3829, 4860, 2] */
import Module00005 from '../../../by-id/module-00005.js'; /* Metro dependency 5 */
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 Durations from '../../../utils/Durations.tsx'; /* Metro dependency 672 */
import AutomaticLifecycleManager from '../../../lib/AutomaticLifecycleManager.tsx'; /* Metro dependency 4860 */
import SelfPresenceStore from '../../../stores/SelfPresenceStore.tsx'; /* Metro dependency 6876 */
import FriendOnlineTimerStore from './FriendOnlineTimerStore.tsx'; /* Metro dependency 16145 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../../external/discord_common/js/shared/Constants.tsx'; /* Metro dependency 482 */
import * as ConstantsModule2 from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as UserSettingsModule from '../../user_settings/UserSettings.tsx'; /* Metro dependency 3829 */
function _fun124724(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#124724, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16352:6, offset: 0x025c1bcb, size: 376 bytes, params: 8, frame: 19
const env0_0 = require;
const isStatusEffectivelyOnline = function(a0) {
var ONLINE = StatusTypes.ONLINE;
return [ONLINE, StatusTypes.STREAMING].includes(a0);
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const Millis = (Durations).Millis;
const MINUTE = Millis.MINUTE;
const env0_13 = 5 * MINUTE;
let value = AutomaticLifecycleManager;
value = _fun124732(value);
value = new value();
(FileImportTrackerModule).fileFinishedImporting('modules/notifications/friend_online/FriendOnlineTimer.tsx');
exports.default = value;
function _isNativeReflectConstruct_124725() { // fn#124725, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16352:220, offset: 0x025c1d43, 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_124725_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _reportSessionMeaningfullyOnline() { // fn#124728, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16352:444, offset: 0x025c1da5, size: 50 bytes, params: 1, frame: 14
return Module00005(_fun124730).apply(this, arguments);
function* _fun124730() { // fn#124730, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16352:531, offset: 0x025c1de2, size: 284 bytes, params: 1, frame: 19
var binding;
var binding2;
var property;
var value3;
var HTTP;
var post;
var object;
var USER_MEANINGFULLY_ONLINE;
var value4;
var value5;
var value6;
var error;
var HTTPResponseError;
var status;
var dispatch;
var Date;
if (true) {
value = environment.__proto__.__proto__;
try {
binding = env2_0;
} catch (error) {
binding = env2_0;
HTTPResponseError = binding(env2_2[11]).HTTPResponseError;
if (error instanceof HTTPResponseError) {
status = error.status;
if (status !== 429) {
env2_1(env2_2[12]).captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
value = env2_1(env2_2[13]);
dispatch = value.dispatch;
object = {type: 'FRIEND_ONLINE_TIMER_REPORTED'};
Date = global.Date;
object.timestampMs = Date.now();
Reflect.apply(dispatch, value, [object]);
return undefined;
}
binding = env2_1;
value = binding(env2_2[12]);
value.captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
try {
binding2 = env2_2;
} catch (error) {
binding = env2_0;
HTTPResponseError = binding(env2_2[11]).HTTPResponseError;
if (error instanceof HTTPResponseError) {
status = error.status;
if (status !== 429) {
env2_1(env2_2[12]).captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
value = env2_1(env2_2[13]);
dispatch = value.dispatch;
object = {type: 'FRIEND_ONLINE_TIMER_REPORTED'};
Date = global.Date;
object.timestampMs = Date.now();
Reflect.apply(dispatch, value, [object]);
return undefined;
}
binding = env2_1;
value = binding(env2_2[12]);
value.captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
try {
property = binding2[11];
} catch (error) {
binding = env2_0;
HTTPResponseError = binding(env2_2[11]).HTTPResponseError;
if (error instanceof HTTPResponseError) {
status = error.status;
if (status !== 429) {
env2_1(env2_2[12]).captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
value = env2_1(env2_2[13]);
dispatch = value.dispatch;
object = {type: 'FRIEND_ONLINE_TIMER_REPORTED'};
Date = global.Date;
object.timestampMs = Date.now();
Reflect.apply(dispatch, value, [object]);
return undefined;
}
binding = env2_1;
value = binding(env2_2[12]);
value.captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
try {
value3 = binding(property);
} catch (error) {
binding = env2_0;
HTTPResponseError = binding(env2_2[11]).HTTPResponseError;
if (error instanceof HTTPResponseError) {
status = error.status;
if (status !== 429) {
env2_1(env2_2[12]).captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
value = env2_1(env2_2[13]);
dispatch = value.dispatch;
object = {type: 'FRIEND_ONLINE_TIMER_REPORTED'};
Date = global.Date;
object.timestampMs = Date.now();
Reflect.apply(dispatch, value, [object]);
return undefined;
}
binding = env2_1;
value = binding(env2_2[12]);
value.captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
try {
HTTP = value3.HTTP;
} catch (error) {
binding = env2_0;
HTTPResponseError = binding(env2_2[11]).HTTPResponseError;
if (error instanceof HTTPResponseError) {
status = error.status;
if (status !== 429) {
env2_1(env2_2[12]).captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
value = env2_1(env2_2[13]);
dispatch = value.dispatch;
object = {type: 'FRIEND_ONLINE_TIMER_REPORTED'};
Date = global.Date;
object.timestampMs = Date.now();
Reflect.apply(dispatch, value, [object]);
return undefined;
}
binding = env2_1;
value = binding(env2_2[12]);
value.captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
try {
post = HTTP.post;
} catch (error) {
binding = env2_0;
HTTPResponseError = binding(env2_2[11]).HTTPResponseError;
if (error instanceof HTTPResponseError) {
status = error.status;
if (status !== 429) {
env2_1(env2_2[12]).captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
value = env2_1(env2_2[13]);
dispatch = value.dispatch;
object = {type: 'FRIEND_ONLINE_TIMER_REPORTED'};
Date = global.Date;
object.timestampMs = Date.now();
Reflect.apply(dispatch, value, [object]);
return undefined;
}
binding = env2_1;
value = binding(env2_2[12]);
value.captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
try {
object = {};
} catch (error) {
binding = env2_0;
HTTPResponseError = binding(env2_2[11]).HTTPResponseError;
if (error instanceof HTTPResponseError) {
status = error.status;
if (status !== 429) {
env2_1(env2_2[12]).captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
value = env2_1(env2_2[13]);
dispatch = value.dispatch;
object = {type: 'FRIEND_ONLINE_TIMER_REPORTED'};
Date = global.Date;
object.timestampMs = Date.now();
Reflect.apply(dispatch, value, [object]);
return undefined;
}
binding = env2_1;
value = binding(env2_2[12]);
value.captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
try {
binding = env2_11;
} catch (error) {
binding = env2_0;
HTTPResponseError = binding(env2_2[11]).HTTPResponseError;
if (error instanceof HTTPResponseError) {
status = error.status;
if (status !== 429) {
env2_1(env2_2[12]).captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
value = env2_1(env2_2[13]);
dispatch = value.dispatch;
object = {type: 'FRIEND_ONLINE_TIMER_REPORTED'};
Date = global.Date;
object.timestampMs = Date.now();
Reflect.apply(dispatch, value, [object]);
return undefined;
}
binding = env2_1;
value = binding(env2_2[12]);
value.captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
try {
USER_MEANINGFULLY_ONLINE = binding.USER_MEANINGFULLY_ONLINE;
} catch (error) {
binding = env2_0;
HTTPResponseError = binding(env2_2[11]).HTTPResponseError;
if (error instanceof HTTPResponseError) {
status = error.status;
if (status !== 429) {
env2_1(env2_2[12]).captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
value = env2_1(env2_2[13]);
dispatch = value.dispatch;
object = {type: 'FRIEND_ONLINE_TIMER_REPORTED'};
Date = global.Date;
object.timestampMs = Date.now();
Reflect.apply(dispatch, value, [object]);
return undefined;
}
binding = env2_1;
value = binding(env2_2[12]);
value.captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
try {
object.url = USER_MEANINGFULLY_ONLINE;
} catch (error) {
binding = env2_0;
HTTPResponseError = binding(env2_2[11]).HTTPResponseError;
if (error instanceof HTTPResponseError) {
status = error.status;
if (status !== 429) {
env2_1(env2_2[12]).captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
value = env2_1(env2_2[13]);
dispatch = value.dispatch;
object = {type: 'FRIEND_ONLINE_TIMER_REPORTED'};
Date = global.Date;
object.timestampMs = Date.now();
Reflect.apply(dispatch, value, [object]);
return undefined;
}
binding = env2_1;
value = binding(env2_2[12]);
value.captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
try {
object.rejectWithError = true;
} catch (error) {
binding = env2_0;
HTTPResponseError = binding(env2_2[11]).HTTPResponseError;
if (error instanceof HTTPResponseError) {
status = error.status;
if (status !== 429) {
env2_1(env2_2[12]).captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
value = env2_1(env2_2[13]);
dispatch = value.dispatch;
object = {type: 'FRIEND_ONLINE_TIMER_REPORTED'};
Date = global.Date;
object.timestampMs = Date.now();
Reflect.apply(dispatch, value, [object]);
return undefined;
}
binding = env2_1;
value = binding(env2_2[12]);
value.captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
try {
value4 = Reflect.apply(post, HTTP, [object]);
} catch (error) {
binding = env2_0;
HTTPResponseError = binding(env2_2[11]).HTTPResponseError;
if (error instanceof HTTPResponseError) {
status = error.status;
if (status !== 429) {
env2_1(env2_2[12]).captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
value = env2_1(env2_2[13]);
dispatch = value.dispatch;
object = {type: 'FRIEND_ONLINE_TIMER_REPORTED'};
Date = global.Date;
object.timestampMs = Date.now();
Reflect.apply(dispatch, value, [object]);
return undefined;
}
binding = env2_1;
value = binding(env2_2[12]);
value.captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
yield value4;
try {
value5 = undefined;
value6 = false;
} catch (error) {
binding = env2_0;
HTTPResponseError = binding(env2_2[11]).HTTPResponseError;
if (error instanceof HTTPResponseError) {
status = error.status;
if (status !== 429) {
env2_1(env2_2[12]).captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
value = env2_1(env2_2[13]);
dispatch = value.dispatch;
object = {type: 'FRIEND_ONLINE_TIMER_REPORTED'};
Date = global.Date;
object.timestampMs = Date.now();
Reflect.apply(dispatch, value, [object]);
return undefined;
}
binding = env2_1;
value = binding(env2_2[12]);
value.captureException(error, {tags: {app_context: 'session_timer'}});
return undefined;
}
if (value6) {
return value5;
}
value = env2_1(env2_2[13]);
dispatch = value.dispatch;
object = {type: 'FRIEND_ONLINE_TIMER_REPORTED'};
Date = global.Date;
object.timestampMs = Date.now();
Reflect.apply(dispatch, value, [object]);
}
}
}
function _fun124732(a0) { // fn#124732, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16352:965, offset: 0x025c1f30, size: 97 bytes, params: 2, frame: 16
const FriendOnlineTimerManager2 = FriendOnlineTimerManager;
Inherits(FriendOnlineTimerManager2, a0);
return CreateClass(FriendOnlineTimerManager2, [{key: '_initialize', value: function() {
}}, {key: '_terminate', value: function() {
this.clear();
}}]);
function FriendOnlineTimerManager(a0) { // fn#124733, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16352:977, offset: 0x025c1f91, size: 234 bytes, params: 2, frame: 20
var r0;
var Reflect;
let value = copyRestArgs(0, undefined);
let binding = env1_3;
binding(this, FriendOnlineTimerManager);
const items2 = [];
arraySpread(items2, value, 0, items2);
value = env1_6(FriendOnlineTimerManager);
binding = env1_5;
if (_isNativeReflectConstruct_124725()) {
Reflect = global.Reflect;
value = Reflect.construct(value, items2, env1_6(this).constructor);
r0 = value;
} else {
value = value.apply(this, items2);
r0 = value;
}
value = binding(this, r0);
value.timerId = null;
value.actions = {POST_CONNECTION_OPEN: POST_CONNECTION_OPEN_124734, CONNECTION_RESUMED: CONNECTION_RESUMED_124735,
CONNECTION_CLOSED: CONNECTION_CLOSED_124736, CONNECTION_INTERRUPTED: CONNECTION_INTERRUPTED,
SELF_PRESENCE_STORE_UPDATE: SELF_PRESENCE_STORE_UPDATE_124738};
value.start = start_124739;
value.clear = clear_124742;
return value;
function FriendOnlineTimerManagerPOST_CONNECTION_OPEN() { // fn#124734, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16352:1282, owner: FriendOnlineTimerManager.POST_CONNECTION_OPEN, offset: 0x00dc92bc, size: 18 bytes, params: 1, frame: 9
return env0_0.start();
}
function FriendOnlineTimerManagerCONNECTION_RESUMED() { // fn#124735, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16352:1315, owner: FriendOnlineTimerManager.CONNECTION_RESUMED, offset: 0x00dc92bc, size: 18 bytes, params: 1, frame: 9
return env0_0.start();
}
function FriendOnlineTimerManagerCONNECTION_CLOSED() { // fn#124736, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16352:1347, owner: FriendOnlineTimerManager.CONNECTION_CLOSED, offset: 0x0209c6cb, size: 19 bytes, params: 1, frame: 9
return env0_0.clear();
}
function CONNECTION_INTERRUPTED() { // fn#124737, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16352:1384, owner: FriendOnlineTimerManager.CONNECTION_INTERRUPTED, offset: 0x0209c6cb, size: 19 bytes, params: 1, frame: 9
return env0_0.clear();
}
function FriendOnlineTimerManagerSELF_PRESENCE_STORE_UPDATE() { // fn#124738, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16352:1425, owner: FriendOnlineTimerManager.SELF_PRESENCE_STORE_UPDATE, offset: 0x00dc92bc, size: 18 bytes, params: 1, frame: 9
return env0_0.start();
}
function FriendOnlineTimerManagerStart() { // fn#124739, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16352:1448, owner: FriendOnlineTimerManager.start, offset: 0x025c207b, size: 151 bytes, params: 1, frame: 15
const NotifyFriendsOnComeOnline = (UserSettingsModule).NotifyFriendsOnComeOnline;
if (NotifyFriendsOnComeOnline.getSetting() && FriendOnlineTimerStore.isCooldownElapsed() && env0_0.timerId == null && isStatusEffectivelyOnline(SelfPresenceStore.getStatus())) {
env0_0.timerId = global.setTimeout(_fun124740, env2_13);
}
function _fun124740() { // fn#124740, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16352:1607, offset: 0x025c2112, size: 78 bytes, params: 1, frame: 12
var environment;
let value = environment.__proto__;
env1_0.timerId = null;
value = environment.__proto__.__proto__.__proto__;
if (isStatusEffectivelyOnline(SelfPresenceStore.getStatus()) && FriendOnlineTimerStore.isCooldownElapsed()) {
(function() {
return _reportSessionMeaningfullyOnline.apply(this, arguments);
})();
}
}
}
function FriendOnlineTimerManagerClear() { // fn#124742, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16352:1815, owner: FriendOnlineTimerManager.clear, offset: 0x025c217e, size: 54 bytes, params: 1, frame: 13
var clearTimeout;
var binding;
if (env0_0.timerId != null) {
clearTimeout = global.clearTimeout;
binding = env0_0;
clearTimeout(binding.timerId);
binding.timerId = null;
}
}
}
}
}
global.__d(_fun124724, 16144, [6, 7, 15, 17, 18, 5, 6876, 16145, 661, 482, 672, 507, 1216, 694, 3829, 4860,
2]) /* metro module 16144, dependencies: [6, 7, 15, 17, 18, 5, 6876, 16145, 661, 482, 672, 507, 1216, 694, 3829, 4860, 2] */;