// Module ID: 13904 // Function ID: 13905 // Name: NativeMuteManager // Dependencies: [9212, 1908, 3, 1952, 573, 9218, 1910, 2] // Module 13904 (NativeMuteManager) import LoggerDefault from "Logger" /* 3 */; import inject from "inject" /* 1910 */; import Timers from "Timers" /* 1952 */; import AudioActionCreatorsDefault from "AudioActionCreators" /* 9218 */; import AudioRouteStore from "AudioRouteStore" /* 9212 */; import MediaEngineStore from "MediaEngineStore" /* 1908 */; import Dispatcher from "Dispatcher" /* 573 */; require = fn; let obj2 = new LoggerDefault("NativeMuteManager"); obj2.enableNativeLogger(true); class NativeMuteManager { constructor() { obj1 = Object.create(new.target.prototype); closure_0 = obj1; obj1.ignoreForNativeUnmute = false; obj1.needToUnmuteNative = false; obj1.ignoreForAudioRouteChange = false; timeout = new closure_0(closure_2[3]).Timeout(); obj1.audioRouteChangeIgnoreTimer = timeout; obj1.AUDIO_ROUTE_CHANGE_IGNORE_DURATION_MS = 300; obj1.handleAudioRouteChange = function handleAudioRouteChange() { const audioRouteChangeIgnoreTimer = obj2.audioRouteChangeIgnoreTimer; if (audioRouteChangeIgnoreTimer.isStarted()) { const audioRouteChangeIgnoreTimer2 = tmp.audioRouteChangeIgnoreTimer; audioRouteChangeIgnoreTimer2.stop(); } obj2.ignoreForAudioRouteChange = true; const audioRouteChangeIgnoreTimer3 = tmp.audioRouteChangeIgnoreTimer; audioRouteChangeIgnoreTimer3.start(obj2.AUDIO_ROUTE_CHANGE_IGNORE_DURATION_MS, () => { obj2.ignoreForAudioRouteChange = false; }); }; addChangeListenerResult = closure_3.addChangeListener(obj1.handleAudioRouteChange); obj = closure_1(closure_2[4]); subscription = obj.subscribe("VOICE_CHANNEL_SELECT", obj1.handleVoiceChannelSelect); return obj1; } } const prototype = NativeMuteManager.prototype; prototype["nativeMuteChanged"] = function nativeMuteChanged() { if (!MediaEngineStore.hasActiveCallKitCall()) { const self = this; if (this.ignoreForNativeUnmute) { self.ignoreForNativeUnmute = false; } else if (!self.ignoreForAudioRouteChange) { self.needToUnmuteNative = true; obj2.log("Native mute changed > toggling mute"); AudioActionCreatorsDefault.toggleSelfMute({ playSoundEffect: false }); } } }; prototype["updateNativeMute"] = function updateNativeMute() { if (!MediaEngineStore.hasActiveCallKitCall()) { const self = this; if (this.needToUnmuteNative) { self.needToUnmuteNative = false; self.ignoreForNativeUnmute = true; obj2.log("Update native mute > unmuting native"); const voiceEngine = inject.getVoiceEngine(); const setNativeMuteState = voiceEngine.setNativeMuteState; if (setNativeMuteState != null) { setNativeMuteState(false); } } } }; prototype["handleVoiceChannelSelect"] = function handleVoiceChannelSelect(channelId) { if (null == channelId.channelId) { obj2.log("Leaving voice channel > unmuting native"); const voiceEngine = inject.getVoiceEngine(); const setNativeMuteState = voiceEngine.setNativeMuteState; if (setNativeMuteState != null) { setNativeMuteState(false); } } }; let obj = Object.create(NativeMuteManager.prototype); let closure_129_0 = obj; obj.ignoreForNativeUnmute = false; obj.needToUnmuteNative = false; obj.ignoreForAudioRouteChange = false; let timeout = new fn(1952).Timeout(); obj.audioRouteChangeIgnoreTimer = timeout; obj.AUDIO_ROUTE_CHANGE_IGNORE_DURATION_MS = 300; obj.handleAudioRouteChange = function handleAudioRouteChange() { const audioRouteChangeIgnoreTimer = obj2.audioRouteChangeIgnoreTimer; if (audioRouteChangeIgnoreTimer.isStarted()) { const audioRouteChangeIgnoreTimer2 = tmp.audioRouteChangeIgnoreTimer; audioRouteChangeIgnoreTimer2.stop(); } obj2.ignoreForAudioRouteChange = true; const audioRouteChangeIgnoreTimer3 = tmp.audioRouteChangeIgnoreTimer; audioRouteChangeIgnoreTimer3.start(obj2.AUDIO_ROUTE_CHANGE_IGNORE_DURATION_MS, () => { obj2.ignoreForAudioRouteChange = false; }); }; AudioRouteStore.addChangeListener(obj.handleAudioRouteChange); let subscription = Dispatcher.subscribe("VOICE_CHANNEL_SELECT", obj.handleVoiceChannelSelect); class NativeMuteManagerWrapper { } const prototype2 = NativeMuteManagerWrapper.prototype; prototype2["nativeMuteChanged"] = function nativeMuteChanged(arg0) { obj.nativeMuteChanged(arg0); }; prototype2["updateNativeMute"] = function updateNativeMute() { obj.updateNativeMute(); }; const size = fn(2); const result = size.fileFinishedImporting("modules/calls/NativeMuteManager.native.tsx"); export default Object.create(NativeMuteManagerWrapper.prototype);