Files
discord-decomp/sources/modules/voice_overlay/native/MobileVoiceOverlayLifecycleManager.android.tsx
T
2026-07-28 01:06:53 +03:00

882 lines
49 KiB
TypeScript

/* Metro module 13071; source: modules/voice_overlay/native/MobileVoiceOverlayLifecycleManager.android.tsx; dependencies: [15, 17, 18, 6, 7, 1379, 1935, 1867, 4259, 3784, 4294, 3793, 4607, 1878, 4297, 10815, 661, 13072, 13073, 13074, 13075, 8160, 12107, 13076, 13077, 8146, 1244, 13078, 10822, 4020, 7145, 4805, 6526, 683, 4863, 63, 4561, 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 AnalyticsUtils from '../../../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */
import ChannelStore from '../../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import GuildStore from '../../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
import UserStore from '../../../stores/UserStore.tsx'; /* Metro dependency 1878 */
import PermissionStore from '../../../stores/PermissionStore.tsx'; /* Metro dependency 3784 */
import RelationshipStore from '../../../stores/RelationshipStore.tsx'; /* Metro dependency 3793 */
import MediaEngineStore from '../../../stores/MediaEngineStore.tsx'; /* Metro dependency 4259 */
import RTCConnectionStore from '../../../stores/RTCConnectionStore.tsx'; /* Metro dependency 4294 */
import VoiceStateStore from '../../../stores/VoiceStateStore.tsx'; /* Metro dependency 4297 */
import SpeakingStore from '../../../stores/SpeakingStore.tsx'; /* Metro dependency 4607 */
import AutocompleteUtils from '../../../utils/AutocompleteUtils.tsx'; /* Metro dependency 6526 */
import MobileVoiceOverlayStore from '../../../stores/native/MobileVoiceOverlayStore.tsx'; /* Metro dependency 10815 */
import MobileVoiceOverlayActionCreators from './MobileVoiceOverlayActionCreators.tsx'; /* Metro dependency 10822 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as GuildChannelStoreModule from '../../../stores/GuildChannelStore.tsx'; /* Metro dependency 1935 */
import * as FabricUtilsModule from '../../../utils/native/FabricUtils.tsx'; /* Metro dependency 4020 */
import * as UseChannelNameModule from '../../channel/useChannelName.tsx'; /* Metro dependency 4805 */
import * as AppAnalyticsUtilsModule from '../../app_analytics/AppAnalyticsUtils.tsx'; /* Metro dependency 4863 */
import * as Module08146Module from '../../../by-id/module-08146.js'; /* Metro dependency 8146 */
import * as Module08160Module from '../../../by-id/module-08160.js'; /* Metro dependency 8160 */
import * as Module12107Module from '../../../by-id/module-12107.js'; /* Metro dependency 12107 */
import * as Module13072Module from '../../../by-id/module-13072.js'; /* Metro dependency 13072 */
import * as Module13073Module from '../../../by-id/module-13073.js'; /* Metro dependency 13073 */
import * as Module13074Module from '../../../by-id/module-13074.js'; /* Metro dependency 13074 */
import * as Module13075Module from '../../../by-id/module-13075.js'; /* Metro dependency 13075 */
import * as Module13076Module from '../../../by-id/module-13076.js'; /* Metro dependency 13076 */
import * as Module13077Module from '../../../by-id/module-13077.js'; /* Metro dependency 13077 */
function _fun99852(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#99852, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:6, offset: 0x021d74b7, size: 1284 bytes, params: 8, frame: 25
const env0_0 = require;
const _arrayLikeToArray_99858 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = MediaEngineStore;
Module13072Module;
Module13073Module;
Module13074Module;
Module13075Module;
Module08160Module;
Module12107Module;
Module13076Module;
Module13077Module;
Module08146Module;
object = [VoiceStateStore, RTCConnectionStore, value];
object = {DISABLED: 0};
object[0] = 'DISABLED';
object.NOT_SHOWING = 1;
object[1] = 'NOT_SHOWING';
object.WAITING_FOR_SERVICE = 2;
object[2] = 'WAITING_FOR_SERVICE';
object.SHOWING = 3;
object[3] = 'SHOWING';
object = {};
const intl = (IndexNativeModule).intl;
let string = intl.string;
const t = (IndexNativeModule).t;
const CVxXDM = t.CVxXDM;
object.useSpeaker = Reflect.apply(string, intl, [CVxXDM]);
object.mute = intl.string(t.w4m945);
object.disconnectFromVoice = intl.string(t['/lEZpt']);
string = intl.string;
const JYzIWe = t.JYzIWe;
object.getInvite = Reflect.apply(string, intl, [JYzIWe]);
object.switchChannels = intl.string(t.zJvWqU);
object.openDiscord = intl.string(t['G/Ez6p']);
string = intl.string;
const OhctG7 = t.OhctG7;
object.inviteLinkCopied = Reflect.apply(string, intl, [OhctG7]);
object.channelSelect = intl.string(t.r2ptsz);
object.closeWindow = intl.string(t.gaifwY);
object.searchChannels = intl.string(t.wM7uRI);
object.noResults = intl.string(t.wk3qsA);
value = _fun99859();
value = new value();
const env0_25 = _fun99889();
value = importDefault(4561) /* metro dependency 4561: LifecycleManager */;
value = _fun99893(value);
value = new value();
(FileImportTrackerModule).fileFinishedImporting('modules/voice_overlay/native/MobileVoiceOverlayLifecycleManager.android.tsx');
exports.default = value;
function _isNativeReflectConstruct_99853() { // fn#99853, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:339, offset: 0x021d79bb, 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_99853_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _createForOfIteratorHelperLoose_99856(a0, a1) { // fn#99856, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:532, offset: 0x021d7a1d, size: 372 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun99857;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_99858(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_99858(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_99858(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun99857;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
function _fun99857() { // fn#99857, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:1103, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
return env0_1 >= env0_0.length ? {done: true} : {done: false,
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
}
}
function _fun99859() { // fn#99859, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:2330, offset: 0x021d7b91, size: 84 bytes, params: 1, frame: 15
return CreateClass(MobileVoiceOverlayManager, [{key: 'initialize', value: value_99887}, {key: 'terminate',
value: function() {
MobileVoiceOverlayStore.removeChangeListener(this.handleMobileVoiceOverlayStoreUpdate);
this.unsubscribeFromVoiceStateStoreUpdates();
this.unsubscribeFromNativeEvents();
}}]);
function MobileVoiceOverlayManager() { // fn#99860, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:2351, offset: 0x021d7be5, size: 314 bytes, params: 1, frame: 15
env1_6(this, MobileVoiceOverlayManager);
this.currentVoiceChannelId = null;
this.trashedVoiceChannelId = null;
const DISABLED = env1_22.DISABLED;
this.overlayState = DISABLED;
this.channelSelectorResults = [];
this.layoutTrashedSubscription = null;
this.channelQueryUpdateSubscription = null;
this.isBatchedBridgeInitialized = false;
this.handleMobileVoiceOverlayStoreUpdate = handleMobileVoiceOverlayStoreUpdate;
this.handleOverlayEnable = handleOverlayEnable;
this.subscribeToVoiceStateStoreUpdates = subscribeToVoiceStateStoreUpdates;
this.unsubscribeFromVoiceStateStoreUpdates = unsubscribeFromVoiceStateStoreUpdates;
this.isSubscribedToVoiceStateStoreUpdates = isSubscribedToVoiceStateStoreUpdates;
this.subscribeToNativeEvents = subscribeToNativeEvents;
this.unsubscribeFromNativeEvents = unsubscribeFromNativeEvents;
this.handleOverlayUIStoreUpdate = handleOverlayUIStoreUpdate;
this.updateOverlayUI = updateOverlayUI;
this.getVoiceConnectedGuildAndChannel = getVoiceConnectedGuildAndChannel;
this.refreshChannelSelectorResults = refreshChannelSelectorResults;
this.showOverlay = showOverlay;
this.hideOverlay = hideOverlay;
this.isOverlayShowing = isOverlayShowing;
this.getOverlayUser = getOverlayUser;
this.handleLayoutTrashed = handleLayoutTrashed;
this.handleChannelQueryUpdate = handleChannelQueryUpdate;
function handleMobileVoiceOverlayStoreUpdate() { // fn#99861, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:2699, owner: MobileVoiceOverlayManager.handleMobileVoiceOverlayStoreUpdate, offset: 0x021d7d1f, size: 147 bytes, params: 1, frame: 14
var isOverlayShowing2;
const value = environment.__proto__.__proto__;
const enabled = MobileVoiceOverlayStore.getEnabled();
const binding = env0_0;
if (enabled) {
binding.handleOverlayEnable();
} else {
binding.unsubscribeFromVoiceStateStoreUpdates();
binding.unsubscribeFromNativeEvents();
isOverlayShowing2 = binding.isOverlayShowing();
binding.overlayState = env2_22.DISABLED;
if (isOverlayShowing2) {
if ((importDefault(13078) /* metro dependency 13078: NativeMobileVoiceOverlayModule */) != null) {
(importDefault(13078) /* metro dependency 13078: NativeMobileVoiceOverlayModule */).hideOverlay();
}
}
}
}
function handleOverlayEnable() { // fn#99862, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:2964, owner: MobileVoiceOverlayManager.handleOverlayEnable, offset: 0x021d7db2, size: 110 bytes, params: 1, frame: 14
var environment;
let value = environment.__proto__.__proto__;
if ((importDefault(13078) /* metro dependency 13078: NativeMobileVoiceOverlayModule */) != null) {
value = importDefault(13078) /* metro dependency 13078: NativeMobileVoiceOverlayModule */;
value = value.enableOverlay();
value = value.then(_fun99864);
value.catch(function() {
handleEnableFail();
});
}
function handleEnableFail() { // fn#99863, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:2990, owner: MobileVoiceOverlayManager.handleOverlayEnable.handleEnableFail, offset: 0x021d7e20, size: 63 bytes, params: 1, frame: 13
(MobileVoiceOverlayActionCreators).setEnabled(false);
const binding = env1_0;
const DISABLED = env3_22.DISABLED;
binding.overlayState = DISABLED;
}
function _fun99864(a0) { // fn#99864, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:3096, offset: 0x021d7e5f, size: 71 bytes, params: 2, frame: 9
var value;
var binding;
if (a0) {
value = environment.__proto__;
binding = env1_0;
binding.subscribeToVoiceStateStoreUpdates();
binding.subscribeToNativeEvents();
value = environment.__proto__.__proto__.__proto__;
binding.overlayState = env3_22.NOT_SHOWING;
} else {
handleEnableFail();
}
}
}
function subscribeToVoiceStateStoreUpdates() { // fn#99866, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:3304, owner: MobileVoiceOverlayManager.subscribeToVoiceStateStoreUpdates, offset: 0x021d7ea6, size: 50 bytes, params: 1, frame: 11
var environment;
const binding = env0_0;
if (!binding.isSubscribedToVoiceStateStoreUpdates()) {
value = environment.__proto__.__proto__;
env2_21.forEach(_fun99867);
}
function _fun99867(a0) { // fn#99867, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:3365, offset: 0x021d7ed8, size: 31 bytes, params: 2, frame: 11
a0.addChangeListener(env1_0.handleOverlayUIStoreUpdate);
}
}
function unsubscribeFromVoiceStateStoreUpdates() { // fn#99868, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:3469, owner: MobileVoiceOverlayManager.unsubscribeFromVoiceStateStoreUpdates, offset: 0x021d7ef7, size: 50 bytes, params: 1, frame: 11
var environment;
const binding = env0_0;
if (binding.isSubscribedToVoiceStateStoreUpdates()) {
value = environment.__proto__.__proto__;
env2_21.forEach(_fun99869);
}
function _fun99869(a0) { // fn#99869, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:3530, offset: 0x021d7f29, size: 31 bytes, params: 2, frame: 11
a0.removeChangeListener(env1_0.handleOverlayUIStoreUpdate);
}
}
function isSubscribedToVoiceStateStoreUpdates() { // fn#99870, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:3636, owner: MobileVoiceOverlayManager.isSubscribedToVoiceStateStoreUpdates, offset: 0x021d7f48, size: 35 bytes, params: 1, frame: 11
var environment;
const value = environment.__proto__.__proto__;
return env2_21.find(_fun99871) != null;
function _fun99871({_changeCallbacks}) { // fn#99871, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:3654, offset: 0x021d7f6b, size: 34 bytes, params: 2, frame: 11
return _changeCallbacks.has(env1_0.handleOverlayUIStoreUpdate);
}
}
function subscribeToNativeEvents() { // fn#99872, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:3744, owner: MobileVoiceOverlayManager.subscribeToNativeEvents, offset: 0x021d7f8d, size: 126 bytes, params: 1, frame: 16
var binding;
let value = environment.__proto__.__proto__;
if (FabricUtilsModule.isFabric()) {
binding = env0_0;
value = importDefault(13078) /* metro dependency 13078: NativeMobileVoiceOverlayModule */;
binding.layoutTrashedSubscription = value.onLayoutTrashed(binding.handleLayoutTrashed);
value = importDefault(13078) /* metro dependency 13078: NativeMobileVoiceOverlayModule */;
binding.channelQueryUpdateSubscription = value.onChannelQueryUpdate(binding.handleChannelQueryUpdate);
}
}
function unsubscribeFromNativeEvents() { // fn#99873, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:3986, owner: MobileVoiceOverlayManager.unsubscribeFromNativeEvents, offset: 0x021d800b, size: 93 bytes, params: 1, frame: 13
var layoutTrashedSubscription;
var channelQueryUpdateSubscription;
let value = environment.__proto__.__proto__;
value = require(4020) /* metro dependency 4020: FabricUtils */;
if (value.isFabric()) {
layoutTrashedSubscription = env0_0.layoutTrashedSubscription;
if (layoutTrashedSubscription != null) {
layoutTrashedSubscription.remove();
}
channelQueryUpdateSubscription = env0_0.channelQueryUpdateSubscription;
if (channelQueryUpdateSubscription != null) {
channelQueryUpdateSubscription.remove();
}
}
}
function handleOverlayUIStoreUpdate() { // fn#99874, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:4167, owner: MobileVoiceOverlayManager.handleOverlayUIStoreUpdate, offset: 0x021d8068, size: 297 bytes, params: 1, frame: 14
var r0;
var value3;
const overlayState = env0_0.overlayState;
const DISABLED = env2_22.DISABLED;
if (overlayState !== DISABLED) {
var binding = env0_0;
var getVoiceConnectedGuildAndChannel = binding.getVoiceConnectedGuildAndChannel;
var currentVoiceChannelId = Reflect.apply(getVoiceConnectedGuildAndChannel, binding, []).currentVoiceChannelId;
if (currentVoiceChannelId !== binding.currentVoiceChannelId) {
binding = env0_0;
binding.currentVoiceChannelId = currentVoiceChannelId;
binding.trashedVoiceChannelId = null;
}
if (currentVoiceChannelId == null) {
binding = env0_0;
if (binding.isOverlayShowing()) {
env0_0.hideOverlay();
}
return undefined;
}
if (currentVoiceChannelId !== env0_0.trashedVoiceChannelId) {
if (env0_0.overlayState !== env2_22.WAITING_FOR_SERVICE) {
if (env0_0.overlayState === env2_22.NOT_SHOWING) {
value3 = undefined;
(importDefault(7145) /* metro dependency 7145: ForegroundServiceManagerAndroid */).isForegroundServiceRunning(_fun99875);
env0_0.overlayState = env2_22.WAITING_FOR_SERVICE;
r0 = value3;
} else {
if (env0_0.overlayState === env2_22.SHOWING) {
env0_0.updateOverlayUI();
}
r0 = undefined;
}
return r0;
}
return undefined;
}
binding = env0_0;
if (binding.isOverlayShowing()) {
env0_0.hideOverlay();
}
}
function _fun99875(a0) { // fn#99875, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:4538, offset: 0x021d8191, size: 48 bytes, params: 2, frame: 9
const binding = env1_0;
if (a0) {
binding.showOverlay();
} else {
value = environment.__proto__.__proto__.__proto__;
binding.overlayState = env3_22.NOT_SHOWING;
}
}
}
function updateOverlayUI() { // fn#99876, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:4777, owner: MobileVoiceOverlayManager.updateOverlayUI, offset: 0x021d81c1, size: 738 bytes, params: 1, frame: 29
var id;
var r3;
var r14;
var r13;
var userId;
var name;
var r11;
var value5;
var binding;
var getVoiceConnectedGuildAndChannel;
var value6;
var currentGuildId;
var currentVoiceChannelId;
var channelStoreBinding;
var getChannel;
var value7;
var getOverlayUser;
var value8;
var voiceStateStoreBinding;
var getVoiceStatesForChannel;
var value9;
var Object;
var keys;
var value10;
var speaking;
var value11;
var value12;
var done;
var value13;
var value14;
var value15;
var items2;
var userId2;
var push;
var length;
var value16;
var property;
var value17;
var value18;
var overlayState;
var SHOWING;
var refreshChannelSelectorResults;
var defaultImport;
var setData;
var object;
var moduleValue;
var computeChannelName;
var guildStoreBinding;
var getGuild;
var value19;
var value20;
var length2;
var mediaEngineStoreBinding;
var isSelfDeaf;
var isSelfMute;
var rtcConnectionStoreBinding;
var getQuality;
var permissionStoreBinding;
var can;
var CREATE_INSTANT_INVITE;
var channelSelectorResults;
const currentUser = UserStore.getCurrentUser();
const value3 = null;
const value4 = undefined;
reducibleJoin2: while (true) {
if (value3 == currentUser) {
id = value4;
break reducibleJoin2;
}
id = currentUser.id;
break reducibleJoin2;
}
reducibleJoin29: while (true) {
if (value3 == id) {
break reducibleJoin29;
}
value5 = environment;
binding = env0_0;
getVoiceConnectedGuildAndChannel = binding.getVoiceConnectedGuildAndChannel;
value6 = Reflect.apply(getVoiceConnectedGuildAndChannel, binding, []);
currentGuildId = value6.currentGuildId;
currentVoiceChannelId = value6.currentVoiceChannelId;
channelStoreBinding = ChannelStore;
getChannel = channelStoreBinding.getChannel;
value7 = Reflect.apply(getChannel, channelStoreBinding, [currentVoiceChannelId]);
if (value3 == currentVoiceChannelId) {
break reducibleJoin29;
}
if (value3 == value7) {
break reducibleJoin29;
}
binding = env0_0;
getOverlayUser = binding.getOverlayUser;
value8 = Reflect.apply(getOverlayUser, binding, [id]);
if (value3 == value8) {
break reducibleJoin29;
}
voiceStateStoreBinding = VoiceStateStore;
getVoiceStatesForChannel = voiceStateStoreBinding.getVoiceStatesForChannel;
value9 = Reflect.apply(getVoiceStatesForChannel, voiceStateStoreBinding, [currentVoiceChannelId]);
Object = global.Object;
keys = Object.keys;
value10 = Reflect.apply(keys, Object, [value9]);
speaking = value8.speaking;
reducibleJoin11: while (true) {
if (speaking) {
r14 = value8;
break reducibleJoin11;
}
value11 = _createForOfIteratorHelperLoose_99856(value10);
value12 = value11();
done = value12.done;
if (done) {
r14 = value3;
break reducibleJoin11;
}
r3 = value12;
reducibleLoop8: while (true) {
value13 = r3.value;
binding = env0_0;
getOverlayUser = binding.getOverlayUser;
value14 = Reflect.apply(getOverlayUser, binding, [value13]);
if (value3 != value14) {
speaking = value14.speaking;
reducibleJoin10: while (true) {
if (speaking) {
r14 = value14;
break reducibleJoin11;
}
break reducibleJoin10;
}
}
value15 = value11();
done = value15.done;
if (done) {
r14 = value3;
break reducibleJoin11;
}
r3 = value15;
continue reducibleLoop8;
}
}
if (value3 == r14) {
r14 = value8;
}
items2 = [r14];
userId = r14.userId;
userId2 = value8.userId;
reducibleJoin14: while (true) {
if (userId === userId2) {
break reducibleJoin14;
}
push = items2.push;
Reflect.apply(push, items2, [value8]);
break reducibleJoin14;
}
length = value10.length;
value16 = 0;
if (value16 < length) {
r13 = value16;
reducibleLoop15: while (true) {
property = value10[r13];
if (property !== id) {
reducibleJoin18: while (true) {
if (value3 == r14) {
userId = value4;
break reducibleJoin18;
}
userId = r14.userId;
break reducibleJoin18;
}
reducibleJoin21: while (true) {
if (property === userId) {
break reducibleJoin21;
}
binding = env0_0;
getOverlayUser = binding.getOverlayUser;
value17 = Reflect.apply(getOverlayUser, binding, [property]);
if (value3 == value17) {
break reducibleJoin21;
}
push = items2.push;
Reflect.apply(push, items2, [value17]);
length = items2.length;
if (length >= 3) {
break reducibleLoop15;
}
break reducibleJoin21;
}
}
value18 = typeof r13 === 'bigint' ? r13 + 1n : +r13 + 1;
length = value10.length;
if (value18 < length) {
r13 = value18;
continue reducibleLoop15;
}
break reducibleLoop15;
}
}
overlayState = env0_0.overlayState;
SHOWING = env2_22.SHOWING;
reducibleJoin24: while (true) {
if (overlayState === SHOWING) {
break reducibleJoin24;
}
binding = env0_0;
refreshChannelSelectorResults = binding.refreshChannelSelectorResults;
Reflect.apply(refreshChannelSelectorResults, binding, ['']);
break reducibleJoin24;
}
env0_0.currentVoiceChannelId = currentVoiceChannelId;
if (value3 == (importDefault(13078) /* metro dependency 13078: NativeMobileVoiceOverlayModule */)) {
break reducibleJoin29;
}
defaultImport = importDefault(13078) /* metro dependency 13078: NativeMobileVoiceOverlayModule */;
setData = defaultImport.setData;
object = {users: items2};
moduleValue = require(4805) /* metro dependency 4805: useChannelName */;
computeChannelName = moduleValue.computeChannelName;
object.channelName = Reflect.apply(computeChannelName, moduleValue, [value7, UserStore, RelationshipStore]);
guildStoreBinding = GuildStore;
getGuild = guildStoreBinding.getGuild;
value19 = Reflect.apply(getGuild, guildStoreBinding, [currentGuildId]);
reducibleJoin27: while (true) {
if (value3 == value19) {
name = value4;
break reducibleJoin27;
}
name = value19.name;
break reducibleJoin27;
}
value20 = '';
r11 = value3 != name ? name : value20;
object.guildName = r11;
object.guildId = currentGuildId;
object.channelId = currentVoiceChannelId;
length = value10.length;
length2 = items2.length;
object.extraUsers = length - length2;
mediaEngineStoreBinding = mediaEngineStore;
isSelfDeaf = mediaEngineStoreBinding.isSelfDeaf;
object.deafened = Reflect.apply(isSelfDeaf, mediaEngineStoreBinding, []);
isSelfMute = mediaEngineStoreBinding.isSelfMute;
object.muted = Reflect.apply(isSelfMute, mediaEngineStoreBinding, []);
rtcConnectionStoreBinding = RTCConnectionStore;
getQuality = rtcConnectionStoreBinding.getQuality;
object.connectionQuality = Reflect.apply(getQuality, rtcConnectionStoreBinding, []);
permissionStoreBinding = PermissionStore;
can = permissionStoreBinding.can;
CREATE_INSTANT_INVITE = Permissions.CREATE_INSTANT_INVITE;
object.canGenerateInvite = Reflect.apply(can, permissionStoreBinding, [CREATE_INSTANT_INVITE, value7]);
channelSelectorResults = env0_0.channelSelectorResults;
object.channelSelectorResults = channelSelectorResults;
Reflect.apply(setData, defaultImport, [object]);
break reducibleJoin29;
}
return value4;
}
function getVoiceConnectedGuildAndChannel() { // fn#99877, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:5983, owner: MobileVoiceOverlayManager.getVoiceConnectedGuildAndChannel, offset: 0x021d84a3, size: 71 bytes, params: 1, frame: 13
const object = {};
let value = environment.__proto__.__proto__;
const guildId = RTCConnectionStore.getGuildId();
const value3 = null;
object.currentGuildId = value3 != guildId ? guildId : value3;
value = RTCConnectionStore.getChannelId();
object.currentVoiceChannelId = value3 != value ? value : value3;
return object;
}
function refreshChannelSelectorResults(a0) { // fn#99878, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:6143, owner: MobileVoiceOverlayManager.refreshChannelSelectorResults, offset: 0x021d84ea, size: 158 bytes, params: 2, frame: 17
var environment;
const currentGuildId = a0.length !== 0 ? null : env0_0.getVoiceConnectedGuildAndChannel().currentGuildId;
const binding = env0_0;
value = environment.__proto__.__proto__;
const defaultImport = AutocompleteUtils;
binding.channelSelectorResults = defaultImport.queryChannels({query: a0, guildId: currentGuildId, limit: 15,
fuzzy: true, filter: filter_99879, type: GUILD_VOCAL_CHANNELS_KEY, allowEmptyQueries: true}).map(_fun99880);
function refreshChannelSelectorResultsFilter(a0) { // fn#99879, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:6321, owner: MobileVoiceOverlayManager.refreshChannelSelectorResults.filter, offset: 0x021d8588, size: 43 bytes, params: 2, frame: 10
const id = a0.id;
const value = environment.__proto__;
return id !== env1_0.currentVoiceChannelId && !a0.isGuildStageVoice();
}
function _fun99880({record}) { // fn#99880, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:6417, offset: 0x021d85b3, size: 210 bytes, params: 2, frame: 20
var r1;
var moduleValue2;
const object = {};
object.channelId = record.id;
object.guildId = record.guild_id;
const value = environment.__proto__.__proto__.__proto__;
object.channelName = UseChannelNameModule.computeChannelName(record, UserStore, RelationshipStore);
const name = GuildStore.getGuild(record.guild_id)?.name;
const value4 = '';
object.guildName = name ?? value4;
const channel = ChannelStore.getChannel(record.parent_id);
if (channel != null) {
moduleValue2 = UseChannelNameModule;
r1 = moduleValue2.computeChannelName(channel, UserStore, RelationshipStore);
} else {
r1 = value4;
}
object.categoryName = r1;
return object;
}
}
function showOverlay() { // fn#99881, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:6715, owner: MobileVoiceOverlayManager.showOverlay, offset: 0x021d8685, size: 261 bytes, params: 1, frame: 24
let binding = env0_0;
const voiceConnectedGuildAndChannel = binding.getVoiceConnectedGuildAndChannel();
const currentGuildId = voiceConnectedGuildAndChannel.currentGuildId;
const channel = ChannelStore.getChannel(voiceConnectedGuildAndChannel.currentVoiceChannelId);
const rTCConnectionId = RTCConnectionStore.getRTCConnectionId();
const defaultImport = AnalyticsUtils;
const track = defaultImport.track;
const MOBILE_OVERLAY_OPENED = AnalyticEvents.MOBILE_OVERLAY_OPENED;
const object = {type: 'voice', rtc_connection_id: rTCConnectionId};
copyDataProperties(object, AppAnalyticsUtilsModule.collectChannelAnalyticsMetadata(channel), channel);
copyDataProperties(object, AppAnalyticsUtilsModule.collectGuildAnalyticsMetadata(currentGuildId), channel);
Reflect.apply(track, defaultImport, [MOBILE_OVERLAY_OPENED, object]);
if ((importDefault(13078) /* metro dependency 13078: NativeMobileVoiceOverlayModule */) != null) {
(importDefault(13078) /* metro dependency 13078: NativeMobileVoiceOverlayModule */).showOverlay(env2_23);
}
binding = env0_0;
binding.updateOverlayUI();
const SHOWING = env2_22.SHOWING;
binding.overlayState = SHOWING;
}
function hideOverlay() { // fn#99882, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:7132, owner: MobileVoiceOverlayManager.hideOverlay, offset: 0x021d878a, size: 173 bytes, params: 1, frame: 21
const rTCConnectionId = RTCConnectionStore.getRTCConnectionId();
const defaultImport = AnalyticsUtils;
let track = defaultImport.track;
let MOBILE_OVERLAY_CLOSED = AnalyticEvents.MOBILE_OVERLAY_CLOSED;
Reflect.apply(track, defaultImport, [MOBILE_OVERLAY_CLOSED, {type: 'voice', rtc_connection_id: rTCConnectionId}]);
const defaultImport2 = defaultImport;
track = defaultImport2.track;
MOBILE_OVERLAY_CLOSED = AnalyticEvents.MOBILE_OVERLAY_CLOSED;
Reflect.apply(track, defaultImport2, [MOBILE_OVERLAY_CLOSED, {}]);
if ((importDefault(13078) /* metro dependency 13078: NativeMobileVoiceOverlayModule */) != null) {
(importDefault(13078) /* metro dependency 13078: NativeMobileVoiceOverlayModule */).hideOverlay();
}
const binding = env0_0;
const NOT_SHOWING = env2_22.NOT_SHOWING;
binding.overlayState = NOT_SHOWING;
}
function isOverlayShowing() { // fn#99883, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:7378, owner: MobileVoiceOverlayManager.isOverlayShowing, offset: 0x021d8837, size: 59 bytes, params: 1, frame: 4
const overlayState = env0_0.overlayState;
const SHOWING = env2_22.SHOWING;
return overlayState === SHOWING || env0_0.overlayState === env2_22.WAITING_FOR_SERVICE;
}
function getOverlayUser(a0) { // fn#99884, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:7475, owner: MobileVoiceOverlayManager.getOverlayUser, offset: 0x021d8872, size: 79 bytes, params: 2, frame: 13
const value = environment.__proto__.__proto__;
const user = UserStore.getUser(a0);
if (user == null) {
return null;
}
return {userId: a0, avatar: user.avatar, speaking: SpeakingStore.isSpeaking(a0), discriminator: user.discriminator};
}
function handleLayoutTrashed() { // fn#99885, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:7643, owner: MobileVoiceOverlayManager.handleLayoutTrashed, offset: 0x021d88c1, size: 33 bytes, params: 1, frame: 9
const binding = env0_0;
binding.trashedVoiceChannelId = binding.currentVoiceChannelId;
binding.handleOverlayUIStoreUpdate();
}
function handleChannelQueryUpdate(a0) { // fn#99886, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:7767, owner: MobileVoiceOverlayManager.handleChannelQueryUpdate, offset: 0x021d88e2, size: 35 bytes, params: 2, frame: 11
const binding = env0_0;
binding.refreshChannelSelectorResults(a0);
binding.handleOverlayUIStoreUpdate();
}
}
function value_99887() { // fn#99887, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:7871, offset: 0x021d8905, size: 173 bytes, params: 1, frame: 16
var defaultImport;
var registerCallableModule;
var binding;
var value2;
var binding2;
if (!((require(4020) /* metro dependency 4020: FabricUtils */).isFabric() || this.isBatchedBridgeInitialized)) {
defaultImport = importDefault(63) /* metro dependency 63 */;
registerCallableModule = defaultImport.registerCallableModule;
binding = env1_25;
value2 = Object.create(binding.prototype, {constructor: {value: binding}});
binding2 = new binding(this);
Reflect.apply(registerCallableModule, defaultImport, ['MobileVoiceOverlayManager',
binding2 instanceof Object ? binding2 : value2]);
this.isBatchedBridgeInitialized = true;
}
let mobileVoiceOverlayStoreBinding = MobileVoiceOverlayStore;
const getEnabled = mobileVoiceOverlayStoreBinding.getEnabled;
if (Reflect.apply(getEnabled, mobileVoiceOverlayStoreBinding, [])) {
this.handleOverlayEnable();
}
mobileVoiceOverlayStoreBinding = MobileVoiceOverlayStore;
mobileVoiceOverlayStoreBinding.addChangeListener(this.handleMobileVoiceOverlayStoreUpdate);
}
}
function _fun99889() { // fn#99889, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:8343, offset: 0x021d89e5, size: 88 bytes, params: 1, frame: 15
return CreateClass(NativeCallableInterface, [{key: 'onLayoutTrashed', value: function() {
this.manager.handleLayoutTrashed();
}}, {key: 'onChannelQueryUpdate', value: function(a0) {
this.manager.handleChannelQueryUpdate(a0);
}}]);
function NativeCallableInterface(a0) { // fn#99890, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:8364, offset: 0x021d8a3d, size: 36 bytes, params: 2, frame: 13
env1_6(this, NativeCallableInterface);
this.manager = a0;
}
}
function _fun99893(a0) { // fn#99893, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:8623, offset: 0x021d8a93, size: 97 bytes, params: 2, frame: 16
const MobileVoiceOverlayLifecycleManager2 = MobileVoiceOverlayLifecycleManager;
Inherits(MobileVoiceOverlayLifecycleManager2, a0);
return CreateClass(MobileVoiceOverlayLifecycleManager2, [{key: '_initialize', value: value_99895}, {key: '_terminate',
value: value_99896}]);
function MobileVoiceOverlayLifecycleManager() { // fn#99894, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:8635, offset: 0x021d8af4, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_6(this, MobileVoiceOverlayLifecycleManager);
const value3 = env1_4(MobileVoiceOverlayLifecycleManager);
return env1_3(this, _isNativeReflectConstruct_99853() ? global.Reflect.construct(value3, arguments,
env1_4(this).constructor) : value3.apply(this, arguments));
}
function value_99895() { // fn#99895, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:9024, offset: 0x021d8b65, size: 21 bytes, params: 1, frame: 9
env1_24.initialize();
}
function value_99896() { // fn#99896, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13261:9076, offset: 0x021d8b7a, size: 21 bytes, params: 1, frame: 9
env1_24.terminate();
}
}
}
global.__d(_fun99852, 13071, [15, 17, 18, 6, 7, 1379, 1935, 1867, 4259, 3784, 4294, 3793, 4607, 1878, 4297, 10815,
661, 13072, 13073, 13074, 13075, 8160, 12107, 13076, 13077, 8146, 1244, 13078, 10822, 4020, 7145, 4805, 6526,
683, 4863, 63, 4561,
2]) /* metro module 13071, dependencies: [15, 17, 18, 6, 7, 1379, 1935, 1867, 4259, 3784, 4294, 3793, 4607, 1878, 4297, 10815, 661, 13072, 13073, 13074, 13075, 8160, 12107, 13076, 13077, 8146, 1244, 13078, 10822, 4020, 7145, 4805, 6526, 683, 4863, 63, 4561, 2] */;