140 lines
7.3 KiB
TypeScript
140 lines
7.3 KiB
TypeScript
/* 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] */
|
|
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});
|
|
const env0_3 = importDefault(7) /* metro dependency 7 */;
|
|
const env0_4 = importDefault(6) /* metro dependency 6 */;
|
|
const env0_5 = importDefault(15) /* metro dependency 15 */;
|
|
const env0_6 = importDefault(17) /* metro dependency 17 */;
|
|
const env0_7 = importDefault(18) /* metro dependency 18 */;
|
|
const embeddedActivitiesStore = importDefault(1378) /* metro dependency 1378: EmbeddedActivitiesStore */;
|
|
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
|
|
const voiceStateStore = importDefault(4297) /* metro dependency 4297: VoiceStateStore */;
|
|
const sortedVoiceStateStore = importDefault(4300) /* metro dependency 4300: SortedVoiceStateStore */;
|
|
let value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
|
|
value = _fun120213(value);
|
|
value = new value();
|
|
(require(2) /* metro dependency 2 */).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 closure = CallIdleManager;
|
|
env0_7(closure, a0);
|
|
return env0_3(closure);
|
|
}
|
|
|
|
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 items = [];
|
|
arraySpread(items, value, 0, items);
|
|
value = env1_6(CallIdleManager);
|
|
binding = env1_5;
|
|
if (_isNativeReflectConstruct_120208()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value, items, env1_6(this).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value.apply(this, items);
|
|
r0 = value;
|
|
}
|
|
value = binding(this, r0);
|
|
const Timeout = (require(4041) /* metro dependency 4041: Timers */).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();
|
|
}
|
|
}
|
|
|