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

150 lines
8.7 KiB
TypeScript

/* Metro module 15665; source: modules/voice_calls/native/AudioSessionModeManager.tsx; dependencies: [7, 6, 15, 17, 18, 27, 1378, 4811, 4492, 1226, 1379, 4259, 1934, 4297, 7030, 661, 477, 15666, 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 AuthenticationStore from '../../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */
import EmbeddedActivitiesStore from '../../activities/EmbeddedActivitiesStore.tsx'; /* Metro dependency 1378 */
import ChannelStore from '../../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import SelectedChannelStore from '../../../stores/SelectedChannelStore.tsx'; /* Metro dependency 1934 */
import MediaEngineStore from '../../../stores/MediaEngineStore.tsx'; /* Metro dependency 4259 */
import VoiceStateStore from '../../../stores/VoiceStateStore.tsx'; /* Metro dependency 4297 */
import ApplicationStreamingStore from '../../../stores/ApplicationStreamingStore.tsx'; /* Metro dependency 4492 */
import StageChannelRoleStore from '../../stage_channels/StageChannelRoleStore.tsx'; /* Metro dependency 4811 */
import AppStateStore from '../../../stores/native/AppStateStore.tsx'; /* Metro dependency 7030 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as PlatformUtilsModule from '../../../utils/PlatformUtils.tsx'; /* Metro dependency 477 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
function _fun120105(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#120105, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15873:6, offset: 0x02520f21, size: 510 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const NativeModules = (ReactNativeModule).NativeModules;
let value = PlatformUtilsModule;
const AVAudioSessionMode = (value.isAndroid() ? {setAVAudioSessionMode: function() {
}, AVAudioSessionMode: {'VOICE': 'AVAudioSessionModeVoiceChat', 'VIDEO': 'AVAudioSessionModeVideoChat',
'LISTEN': 'AVAudioSessionModeSpokenAudio',
'DEFAULT': 'AVAudioSessionModeDefault'}} : NativeModules.VoiceEngine).AVAudioSessionMode;
const env0_18 = AVAudioSessionMode.VOICE;
value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
value = _fun120111(value);
value = new value();
(FileImportTrackerModule).fileFinishedImporting('modules/voice_calls/native/AudioSessionModeManager.tsx');
exports.default = value;
function _isNativeReflectConstruct_120106() { // fn#120106, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15873:288, offset: 0x0252111f, 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_120106_isNativeReflectConstruct = function() {
return !!result;
})();
}
function handleAVAudioSessionMode() { // fn#120109, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15873:750, offset: 0x02521181, size: 310 bytes, params: 1, frame: 16
var r3;
var r2;
var applicationStreamingStoreBinding;
var embeddedActivitiesStoreBinding;
var moduleValue;
var shouldImmediatelyRequestVoicePermissions2;
var AVAudioSessionMode;
const channelStoreBinding = ChannelStore;
const getChannel = channelStoreBinding.getChannel;
const selectedChannelStoreBinding = SelectedChannelStore;
const getVoiceChannelId = selectedChannelStoreBinding.getVoiceChannelId;
const value2 = Reflect.apply(getChannel, channelStoreBinding, [Reflect.apply(getVoiceChannelId,
selectedChannelStoreBinding, [])]);
if (value2 == null) {
r2 = env0_17.AVAudioSessionMode.DEFAULT;
} else {
applicationStreamingStoreBinding = ApplicationStreamingStore;
r3 = applicationStreamingStoreBinding.getAllActiveStreams().length > 0 || VoiceStateStore.hasVideo(value2.id);
r3 = !r3 ? MediaEngineStore.isVideoEnabled() : r3;
embeddedActivitiesStoreBinding = EmbeddedActivitiesStore;
if (r3) {
r2 = env0_17.AVAudioSessionMode.VIDEO;
} else if (embeddedActivitiesStoreBinding.getCurrentEmbeddedActivity() != null) {
r2 = env0_17.AVAudioSessionMode.VIDEO;
} else {
moduleValue = require(15666) /* metro dependency 15666: VoicePermissionManager */;
shouldImmediatelyRequestVoicePermissions2 = moduleValue.shouldImmediatelyRequestVoicePermissions(AuthenticationStore.getId(),
value2.id);
AVAudioSessionMode = env0_17.AVAudioSessionMode;
r2 = shouldImmediatelyRequestVoicePermissions2 ? AVAudioSessionMode.VOICE : AVAudioSessionMode.LISTEN;
}
}
if (VOICE !== r2 && AppStateStore.getState() === AppStates.ACTIVE) {
env0_17.setAVAudioSessionMode(r2);
}
}
function _fun120111(a0) { // fn#120111, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15873:1293, offset: 0x025212b7, size: 42 bytes, params: 2, frame: 14
const AudioSessionModeManager2 = AudioSessionModeManager;
Inherits(AudioSessionModeManager2, a0);
return CreateClass(AudioSessionModeManager2);
function AudioSessionModeManager(a0) { // fn#120112, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15873:1305, offset: 0x025212e1, size: 239 bytes, params: 2, frame: 20
var r0;
var Reflect;
let value = copyRestArgs(0, undefined);
let binding = env1_3;
binding(this, AudioSessionModeManager);
const items2 = [];
arraySpread(items2, value, 0, items2);
value = env1_5(AudioSessionModeManager);
binding = env1_4;
if (_isNativeReflectConstruct_120106()) {
Reflect = global.Reflect;
value = Reflect.construct(value, items2, env1_5(this).constructor);
r0 = value;
} else {
value = value.apply(this, items2);
r0 = value;
}
value = binding(this, r0);
const Map = global.Map;
const map = new Map();
const set = map.set;
const applicationStreamingStoreBinding = ApplicationStreamingStore;
const handleAVAudioSessionModeBinding = handleAVAudioSessionMode;
const value6 = Reflect.apply(set, map, [applicationStreamingStoreBinding, handleAVAudioSessionModeBinding]);
const value7 = value6.set(VoiceStateStore, handleAVAudioSessionModeBinding);
const value8 = value7.set(MediaEngineStore, handleAVAudioSessionModeBinding);
const value9 = value8.set(StageChannelRoleStore, handleAVAudioSessionModeBinding);
value.stores = value9.set(EmbeddedActivitiesStore, handleAVAudioSessionModeBinding);
return value;
}
}
}
global.__d(_fun120105, 15665, [7, 6, 15, 17, 18, 27, 1378, 4811, 4492, 1226, 1379, 4259, 1934, 4297, 7030, 661, 477,
15666, 4860,
2]) /* metro module 15665, dependencies: [7, 6, 15, 17, 18, 27, 1378, 4811, 4492, 1226, 1379, 4259, 1934, 4297, 7030, 661, 477, 15666, 4860, 2] */;