// Metro module 12873 (f12874). import AudioRouteStore_native from "../voice_calls/AudioRouteStore.native"; import MediaEngineStore from "../../stores/MediaEngineStore"; import Logger from "../debug/Logger"; import { Timeout } from "../../_bundle/Timeout"; import Dispatcher from "../../Dispatcher"; import AudioActionCreators from "../../actions/AudioActionCreators"; import { getVoiceEngine } from "../../_bundle/Module4238"; function $mk90545($env) { return () => { const r1 = $env; const r2 = r1[0]; if (r2.audioRouteChangeIgnoreTimer.isStarted()) { r2.audioRouteChangeIgnoreTimer.stop(); } r2.ignoreForAudioRouteChange = true; r2.audioRouteChangeIgnoreTimer.start(r2.AUDIO_ROUTE_CHANGE_IGNORE_DURATION_MS, $mk109007(r1)); }; } function $mk109007($env) { return () => { $env[0].ignoreForAudioRouteChange = false; }; } let c8873_0; let c8872_6; let env8873; let c8872_5 = new Logger("NativeMuteManager"); c8872_5.enableNativeLogger(true); class NativeMuteManager { constructor() { let env20276; const r5 = env20276 = {}; env20276[0] = this; this.ignoreForNativeUnmute = false; this.needToUnmuteNative = false; this.ignoreForAudioRouteChange = false; this.audioRouteChangeIgnoreTimer = new Timeout(); this.AUDIO_ROUTE_CHANGE_IGNORE_DURATION_MS = 300; this.handleAudioRouteChange = $mk90545(r5); AudioRouteStore_native.addChangeListener(this.handleAudioRouteChange); Dispatcher.subscribe("VOICE_CHANNEL_SELECT", this.handleVoiceChannelSelect); } nativeMuteChanged() { if (!MediaEngineStore.hasActiveCallKitCall()) { if (this.ignoreForNativeUnmute) { this.ignoreForNativeUnmute = false; } else if (!this.ignoreForAudioRouteChange) { this.needToUnmuteNative = true; c8872_5.log("Native mute changed > toggling mute"); AudioActionCreators.toggleSelfMute({ playSoundEffect: false }); } } } updateNativeMute() { if (!MediaEngineStore.hasActiveCallKitCall() && this.needToUnmuteNative) { this.needToUnmuteNative = false; this.ignoreForNativeUnmute = true; c8872_5.log("Update native mute > unmuting native"); const voiceEngine = getVoiceEngine(); const setNativeMuteState = voiceEngine.setNativeMuteState; if (setNativeMuteState != null) { setNativeMuteState.call(voiceEngine, false); } } } handleVoiceChannelSelect(a0) { if (a0.channelId == null) { c8872_5.log("Leaving voice channel > unmuting native"); const voiceEngine = getVoiceEngine(); const setNativeMuteState = voiceEngine.setNativeMuteState; if (setNativeMuteState != null) { setNativeMuteState.call(voiceEngine, false); } } } } const r39 = { __proto__: NativeMuteManager.prototype }; const r40 = env8873 = {}; c8873_0 = r39; r39.ignoreForNativeUnmute = false; r39.needToUnmuteNative = false; r39.ignoreForAudioRouteChange = false; r39.audioRouteChangeIgnoreTimer = new Timeout(); r39.AUDIO_ROUTE_CHANGE_IGNORE_DURATION_MS = 300; r39.handleAudioRouteChange = $mk90545(r40); AudioRouteStore_native.addChangeListener(r39.handleAudioRouteChange); Dispatcher.subscribe("VOICE_CHANNEL_SELECT", r39.handleVoiceChannelSelect); c8872_6 = r39; class NativeMuteManagerWrapper { constructor() { return { __proto__: new.target.prototype }; } nativeMuteChanged(a0) { c8872_6.nativeMuteChanged(a0); } updateNativeMute() { c8872_6.updateNativeMute(); } } const prototype = NativeMuteManagerWrapper.prototype; export default { __proto__: prototype };