/* Metro module 15687; source: modules/custom_status/CustomStatusManager.tsx; dependencies: [7, 6, 15, 17, 18, 6876, 661, 4041, 3829, 10917, 1362, 1345, 10916, 4860, 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 SelfPresenceStore from '../../stores/SelfPresenceStore.tsx'; /* Metro dependency 6876 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */ import * as WrappersModule from '../../external/discord_common/js/packages/protos/google/protobuf/wrappers.tsx'; /* Metro dependency 1345 */ import * as UserSettingsModule from '../user_settings/UserSettings.tsx'; /* Metro dependency 3829 */ import * as TimersModule from '../../external/discord_common/js/packages/timers/Timers.tsx'; /* Metro dependency 4041 */ import * as FocusModeUtilsModule from '../notifications/FocusModeUtils.tsx'; /* Metro dependency 10916 */ function _fun120337(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#120337, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15895:6, offset: 0x02528634, size: 398 bytes, params: 8, frame: 19 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const Timeout = (TimersModule).Timeout; let timeout = new Timeout(); timeout = new Timeout(); timeout = new Timeout(); timeout = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */; timeout = _fun120341(timeout); timeout = new timeout(); (FileImportTrackerModule).fileFinishedImporting('modules/custom_status/CustomStatusManager.tsx'); exports.default = timeout; function _isNativeReflectConstruct_120338() { // fn#120338, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15895:205, offset: 0x025287c2, 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_120338_isNativeReflectConstruct = function() { return !!result; })(); } function _fun120341(a0) { // fn#120341, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15895:477, offset: 0x02528824, size: 42 bytes, params: 2, frame: 14 const CustomStatusManager2 = CustomStatusManager; Inherits(CustomStatusManager2, a0); return CreateClass(CustomStatusManager2); function CustomStatusManager(a0) { // fn#120342, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15895:489, offset: 0x0252884e, size: 255 bytes, params: 2, frame: 20 var r0; var Reflect; let value = copyRestArgs(0, undefined); let binding = env1_4; binding(this, CustomStatusManager); const items2 = []; arraySpread(items2, value, 0, items2); value = env1_6(CustomStatusManager); binding = env1_5; if (_isNativeReflectConstruct_120338()) { 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.actions = {POST_CONNECTION_OPEN: POST_CONNECTION_OPEN_120343, USER_SETTINGS_PROTO_UPDATE: USER_SETTINGS_PROTO_UPDATE_120344}; value.handlePostConnectionOpen = handlePostConnectionOpen_120345; value.handleUserSettingsProtoUpdate = handleUserSettingsProtoUpdate; value.handleCommonUpdates = handleCommonUpdates; value.manageExpiringCustomStatus = manageExpiringCustomStatus; value.manageExpiringStatus = manageExpiringStatus; value.lazilyMigrateStatusCreatedAt = lazilyMigrateStatusCreatedAt; value.manageExpiringFocusMode = manageExpiringFocusMode; return value; function CustomStatusManagerPOST_CONNECTION_OPEN() { // fn#120343, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15895:764, owner: CustomStatusManager.POST_CONNECTION_OPEN, offset: 0x01148776, size: 19 bytes, params: 1, frame: 9 return env0_0.handlePostConnectionOpen(); } function CustomStatusManagerUSER_SETTINGS_PROTO_UPDATE() { // fn#120344, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15895:824, owner: CustomStatusManager.USER_SETTINGS_PROTO_UPDATE, offset: 0x0252894d, size: 19 bytes, params: 1, frame: 9 return env0_0.handleUserSettingsProtoUpdate(); } function CustomStatusManagerHandlePostConnectionOpen() { // fn#120345, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15895:890, owner: CustomStatusManager.handlePostConnectionOpen, offset: 0x02528960, size: 21 bytes, params: 1, frame: 9 env0_0.handleCommonUpdates(); } function handleUserSettingsProtoUpdate() { // fn#120346, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15895:952, owner: CustomStatusManager.handleUserSettingsProtoUpdate, offset: 0x02528960, size: 21 bytes, params: 1, frame: 9 env0_0.handleCommonUpdates(); } function handleCommonUpdates() { // fn#120347, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15895:1004, owner: CustomStatusManager.handleCommonUpdates, offset: 0x02528975, size: 51 bytes, params: 1, frame: 9 const binding = env0_0; binding.manageExpiringCustomStatus(); binding.manageExpiringStatus(); binding.lazilyMigrateStatusCreatedAt(); binding.manageExpiringFocusMode(); } function manageExpiringCustomStatus() { // fn#120348, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15895:1156, owner: CustomStatusManager.manageExpiringCustomStatus, offset: 0x025289a8, size: 302 bytes, params: 1, frame: 17 var Date; var value3; var prototype; var value4; var date; var time; var value7; var value8; var value9; let CustomStatusSetting = (UserSettingsModule).CustomStatusSetting; const setting = CustomStatusSetting.getSetting(); if (setting == null) { env2_13.stop(); } else if (setting.expiresAtMs == null) { if (env2_13 != null) { env2_13.stop(); } } else if (setting.expiresAtMs !== '0') { Date = global.Date; value3 = global.Number(setting.expiresAtMs); prototype = Date.prototype; value4 = Object.create(prototype, {constructor: {value: Date}}); date = new Date(); time = (date instanceof Object ? date : value4).getTime(); Date = global.Date; prototype = Date.prototype; value7 = Object.create(prototype, {constructor: {value: Date}}); date = new Date(); value8 = date instanceof Object ? date : value7; value9 = time - value8.getTime(); if (value9 > 0) { env2_13.start(value9, function() { var CustomStatusSetting = require(dependencyMap[8]).CustomStatusSetting; CustomStatusSetting.updateSetting(undefined); }, true); } else { CustomStatusSetting.updateSetting(undefined); env2_13.stop(); } } else if (env2_13 != null) { env2_13.stop(); } } function manageExpiringStatus() { // fn#120350, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15895:1531, owner: CustomStatusManager.manageExpiringStatus, offset: 0x02528b02, size: 325 bytes, params: 1, frame: 18 var Date; var value4; var prototype; var value5; var date; var time; var value8; var value9; var value10; const StatusExpiresAtSetting = (UserSettingsModule).StatusExpiresAtSetting; const setting = StatusExpiresAtSetting.getSetting(); if (setting == null) { if (env2_11 != null) { env2_11.stop(); } } else if (setting === '0') { if (env2_11 != null) { env2_11.stop(); } } else if (SelfPresenceStore.getStatus() !== StatusTypes.ONLINE) { Date = global.Date; value4 = global.Number(setting); prototype = Date.prototype; value5 = Object.create(prototype, {constructor: {value: Date}}); date = new Date(); time = (date instanceof Object ? date : value5).getTime(); Date = global.Date; prototype = Date.prototype; value8 = Object.create(prototype, {constructor: {value: Date}}); date = new Date(); value9 = date instanceof Object ? date : value8; value10 = time - value9.getTime(); if (value10 > 0) { env2_11.start(value10, function() { importDefault(dependencyMap[9])({nextStatus: StatusTypes.ONLINE, analyticsContext: {location: {object: AnalyticsObjects.CUSTOM_STATUS_MANAGER}}}); }, true); } else { (importDefault(10917) /* metro dependency 10917: setUserStatus */)({nextStatus: StatusTypes.ONLINE, analyticsContext: {location: {object: AnalyticsObjects.CUSTOM_STATUS_MANAGER}}}); env2_11.stop(); } } else if (env2_11 != null) { env2_11.stop(); } } function lazilyMigrateStatusCreatedAt() { // fn#120352, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15895:1966, owner: CustomStatusManager.lazilyMigrateStatusCreatedAt, offset: 0x02528c94, size: 160 bytes, params: 1, frame: 16 var PreloadedUserSettingsActionCreators; const status = SelfPresenceStore.getStatus(); const ONLINE = StatusTypes.ONLINE; if (status !== ONLINE && (require(3829) /* metro dependency 3829: UserSettings */).StatusCreatedAtSetting.getSetting() == null) { PreloadedUserSettingsActionCreators = (require(1362) /* metro dependency 1362: UserSettingsProtoActionCreators */).PreloadedUserSettingsActionCreators; PreloadedUserSettingsActionCreators.updateAsync('status', _fun120353, (require(1362) /* metro dependency 1362: UserSettingsProtoActionCreators */).UserSettingsDelay.INFREQUENT_USER_ACTION); } function _fun120353(a0) { // fn#120353, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15895:2115, offset: 0x02528d34, size: 95 bytes, params: 2, frame: 15 const value = environment.__proto__.__proto__.__proto__; const UInt64Value = (WrappersModule).UInt64Value; const create = UInt64Value.create; const object = {}; const Date = global.Date; object.value = '' + Date.now(); a0.statusCreatedAtMs = Reflect.apply(create, UInt64Value, [object]); } } function manageExpiringFocusMode() { // fn#120354, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15895:2272, owner: CustomStatusManager.manageExpiringFocusMode, offset: 0x02528d93, size: 260 bytes, params: 1, frame: 16 var Date; var value3; var prototype; var value4; var date; var time; var value7; var value8; var value9; const FocusModeExpiresAtSetting = (UserSettingsModule).FocusModeExpiresAtSetting; const setting = FocusModeExpiresAtSetting.getSetting(); if (setting == null) { if (env2_12 != null) { env2_12.stop(); } } else if (setting !== '0') { Date = global.Date; value3 = global.Number(setting); prototype = Date.prototype; value4 = Object.create(prototype, {constructor: {value: Date}}); date = new Date(); time = (date instanceof Object ? date : value4).getTime(); Date = global.Date; prototype = Date.prototype; value7 = Object.create(prototype, {constructor: {value: Date}}); date = new Date(); value8 = date instanceof Object ? date : value7; value9 = time - value8.getTime(); if (value9 > 0) { env2_12.start(value9, _fun120355, true); } else { (require(10916) /* metro dependency 10916: FocusModeUtils */).setFocusMode(false); env2_12.stop(); } } else if (env2_12 != null) { env2_12.stop(); } function _fun120355() { // fn#120355, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15895:2423, offset: 0x02528e97, size: 40 bytes, params: 1, frame: 12 const value = environment.__proto__.__proto__.__proto__; (FocusModeUtilsModule).setFocusMode(false); } } } } } global.__d(_fun120337, 15687, [7, 6, 15, 17, 18, 6876, 661, 4041, 3829, 10917, 1362, 1345, 10916, 4860, 2]) /* metro module 15687, dependencies: [7, 6, 15, 17, 18, 6876, 661, 4041, 3829, 10917, 1362, 1345, 10916, 4860, 2] */;