Files
discord-decomp/sources/modules/calls/NativeMuteManager.native.tsx
T
2026-07-27 16:20:00 +03:00

122 lines
6.9 KiB
TypeScript

/* Metro module 12401; source: modules/calls/NativeMuteManager.native.tsx; dependencies: [6, 7, 9229, 4259, 3, 4041, 694, 8899, 4261, 2] */
function _fun94506(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#94506, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12587:6, offset: 0x0211aaf6, size: 278 bytes, params: 8, frame: 20
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(6) /* metro dependency 6 */;
const env0_4 = importDefault(7) /* metro dependency 7 */;
const audioRouteStoreNative = importDefault(9229) /* metro dependency 9229: AudioRouteStoreNative */;
const mediaEngineStore = importDefault(4259) /* metro dependency 4259: MediaEngineStore */;
let value = importDefault(3) /* metro dependency 3: Logger */;
value = new value('NativeMuteManager');
value.enableNativeLogger(true);
value = _fun94507();
value = new value();
value = _fun94514();
value = new value();
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/calls/NativeMuteManager.native.tsx');
exports.default = value;
}
function _fun94507() { // fn#94507, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12587:207, offset: 0x0211ac0c, size: 109 bytes, params: 1, frame: 15
return env0_4(NativeMuteManager, [{key: 'nativeMuteChanged', value: value_94511}, {key: 'updateNativeMute',
value: value_94512}, {key: 'handleVoiceChannelSelect', value: value_94513}]);
}
function _fun94514() { // fn#94514, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12587:1653, offset: 0x0211af06, size: 84 bytes, params: 1, frame: 15
return env0_4(NativeMuteManagerWrapper, [{key: 'nativeMuteChanged', value: value_94516}, {key: 'updateNativeMute',
value: value_94517}]);
}
function NativeMuteManager() { // fn#94508, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12587:228, offset: 0x0211ac79, size: 189 bytes, params: 1, frame: 16
var environment;
let value = environment.__proto__;
env1_3(this, NativeMuteManager);
this.ignoreForNativeUnmute = false;
this.needToUnmuteNative = false;
this.ignoreForAudioRouteChange = false;
const Timeout = (require(4041) /* metro dependency 4041: Timers */).Timeout;
const value3 = Object.create(Timeout.prototype, {constructor: {value: Timeout}});
const timeout = new Timeout();
this.audioRouteChangeIgnoreTimer = timeout instanceof Object ? timeout : value3;
this.AUDIO_ROUTE_CHANGE_IGNORE_DURATION_MS = 300;
this.handleAudioRouteChange = handleAudioRouteChange;
const addChangeListener = AudioRouteStoreNative.addChangeListener;
var handleAudioRouteChange = this.handleAudioRouteChange;
Reflect.apply(addChangeListener, AudioRouteStoreNative, [handleAudioRouteChange]);
value = importDefault(694) /* metro dependency 694: Dispatcher */;
value.subscribe('VOICE_CHANNEL_SELECT', this.handleVoiceChannelSelect);
}
function value_94511() { // fn#94511, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12587:909, offset: 0x0211ada7, size: 126 bytes, params: 1, frame: 13
const value = environment.__proto__;
if (!MediaEngineStore.hasActiveCallKitCall()) {
if (this.ignoreForNativeUnmute) {
this.ignoreForNativeUnmute = false;
} else if (!this.ignoreForAudioRouteChange) {
this.needToUnmuteNative = true;
env1_7.log('Native mute changed > toggling mute');
(importDefault(8899) /* metro dependency 8899: AudioActionCreators */).toggleSelfMute({playSoundEffect: false});
}
}
}
function value_94512() { // fn#94512, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12587:1188, offset: 0x0211ae25, size: 128 bytes, params: 1, frame: 14
var setNativeMuteState;
let value = environment.__proto__;
if (!MediaEngineStore.hasActiveCallKitCall()) {
if (this.needToUnmuteNative) {
this.needToUnmuteNative = false;
this.ignoreForNativeUnmute = true;
env1_7.log('Update native mute > unmuting native');
value = require(4261) /* metro dependency 4261: inject */;
value = value.getVoiceEngine();
setNativeMuteState = value.setNativeMuteState;
if (setNativeMuteState != null) {
setNativeMuteState.call(value, false);
}
}
}
}
function value_94513({channelId}) { // fn#94513, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12587:1475, offset: 0x0211aea5, size: 97 bytes, params: 2, frame: 14
var value;
var setNativeMuteState;
if (channelId == null) {
value = environment.__proto__;
env1_7.log('Leaving voice channel > unmuting native');
value = require(4261) /* metro dependency 4261: inject */;
value = value.getVoiceEngine();
setNativeMuteState = value.setNativeMuteState;
if (setNativeMuteState != null) {
setNativeMuteState.call(value, false);
}
}
}
function value_94516(a0) { // fn#94516, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12587:1777, offset: 0x0211af5a, size: 25 bytes, params: 2, frame: 11
env1_8.nativeMuteChanged(a0);
}
function value_94517() { // fn#94517, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12587:1844, offset: 0x0211af73, size: 21 bytes, params: 1, frame: 9
env1_8.updateNativeMute();
}
function handleAudioRouteChange() { // fn#94509, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12587:503, owner: NativeMuteManager.handleAudioRouteChange, offset: 0x0211ad36, size: 94 bytes, params: 1, frame: 13
let audioRouteChangeIgnoreTimer = env0_0.audioRouteChangeIgnoreTimer;
if (audioRouteChangeIgnoreTimer.isStarted()) {
env0_0.audioRouteChangeIgnoreTimer.stop();
}
const binding = env0_0;
binding.ignoreForAudioRouteChange = true;
audioRouteChangeIgnoreTimer = binding.audioRouteChangeIgnoreTimer;
const start = audioRouteChangeIgnoreTimer.start;
const AUDIO_ROUTE_CHANGE_IGNORE_DURATION_MS = binding.AUDIO_ROUTE_CHANGE_IGNORE_DURATION_MS;
Reflect.apply(start, audioRouteChangeIgnoreTimer, [AUDIO_ROUTE_CHANGE_IGNORE_DURATION_MS, _fun94510]);
}
function _fun94510() { // fn#94510, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12587:711, offset: 0x0211ad94, size: 19 bytes, params: 1, frame: 2
env1_0.ignoreForAudioRouteChange = false;
}