/* Metro module 15672; source: modules/voice_calls/CallIdleManager.tsx; dependencies: [7, 6, 15, 17, 18, 1378, 1379, 4297, 4300, 7067, 1244, 4796, 4041, 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 EmbeddedActivitiesStore from '../activities/EmbeddedActivitiesStore.tsx'; /* Metro dependency 1378 */ import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */ import VoiceStateStore from '../../stores/VoiceStateStore.tsx'; /* Metro dependency 4297 */ import SortedVoiceStateStore from '../../stores/views/SortedVoiceStateStore.tsx'; /* Metro dependency 4300 */ import AutomaticLifecycleManager from '../../lib/AutomaticLifecycleManager.tsx'; /* Metro dependency 4860 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as TimersModule from '../../external/discord_common/js/packages/timers/Timers.tsx'; /* Metro dependency 4041 */ function _fun120207(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#120207, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15880:6, offset: 0x025247d6, size: 316 bytes, params: 8, frame: 19 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = AutomaticLifecycleManager; value = _fun120213(value); value = new value(); (FileImportTrackerModule).fileFinishedImporting('modules/voice_calls/CallIdleManager.tsx'); exports.default = value; function _isNativeReflectConstruct_120208() { // fn#120208, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15880:188, offset: 0x02524912, 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_120208_isNativeReflectConstruct = function() { return !!result; })(); } function isIdle() { // fn#120211, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15880:392, offset: 0x02524974, size: 144 bytes, params: 1, frame: 16 const currentClientVoiceChannelId = VoiceStateStore.getCurrentClientVoiceChannelId(null); if (currentClientVoiceChannelId == null) { return false; } const channel = ChannelStore.getChannel(currentClientVoiceChannelId); return !(channel == null || !channel.isPrivate()) && (!(channel.recipients.length > 1) && (!(SortedVoiceStateStore.countVoiceStatesForChannel(currentClientVoiceChannelId) > 1) && EmbeddedActivitiesStore.getSelfEmbeddedActivityForChannel(currentClientVoiceChannelId) == null)); } function disconnect_120212() { // fn#120212, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15880:644, offset: 0x02524a04, size: 161 bytes, params: 1, frame: 21 var currentClientVoiceChannelId; var defaultImport; var sendBotMessage; var intl; if (isIdle()) { currentClientVoiceChannelId = VoiceStateStore.getCurrentClientVoiceChannelId(null); if (currentClientVoiceChannelId != null) { defaultImport = importDefault(7067) /* metro dependency 7067: MessageActionCreators */; sendBotMessage = defaultImport.sendBotMessage; intl = (require(1244) /* metro dependency 1244: indexNative */).intl; Reflect.apply(sendBotMessage, defaultImport, [currentClientVoiceChannelId, intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.XYof5G, {number: 3})]); (importDefault(4796) /* metro dependency 4796: SelectedChannelActionCreators */).selectVoiceChannel(null); } } } function _fun120213(a0) { // fn#120213, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15880:870, offset: 0x02524aa5, size: 42 bytes, params: 2, frame: 14 const CallIdleManager2 = CallIdleManager; Inherits(CallIdleManager2, a0); return CreateClass(CallIdleManager2); function CallIdleManager(a0) { // fn#120214, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15880:882, offset: 0x02524acf, size: 264 bytes, params: 2, frame: 21 var r0; var Reflect; let value = copyRestArgs(0, undefined); let binding = env1_4; binding(this, CallIdleManager); const items2 = []; arraySpread(items2, value, 0, items2); value = env1_6(CallIdleManager); binding = env1_5; if (_isNativeReflectConstruct_120208()) { 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); const Timeout = (TimersModule).Timeout; const value4 = Object.create(Timeout.prototype, {constructor: {value: Timeout}}); const timeout = new Timeout(); value.idleTimeout = timeout instanceof Object ? timeout : value4; value.handleConnectionClosed = handleConnectionClosed_120215; value.handleEmbeddedActivityDisconnect = handleEmbeddedActivityDisconnect; value.handleVoiceStateUpdates = handleVoiceStateUpdates_120217; var handleEmbeddedActivityDisconnect = value.handleEmbeddedActivityDisconnect; value.actions = {VOICE_STATE_UPDATES: value.handleVoiceStateUpdates, CONNECTION_CLOSED: value.handleConnectionClosed, EMBEDDED_ACTIVITY_CLOSE: handleEmbeddedActivityDisconnect}; return value; function CallIdleManagerHandleConnectionClosed() { // fn#120215, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15880:1174, owner: CallIdleManager.handleConnectionClosed, offset: 0x02524bd7, size: 27 bytes, params: 1, frame: 9 env0_0.idleTimeout.stop(); } function handleEmbeddedActivityDisconnect() { // fn#120216, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15880:1236, owner: CallIdleManager.handleEmbeddedActivityDisconnect, offset: 0x02524bf2, size: 55 bytes, params: 1, frame: 16 var idleTimeout; if (isIdle()) { idleTimeout = env0_0.idleTimeout; idleTimeout.start(180000, disconnect_120212, true); } } function CallIdleManagerHandleVoiceStateUpdates() { // fn#120217, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15880:1315, owner: CallIdleManager.handleVoiceStateUpdates, offset: 0x02524c29, size: 67 bytes, params: 1, frame: 16 const isIdle2 = isIdle(); const idleTimeout = env0_0.idleTimeout; if (isIdle2) { idleTimeout.start(180000, disconnect_120212, false); } else { idleTimeout.stop(); } } } } } global.__d(_fun120207, 15672, [7, 6, 15, 17, 18, 1378, 1379, 4297, 4300, 7067, 1244, 4796, 4041, 4860, 2]) /* metro module 15672, dependencies: [7, 6, 15, 17, 18, 1378, 1379, 4297, 4300, 7067, 1244, 4796, 4041, 4860, 2] */;