decord/source/modules/calls/NativeMuteManager.native.tsx
github-actions 777dc50a28 chore: update source for alpha 346.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4790.js (118.4 MB)
2026-09-10 19:12:31 +00:00

118 lines
4.6 KiB
TypeScript

// Module ID: 13890
// Function ID: 13891
// Name: NativeMuteManager
// Dependencies: [9152, 1908, 3, 4492, 573, 9158, 1910, 2]
// Module 13890 (NativeMuteManager)
import LoggerDefault from "Logger" /* 3 */;
import inject from "inject" /* 1910 */;
import Timers from "Timers" /* 4492 */;
import AudioActionCreatorsDefault from "AudioActionCreators" /* 9158 */;
import AudioRouteStore from "AudioRouteStore" /* 9152 */;
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(4492).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);