134 lines
6.9 KiB
TypeScript
134 lines
6.9 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] */
|
|
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 env0_2 = importDefault(7) /* metro dependency 7 */;
|
|
const env0_3 = importDefault(6) /* metro dependency 6 */;
|
|
const env0_4 = importDefault(15) /* metro dependency 15 */;
|
|
const env0_5 = importDefault(17) /* metro dependency 17 */;
|
|
const env0_6 = importDefault(18) /* metro dependency 18 */;
|
|
const NativeModules = (require(27) /* metro dependency 27 */).NativeModules;
|
|
const embeddedActivitiesStore = importDefault(1378) /* metro dependency 1378: EmbeddedActivitiesStore */;
|
|
const stageChannelRoleStore = importDefault(4811) /* metro dependency 4811: StageChannelRoleStore */;
|
|
const applicationStreamingStore = importDefault(4492) /* metro dependency 4492: ApplicationStreamingStore */;
|
|
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
|
|
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
|
|
const mediaEngineStore = importDefault(4259) /* metro dependency 4259: MediaEngineStore */;
|
|
const selectedChannelStore = importDefault(1934) /* metro dependency 1934: SelectedChannelStore */;
|
|
const voiceStateStore = importDefault(4297) /* metro dependency 4297: VoiceStateStore */;
|
|
const appStateStore = importDefault(7030) /* metro dependency 7030: AppStateStore */;
|
|
const env0_16 = (require(661) /* metro dependency 661: Constants */).AppStates;
|
|
let value = require(477) /* metro dependency 477: PlatformUtils */;
|
|
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();
|
|
(require(2) /* metro dependency 2 */).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 moduleValue;
|
|
var shouldImmediatelyRequestVoicePermissions2;
|
|
var AVAudioSessionMode;
|
|
const getChannel = ChannelStore.getChannel;
|
|
const getVoiceChannelId = SelectedChannelStore.getVoiceChannelId;
|
|
const value2 = Reflect.apply(getChannel, ChannelStore, [Reflect.apply(getVoiceChannelId, SelectedChannelStore, [])]);
|
|
if (value2 == null) {
|
|
r2 = env0_17.AVAudioSessionMode.DEFAULT;
|
|
} else {
|
|
r3 = ApplicationStreamingStore.getAllActiveStreams().length > 0 || VoiceStateStore.hasVideo(value2.id);
|
|
r3 = !r3 ? MediaEngineStore.isVideoEnabled() : r3;
|
|
if (r3) {
|
|
r2 = env0_17.AVAudioSessionMode.VIDEO;
|
|
} else if (EmbeddedActivitiesStore.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 closure = AudioSessionModeManager;
|
|
env0_6(closure, a0);
|
|
return env0_2(closure);
|
|
}
|
|
|
|
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 handleAVAudioSessionModeBinding = handleAVAudioSessionMode;
|
|
value.stores = Reflect.apply(set, map, [ApplicationStreamingStore,
|
|
handleAVAudioSessionModeBinding]).set(VoiceStateStore, handleAVAudioSessionModeBinding).set(MediaEngineStore,
|
|
handleAVAudioSessionModeBinding).set(StageChannelRoleStore,
|
|
handleAVAudioSessionModeBinding).set(EmbeddedActivitiesStore, handleAVAudioSessionModeBinding);
|
|
return value;
|
|
}
|
|
|