decord/beta/source/modules/calls/NativeMuteManager.native.tsx
github-actions 84d017ff78 chore: update source for beta 348.6
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5021.js (118.4 MB)
2026-09-28 16:18:32 +00:00

118 lines
4.6 KiB
TypeScript

// Module ID: 13360
// Function ID: 13361
// Name: NativeMuteManager
// Dependencies: [9098, 1993, 3, 2040, 573, 9104, 1995, 2]
// Module 13360 (NativeMuteManager)
import LoggerDefault from "Logger" /* 3 */;
import inject from "inject" /* 1995 */;
import Timers from "Timers" /* 2040 */;
import AudioActionCreatorsDefault from "AudioActionCreators" /* 9104 */;
import AudioRouteStore from "AudioRouteStore" /* 9098 */;
import MediaEngineStore from "MediaEngineStore" /* 1993 */;
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(2040).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);